wangshan il y a 5 ans
Parent
commit
39f8a8433c
1 fichiers modifiés avec 18 ajouts et 37 suppressions
  1. 18 37
      src/jfw/public/historypush.go

+ 18 - 37
src/jfw/public/historypush.go

@@ -439,7 +439,7 @@ type resultData struct {
 	Ca_isvip        int      `json:"ca_isvip"`
 	Ca_date         int64    `json:"ca_date"`
 	Ca_isvisit      int      `json:"ca_isvisit"`
-	Ca_index        int      `json:"ca_index"`
+	Ca_index        int64    `json:"ca_index"`
 	Matchkeys       []string `json:"matchkeys"`
 }
 
@@ -453,7 +453,7 @@ func (p resultSort) Less(i, j int) bool { return p[i].Ca_index > p[j].Ca_index }
 func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []*resultData) {
 	allquery := `{"range":{"publishtime":{"gt":%s}}}`
 	allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
-	allquery = ``
+	//	allquery = ``
 	keys, list := PushView(userId, allquery, field, 1, 50)
 	log.Println(list)
 	if list == nil || len(*list) == 0 {
@@ -492,25 +492,10 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []*resultDat
 		myInsert["isvip"] = 0
 		myInsert["buyerclass"] = v["buyerclass"]
 		id := Mysql.Insert("pushsubscribe", myInsert)
-		info := map[string]interface{}{
-			"area":            area_check,
-			"_id":             util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"])),
-			"publishtime":     v["publishtime"],
-			"stype":           v["type"],
-			"toptype":         v["toptype"],
-			"subtype":         v["subtype"],
-			"s_subscopeclass": v["s_subscopeclass"],
-			"title":           title,
-			"ca_isvip":        0,
-			"ca_date":         now.Unix(),
-			"ca_isvisit":      0,
-			"ca_index":        id,
+		if area_check == "A" {
+			area_check = "全国"
 		}
-		area := util.ObjToString(info["area"])
-		if area == "A" {
-			info["area"] = "全国"
-		}
-		industry := util.ObjToString(info["s_subscopeclass"])
+		industry := util.ObjToString(v["s_subscopeclass"])
 		scs := strings.Split(industry, ",")
 		if len(scs) > 0 {
 			industry = scs[0]
@@ -520,35 +505,31 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []*resultDat
 					industry = iss[0]
 				}
 			}
-			info["s_subscopeclass"] = industry
 		}
-		infotype := util.ObjToString(info["subtype"])
+		infotype := util.ObjToString(v["subtype"])
 		if infotype == "" {
-			infotype = util.ObjToString(info["toptype"])
+			infotype = util.ObjToString(v["toptype"])
 		}
 		if infotype == "" {
-			infotype = util.ObjToString(info["type"])
+			infotype = util.ObjToString(v["type"])
 			if infotype == "tender" {
 				infotype = "招标"
 			} else if infotype == "bid" {
 				infotype = "中标"
 			}
 		}
-		info["type"] = infotype
-		delete(info, "subtype")
-		delete(info, "toptype")
 
 		resultList = append(resultList, &resultData{
-			util.ObjToString(info["area"]),
-			util.ObjToString(info["_id"]),
-			util.Int64All(info["publishtime"]),
-			util.ObjToString(info["stype"]),
-			util.ObjToString(info["s_subscopeclass"]),
-			util.ObjToString(info["title"]),
-			util.IntAll(info["ca_isvip"]),
-			util.Int64All(info["ca_date"]),
-			util.IntAll(info["ca_isvisit"]),
-			util.IntAll(info["ca_index"]),
+			area_check,
+			util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"])),
+			util.Int64All(v["publishtime"]),
+			infotype,
+			industry,
+			title,
+			0,
+			now.Unix(),
+			0,
+			id,
 			matchkeys,
 		})
 	}