|
@@ -260,8 +260,8 @@ func (h *historyPush) getJyPushs(datas []map[string]interface{}) (pushCas []*jy.
|
|
|
pushCas = append(pushCas, &jy.PushCa{
|
|
|
Date: util.Int64All(v["date"]),
|
|
|
InfoId: id_v,
|
|
|
- Visit: h.isVisited(openList, id_k),
|
|
|
- Index: id_k,
|
|
|
+ Visit: h.isVisited(openList, id_k+1),
|
|
|
+ Index: id_k + 1,
|
|
|
})
|
|
|
if len(pushCas) == 1000 {
|
|
|
return
|
|
@@ -373,7 +373,7 @@ func (h *historyPush) getInfoByIds(pushCas []*jy.PushCa) []map[string]interface{
|
|
|
func (h *historyPush) MakeHistoryDatas(userId, field string, o_jy map[string]interface{}) (bool, []map[string]interface{}) {
|
|
|
allquery := `{"range":{"publishtime":{"gt":%s}}}`
|
|
|
allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
- // allquery := ``
|
|
|
+ //allquery := ``
|
|
|
_, list := PushView(userId, allquery, field, 1, 50)
|
|
|
if list == nil || len(*list) == 0 {
|
|
|
return true, nil
|
|
@@ -381,37 +381,85 @@ func (h *historyPush) MakeHistoryDatas(userId, field string, o_jy map[string]int
|
|
|
result := []map[string]interface{}{}
|
|
|
pushinfo := []string{}
|
|
|
publishTitle := map[string]bool{}
|
|
|
- for _, v := range *list {
|
|
|
+ now := time.Now()
|
|
|
+ for k, v := range *list {
|
|
|
title := strings.Replace(v["title"].(string), "\n", "", -1)
|
|
|
- area := util.ObjToString(v["area"])
|
|
|
- if publishTitle[area+title] {
|
|
|
+ area_check := util.ObjToString(v["area"])
|
|
|
+ if publishTitle[area_check+title] {
|
|
|
log.Println("重复标题", title)
|
|
|
continue
|
|
|
} else {
|
|
|
- publishTitle[area+title] = true
|
|
|
+ publishTitle[area_check+title] = true
|
|
|
}
|
|
|
pushinfo = append(pushinfo, util.ObjToString(v["_id"]))
|
|
|
- result = append(result, map[string]interface{}{
|
|
|
- "publishtime": v["publishtime"],
|
|
|
- "stype": v["type"],
|
|
|
- "topstype": v["toptype"],
|
|
|
- "substype": v["subtype"],
|
|
|
- "subscopeclass": v["s_subscopeclass"],
|
|
|
- "buyer": v["buyer"],
|
|
|
- "projectname": v["projectname"],
|
|
|
- "budget": v["budget"],
|
|
|
- "bidopentime": v["bidopentime"],
|
|
|
- "winner": v["winner"],
|
|
|
- "bidamount": v["bidamount"],
|
|
|
- "title": title,
|
|
|
- })
|
|
|
+
|
|
|
+ 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"],
|
|
|
+ "buyer": v["buyer"],
|
|
|
+ "projectname": v["projectname"],
|
|
|
+ "budget": v["budget"],
|
|
|
+ "bidopentime": v["bidopentime"],
|
|
|
+ "winner": v["winner"],
|
|
|
+ "bidamount": v["bidamount"],
|
|
|
+ "title": title,
|
|
|
+ "ca_openlist_index": k + 1,
|
|
|
+ "ca_date": now.Unix(),
|
|
|
+ }
|
|
|
+ area := util.ObjToString(info["area"])
|
|
|
+ if area == "A" {
|
|
|
+ area = "全国"
|
|
|
+ }
|
|
|
+ budget, _ := info["budget"].(float64)
|
|
|
+ if budget == 0 || strings.TrimSpace(fmt.Sprint(info["budget"])) == "" {
|
|
|
+ delete(info, "budget")
|
|
|
+ }
|
|
|
+ bidamount, _ := info["bidamount"].(float64)
|
|
|
+ if bidamount == 0 || strings.TrimSpace(fmt.Sprint(info["bidamount"])) == "" {
|
|
|
+ delete(info, "bidamount")
|
|
|
+ }
|
|
|
+ industry := util.ObjToString(info["s_subscopeclass"])
|
|
|
+ scs := strings.Split(industry, ",")
|
|
|
+ if len(scs) > 0 {
|
|
|
+ industry = scs[0]
|
|
|
+ if industry != "" {
|
|
|
+ iss := strings.Split(industry, "_")
|
|
|
+ if len(iss) > 0 {
|
|
|
+ industry = iss[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info["s_subscopeclass"] = industry
|
|
|
+ }
|
|
|
+ infotype := util.ObjToString(info["subtype"])
|
|
|
+ if infotype == "" {
|
|
|
+ infotype = util.ObjToString(info["toptype"])
|
|
|
+ }
|
|
|
+ if infotype == "" {
|
|
|
+ infotype = util.ObjToString(info["type"])
|
|
|
+ if infotype == "tender" {
|
|
|
+ infotype = "招标"
|
|
|
+ } else if infotype == "bid" {
|
|
|
+ infotype = "中标"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info["type"] = infotype
|
|
|
+ delete(info, "subtype")
|
|
|
+ delete(info, "toptype")
|
|
|
+
|
|
|
+ result = append(result, info)
|
|
|
}
|
|
|
wxpush := map[string]interface{}{
|
|
|
- "dateymd": time.Now().Format(util.Date_yyyyMMdd),
|
|
|
- "date": time.Now().Unix(),
|
|
|
+ "dateymd": now.Format(util.Date_yyyyMMdd),
|
|
|
+ "date": now.Unix(),
|
|
|
"uid": userId,
|
|
|
"pushinfo": strings.Join(pushinfo, ","),
|
|
|
}
|
|
|
+ log.Println(wxpush)
|
|
|
flag := Ca_Push.SaveCacheByTimeOut("jy_pushsubscribe", wxpush, 10)
|
|
|
return flag, result
|
|
|
}
|