|
@@ -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() {
|