|
@@ -27,6 +27,11 @@ func (ua *UserAnalysis) GetAnalysisLogRes(ctx context.Context, runTime time.Time
|
|
|
returnData = append(returnData, &AnalysisRes{Name: fmt.Sprintf("%d天活跃用户", day), Code: fmt.Sprintf("active_%d", day), Data: res})
|
|
|
}
|
|
|
}
|
|
|
+ //*特殊1-90天活跃
|
|
|
+ if activeRes, err := ua.ActiveUserLoad(ctx, runTime.AddDate(0, 0, -90), "", runTime.AddDate(0, 0, -1)); err != nil || len(activeRes) > 0 {
|
|
|
+ returnData = append(returnData, &AnalysisRes{Name: fmt.Sprintf("除了昨天90天活跃用户"), Code: fmt.Sprintf("active_1_90"), Data: activeRes})
|
|
|
+ }
|
|
|
+
|
|
|
//标讯详情页访问
|
|
|
if res, err := ua.ArticleVisit(ctx, runTime.AddDate(0, 0, -7)); err == nil && len(res) > 0 {
|
|
|
returnData = append(returnData, res...)
|
|
@@ -53,11 +58,15 @@ func (ua *UserAnalysis) GetAnalysisLogRes(ctx context.Context, runTime time.Time
|
|
|
}
|
|
|
|
|
|
// ActiveUserLoad 活跃用户
|
|
|
-func (ua *UserAnalysis) ActiveUserLoad(ctx context.Context, start time.Time, source string) (map[BaseUserId]bool, error) {
|
|
|
+func (ua *UserAnalysis) ActiveUserLoad(ctx context.Context, start time.Time, source string, entTime ...time.Time) (map[BaseUserId]bool, error) {
|
|
|
var (
|
|
|
execSql = "SELECT DISTINCT(baseUserId) as baseUserId FROM user_log_byHour WHERE create_time > ? "
|
|
|
values = []interface{}{start.Format(time.DateTime)}
|
|
|
)
|
|
|
+ if len(entTime) > 0 {
|
|
|
+ execSql += " AND create_time < ?"
|
|
|
+ values = append(values, entTime[0].Format(time.DateTime))
|
|
|
+ }
|
|
|
|
|
|
if source == "wx" || source == "pc" || source == "app" {
|
|
|
execSql += " AND s_source =? "
|