wkyuer 1 周之前
父节点
当前提交
fa17ef972b
共有 1 个文件被更改,包括 20 次插入1 次删除
  1. 20 1
      urlStatic/job/job.go

+ 20 - 1
urlStatic/job/job.go

@@ -154,7 +154,8 @@ func NewMatchObj(ctx context.Context, isRunHistory bool) *MatchObj {
 	for uid, _ := range uuidCodeMapping {
 		result[uid] = make(map[BaseUserId]int64)
 	}
-
+	result["search_effective"] = make(map[BaseUserId]int64)
+	uuidCodeMapping["search_effective"] = "search_effective"
 	var userMap map[string]BaseUserId
 	if isRunHistory {
 		userMap = t
@@ -263,6 +264,24 @@ func (o *MatchObj) Match(ctx context.Context, start, end time.Time) error {
 			}
 		}
 	}
+	//搜索内容有效
+	it := sess.DB("qfw").C("jy_search_log").Find(g.Map{"createtime": g.Map{"$gte": start.Unix(), "$lt": end.Unix()}}).Select(g.Map{"s_userid": 1, "search_word": 1}).Iter()
+	for m := make(map[string]interface{}); it.Next(&m); {
+		var (
+			userId      = gconv.String(m["s_userid"])
+			search_word = gconv.String(m["search_word"])
+		)
+		if search_word == "" {
+			continue
+		}
+		if baseUserId, ok := o.UserMap[userId]; ok {
+			if _, ok := o.result["search_effective"][baseUserId]; ok {
+				o.result["search_effective"][baseUserId]++
+			} else {
+				o.result["search_effective"][baseUserId] = 1
+			}
+		}
+	}
 	return nil
 }