|
@@ -505,28 +505,28 @@ func (s *subscribePush) GetInfoByIds(Mgo_bidding mg.MongodbSim, bidding, bidding
|
|
infos := map[string]map[string]interface{}{}
|
|
infos := map[string]map[string]interface{}{}
|
|
//redis
|
|
//redis
|
|
|
|
|
|
- //es_ids := ids
|
|
|
|
- //for _, v := range ids {
|
|
|
|
- // info_i := redis.Get("pushcache_1", fmt.Sprintf("info_%s", v))
|
|
|
|
- // if info_i != nil {
|
|
|
|
- // info_m, _ := info_i.(map[string]interface{})
|
|
|
|
- // info_m["_id"] = v
|
|
|
|
- // infos[v] = info_m
|
|
|
|
- // } else {
|
|
|
|
- // es_ids = append(es_ids, v)
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- // log.Println(es_ids)
|
|
|
|
|
|
+ es_ids := ids
|
|
|
|
+ for _, v := range ids {
|
|
|
|
+ info_i := redis.Get("pushcache_1", fmt.Sprintf("info_%s", v))
|
|
|
|
+ if info_i != nil {
|
|
|
|
+ info_m, _ := info_i.(map[string]interface{})
|
|
|
|
+ info_m["_id"] = v
|
|
|
|
+ infos[v] = info_m
|
|
|
|
+ } else {
|
|
|
|
+ es_ids = append(es_ids, v)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ log.Println(es_ids)
|
|
//elasticsearch
|
|
//elasticsearch
|
|
- //if len(es_ids) > 0 {
|
|
|
|
- list := elastic.Get("bidding", "bidding", fmt.Sprintf(query, strings.Join(ids, `","`), len(ids)))
|
|
|
|
- if list != nil {
|
|
|
|
- for _, v := range *list {
|
|
|
|
- _id := ObjToString(v["_id"])
|
|
|
|
- infos[_id] = v
|
|
|
|
|
|
+ if len(es_ids) > 0 {
|
|
|
|
+ list := elastic.Get("bidding", "bidding", fmt.Sprintf(query, strings.Join(es_ids, `","`), len(es_ids)))
|
|
|
|
+ if list != nil {
|
|
|
|
+ for _, v := range *list {
|
|
|
|
+ _id := ObjToString(v["_id"])
|
|
|
|
+ infos[_id] = v
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //}
|
|
|
|
//mongodb bidding
|
|
//mongodb bidding
|
|
mgo_ids := []primitive.ObjectID{}
|
|
mgo_ids := []primitive.ObjectID{}
|
|
for _, v := range ids {
|
|
for _, v := range ids {
|
|
@@ -576,7 +576,7 @@ func (s *subscribePush) GetInfoByIds(Mgo_bidding mg.MongodbSim, bidding, bidding
|
|
//保存最近7天的数据到历史记录
|
|
//保存最近7天的数据到历史记录
|
|
func (s *subscribePush) MakeHistoryDatas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId string, PushView func(userid, allquery, field string, pageNum, pageSize int) (keys []interface{}, list *[]map[string]interface{})) (bool, []*SubPushList) {
|
|
func (s *subscribePush) MakeHistoryDatas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId string, PushView func(userid, allquery, field string, pageNum, pageSize int) (keys []interface{}, list *[]map[string]interface{})) (bool, []*SubPushList) {
|
|
log.Println("匹配最近7天数据", userId)
|
|
log.Println("匹配最近7天数据", userId)
|
|
- field := `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount"`
|
|
|
|
|
|
+ field := `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","spidercode","site"`
|
|
allquery := `{"range":{"publishtime":{"gt":%s}}}`
|
|
allquery := `{"range":{"publishtime":{"gt":%s}}}`
|
|
allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
|
|
allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
|
|
//allquery = ``
|
|
//allquery = ``
|