|
@@ -135,39 +135,28 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[stri
|
|
|
"buyerclass": 1,
|
|
|
}).Sort("_id").Iter()
|
|
|
index := 0
|
|
|
- loadBiddingPool := make(chan bool, Config.LoadBiddingPoolSize)
|
|
|
- loadBiddingWaitGroup := &sync.WaitGroup{}
|
|
|
- for data := make(map[string]interface{}); it.Next(&data); {
|
|
|
- loadBiddingPool <- true
|
|
|
- loadBiddingWaitGroup.Add(1)
|
|
|
- go func(temp map[string]interface{}) {
|
|
|
- defer func() {
|
|
|
- <-loadBiddingPool
|
|
|
- loadBiddingWaitGroup.Done()
|
|
|
- }()
|
|
|
- _id := util.BsonIdToSId(temp["_id"])
|
|
|
- temp["_id"] = _id
|
|
|
- if util.ObjToString(temp["area"]) == "A" {
|
|
|
- temp["area"] = "全国"
|
|
|
- }
|
|
|
- res = append(res, temp)
|
|
|
- //信息缓存3天
|
|
|
- info := map[string]interface{}{}
|
|
|
- for _, v := range SaveFields {
|
|
|
- if v == "_id" || temp[v] == nil {
|
|
|
- continue
|
|
|
- }
|
|
|
- info[v] = temp[v]
|
|
|
+ for temp := make(map[string]interface{}); it.Next(&temp); {
|
|
|
+ _id := util.BsonIdToSId(temp["_id"])
|
|
|
+ temp["_id"] = _id
|
|
|
+ if util.ObjToString(temp["area"]) == "A" {
|
|
|
+ temp["area"] = "全国"
|
|
|
+ }
|
|
|
+ res = append(res, temp)
|
|
|
+ //信息缓存3天
|
|
|
+ info := map[string]interface{}{}
|
|
|
+ for _, v := range SaveFields {
|
|
|
+ if v == "_id" || temp[v] == nil {
|
|
|
+ continue
|
|
|
}
|
|
|
- redis.Put(Pushcache_1, "info_"+_id, info, 259200)
|
|
|
- }(data)
|
|
|
- data = make(map[string]interface{})
|
|
|
+ info[v] = temp[v]
|
|
|
+ }
|
|
|
+ redis.Put(Pushcache_1, "info_"+_id, info, 259200)
|
|
|
+ temp = make(map[string]interface{})
|
|
|
index++
|
|
|
if index%500 == 0 {
|
|
|
logger.Info("加载", Bidding, "数据:", index)
|
|
|
}
|
|
|
}
|
|
|
- loadBiddingWaitGroup.Wait()
|
|
|
logger.Info(Bidding, "数据已经加载结束。。。", index)
|
|
|
return &res
|
|
|
}
|