|
@@ -106,6 +106,8 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]
|
|
|
logger.Info("第", batchIndex, "批开始保存到", Pushspace_temp, "表。。。")
|
|
|
index := 0
|
|
|
var saveBatch []map[string]interface{}
|
|
|
+ user_infoId := map[string]map[string]bool{}
|
|
|
+ lock := &sync.Mutex{}
|
|
|
for u, i := range *userMap {
|
|
|
m.savePool <- true
|
|
|
m.saveWaitGroup.Add(1)
|
|
@@ -123,10 +125,12 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]
|
|
|
sort.Sort(pushArray)
|
|
|
var array []*MatchInfo
|
|
|
titleMap := map[string]bool{}
|
|
|
+ infoIdMap := map[string]bool{}
|
|
|
size := 0
|
|
|
for _, v2 := range pushArray {
|
|
|
title := util.ObjToString((*v2.Info)["title"])
|
|
|
- pushInfoKey := PushInfoKey(user.Id, util.ObjToString((*v2.Info)["_id"]))
|
|
|
+ _id := util.ObjToString((*v2.Info)["_id"])
|
|
|
+ pushInfoKey := PushInfoKey(user.Id, _id)
|
|
|
if titleMap[title] {
|
|
|
continue
|
|
|
}
|
|
@@ -146,6 +150,7 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]
|
|
|
}
|
|
|
info[field] = (*v2.Info)[field]
|
|
|
}
|
|
|
+ infoIdMap[_id] = true
|
|
|
array = append(array, &MatchInfo{
|
|
|
Info: &info,
|
|
|
Keys: v2.Keys,
|
|
@@ -162,6 +167,9 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]
|
|
|
if size == 0 {
|
|
|
return
|
|
|
}
|
|
|
+ lock.Lock()
|
|
|
+ defer lock.Unlock()
|
|
|
+ user_infoId[user.Id] = infoIdMap
|
|
|
saveBatch = append(saveBatch, map[string]interface{}{
|
|
|
"s_m_openid": user.S_m_openid,
|
|
|
"a_m_openid": user.A_m_openid,
|
|
@@ -205,20 +213,20 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]
|
|
|
saveBatch = []map[string]interface{}{}
|
|
|
}
|
|
|
logger.Info("第", batchIndex, "批保存到", Pushspace_temp, "表结束。。", index)
|
|
|
- m.ToRelationProject(projectUserMap)
|
|
|
+ m.ToRelationProject(projectUserMap, user_infoId)
|
|
|
}
|
|
|
|
|
|
//关联项目
|
|
|
-func (m *MatchJob) ToRelationProject(projectUser *sync.Map) {
|
|
|
+func (m *MatchJob) ToRelationProject(projectUser *sync.Map, user_infoId map[string]map[string]bool) {
|
|
|
logger.Info("开始关联项目。。。")
|
|
|
index := 0
|
|
|
var updateproject [][]map[string]interface{}
|
|
|
lock := &sync.Mutex{}
|
|
|
projectUser.Range(func(key interface{}, value interface{}) bool {
|
|
|
- m.savePool <- true
|
|
|
- m.saveWaitGroup.Add(1)
|
|
|
k, _ := key.(string)
|
|
|
v, _ := value.(*[]*UserInfo)
|
|
|
+ m.savePool <- true
|
|
|
+ m.saveWaitGroup.Add(1)
|
|
|
go func(_id string, users *[]*UserInfo) {
|
|
|
defer func() {
|
|
|
<-m.savePool
|
|
@@ -240,6 +248,9 @@ func (m *MatchJob) ToRelationProject(projectUser *sync.Map) {
|
|
|
lock.Lock()
|
|
|
defer lock.Unlock()
|
|
|
for _, user := range *users {
|
|
|
+ if user_infoId[user.Id] == nil || !user_infoId[user.Id][_id] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
updateproject = append(updateproject, []map[string]interface{}{
|
|
|
map[string]interface{}{
|
|
|
"projectid": (*projects)[0]["_id"],
|
|
@@ -296,7 +307,7 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[stri
|
|
|
c_query["_id"] = idQuery
|
|
|
}
|
|
|
//c_query = map[string]interface{}{
|
|
|
- //"_id": bson.ObjectIdHex("5da71f96a5cb26b9b79b8e6c"),
|
|
|
+ //"_id": bson.ObjectIdHex("5da4c4dfa5cb26b9b7ffdc5d"),
|
|
|
//}
|
|
|
logger.Info("开始加载", Bidding, "数据", c_query)
|
|
|
var res []map[string]interface{}
|
|
@@ -393,6 +404,9 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
|
|
|
m.loadUserWaitGroup.Done()
|
|
|
}()
|
|
|
user, o_msgset := public.NewUserInfoByUserColl(temp)
|
|
|
+ if user == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
isVipUser := IsVipUser(user.VipStatus)
|
|
|
var allKeySet []*KeySet
|
|
|
var err error
|