|
@@ -65,7 +65,7 @@ func (this *CustomManager) GetData(userId, keyWords string, isNew bool) map[stri
|
|
|
if bytes, err := redis.GetBytes(customCacheDb, fmt.Sprintf(customDataCacheKey, userId)); err == nil && bytes != nil {
|
|
|
rData := map[string]interface{}{}
|
|
|
if err := json.Unmarshal(*bytes, &rData); err != nil {
|
|
|
- log.Printf("[ERROR]CustomManager %s GetData Error %v \n", userId, err)
|
|
|
+ log.Printf("[MANAGER-ERR]CustomManager %s GetData Error %v \n", userId, err)
|
|
|
return nil
|
|
|
}
|
|
|
return rData
|
|
@@ -112,7 +112,6 @@ func (this *CustomManager) UpdateUserGroupJob() {
|
|
|
defer this.Unlock()
|
|
|
this.UserGroup = newMap
|
|
|
|
|
|
- log.Printf("CustomManager NewGroup %v\n", newMap)
|
|
|
go this.activityUserQueue(this.BatchFlag, userArr)
|
|
|
}
|
|
|
|
|
@@ -120,6 +119,7 @@ func (this *CustomManager) getUserGroup() (userIds []string) {
|
|
|
//当前批次是否已有数据
|
|
|
rData := public.UserAnalyseDb.SelectBySql("SELECT user_mongoid AS uid FROM user_leadGeneration_group WHERE group_type = 1 AND group_name=?", this.BatchFlag)
|
|
|
if rData != nil || len(*rData) == 0 {
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager getUserGroup from Db Total is %d \n", len(*rData))
|
|
|
userIds = make([]string, 0, len(*rData))
|
|
|
for _, m := range *rData {
|
|
|
if uId, _ := m["uid"].(string); uId != "" {
|
|
@@ -129,6 +129,7 @@ func (this *CustomManager) getUserGroup() (userIds []string) {
|
|
|
}
|
|
|
//无数据则重新生成用户群组数据
|
|
|
if len(userIds) == 0 {
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager getUserGroup createNewGroup start\n")
|
|
|
var (
|
|
|
wg sync.WaitGroup
|
|
|
newActiveGroup, testUserGroup []string
|
|
@@ -142,7 +143,7 @@ func (this *CustomManager) getUserGroup() (userIds []string) {
|
|
|
testUserGroup = append(testUserGroup, uid)
|
|
|
}
|
|
|
}
|
|
|
- activeUsers.SaveBatchGroup(newActiveGroup, 1, this.BatchFlag, "testUser")
|
|
|
+ activeUsers.SaveBatchGroup(testUserGroup, 1, this.BatchFlag, "testUser")
|
|
|
}()
|
|
|
//测试用户群组
|
|
|
go func() {
|
|
@@ -155,6 +156,8 @@ func (this *CustomManager) getUserGroup() (userIds []string) {
|
|
|
userIds = make([]string, 0, len(newActiveGroup)+len(testUserGroup))
|
|
|
userIds = append(userIds, newActiveGroup...)
|
|
|
userIds = append(userIds, testUserGroup...)
|
|
|
+
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager getUserGroup createNewGroup end Total %d\n", len(userIds))
|
|
|
}
|
|
|
return
|
|
|
|
|
@@ -164,18 +167,18 @@ func (this *CustomManager) getUserGroup() (userIds []string) {
|
|
|
func (this *CustomManager) activityUserQueue(batchFlag string, userIds []string) {
|
|
|
for i, userId := range userIds {
|
|
|
if i%100 == 0 {
|
|
|
- log.Printf("[INFO]CustomManager Batch %s Now(%d/%d)\n", batchFlag, len(userIds), i)
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager Batch %s Now(%d/%d)\n", batchFlag, i, len(userIds))
|
|
|
}
|
|
|
//当批次更新时,上批次停止
|
|
|
if this.BatchFlag != batchFlag {
|
|
|
- log.Printf("[INFO]CustomManager Batch %s Is END At (%d/%d) \n", batchFlag, i, len(userIds))
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager Batch %s Is END At (%d/%d) \n", batchFlag, i, len(userIds))
|
|
|
break
|
|
|
}
|
|
|
activityUserQueue <- &SearchEntity{
|
|
|
UserId: userId,
|
|
|
}
|
|
|
}
|
|
|
- log.Printf("[INFO]CustomManager Batch %s Is Finished !!!\n", batchFlag)
|
|
|
+ log.Printf("[MANAGER-INFO]CustomManager Batch %s Is Finished !!!\n", batchFlag)
|
|
|
}
|
|
|
|
|
|
// DoSearch 定制化分析报告查询队列
|
|
@@ -200,7 +203,7 @@ func (this *CustomManager) DoSearch() {
|
|
|
//查询结果处理
|
|
|
data := search.PotentialCustomizeAnalysis(obj.UserId, obj.Value)
|
|
|
if data == nil || len(data) == 0 {
|
|
|
- log.Printf("[ERROR]CustomManager %s DoSearch %s Is Empty\n", obj.UserId, obj.Value)
|
|
|
+ log.Printf("[MANAGER-ERR]CustomManager %s DoSearch %s Is Empty\n", obj.UserId, obj.Value)
|
|
|
continue
|
|
|
}
|
|
|
//缓存结果
|