Просмотр исходного кода

Merge branch 'dev2.8.5' of http://192.168.3.207:10080/qmx/jy into dev2.8.5

xuzhiheng 5 лет назад
Родитель
Сommit
90e943bc89

+ 2 - 0
src/jfw/modules/pushsubscribe/src/push/job/projectjob.go

@@ -120,6 +120,8 @@ func (p *ProjectPushJob) Execute() {
 									"area":       util.ObjToString(plm["area"]),
 									"city":       util.ObjToString(plm["city"]),
 									"_id":        infoId,
+									"toptype":    util.ObjToString(plm["toptype"]),
+									"subtype":    util.ObjToString(plm["subtype"]),
 									"buyerclass": util.ObjToString(plm["buyerclass"]),
 								},
 							})

+ 11 - 1
src/jfw/modules/pushsubscribe/src/push/util/util.go

@@ -154,7 +154,7 @@ func SaveToPushsubscribe(isVipUser, isProjectInfo bool, userId string, matchInfo
 	}
 	unix := time.Now().Unix()
 	length := len(*matchInfos)
-	fields := []string{"userid", "infoid", "date", "matchkeys", "area", "city", "buyerclass", "type", "isvip"}
+	fields := []string{"userid", "infoid", "date", "matchkeys", "area", "city", "buyerclass", "type", "isvip", "toptype", "subtype"}
 	var savecount int64
 	batchSize := 0
 	values := []interface{}{}
@@ -191,6 +191,16 @@ func SaveToPushsubscribe(isVipUser, isProjectInfo bool, userId string, matchInfo
 		} else {
 			values = append(values, nil)
 		}
+		if toptype := util.ObjToString((*matchInfo.Info)["toptype"]); toptype != "" {
+			values = append(values, toptype)
+		} else {
+			values = append(values, nil)
+		}
+		if subtype := util.ObjToString((*matchInfo.Info)["subtype"]); subtype != "" {
+			values = append(values, subtype)
+		} else {
+			values = append(values, nil)
+		}
 		batchSize++
 		if i == 0 || batchSize == BigBulkSize {
 			savecount += Mysql.InsertBatch("pushsubscribe", fields, values)

+ 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,
 		})
 	}