Sfoglia il codice sorgente

fix:新增useranaly配置 查询逻辑修改

duxin 1 anno fa
parent
commit
deb40bf3c6
1 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 2 3
      doFreeClueSign/public/getNewActiveUser.go

+ 2 - 3
doFreeClueSign/public/getNewActiveUser.go

@@ -17,16 +17,15 @@ type NewActiveMsg struct {
 func GetNewActiveUser(st, ed time.Time) []*NewActiveMsg {
 	var (
 		mgoIds []string
-		ctx    context.Context
+		ctx    = context.Background()
 	)
 	stYear, stMonth, stDay := st.Date()
 	_, edMonth, edDay := ed.Date()
 	nst := st.AddDate(0, -1, 0)
 	_, nstMonth, nstDay := nst.Date()
-
 	//昨天所有活跃用户
 	res, err := g.DB("useranaly").Query(ctx, fmt.Sprintf(`SELECT DISTINCT user_mongoid FROM user_countbyhour
-WHERE CONCAT(month, '-', day) >= '%s' AND  CONCAT(month, '-', day) <= '%s';`, fmt.Sprintf("%d-%d", int(stMonth), stDay), fmt.Sprintf("%d-%d", int(edMonth), edDay)))
+WHERE CONCAT(month, '-', day) >= '%s' AND  CONCAT(month, '-', day) <= '%s'`, fmt.Sprintf("%d-%d", int(stMonth), stDay), fmt.Sprintf("%d-%d", int(edMonth), edDay)))
 	//res, err := g.DB().Query(ctx, fmt.Sprintf(`SELECT DISTINCT user_mongoid FROM user_countbyhour WHERE %s `, sql))
 	if err == nil && !res.IsEmpty() {
 		for _, m := range res.List() {