feat: 完善小组绩效与有效端统计并修复审查问题
This commit is contained in:
@@ -3,6 +3,7 @@ package business
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"gorm.io/gorm"
|
||||
@@ -218,6 +219,22 @@ func (r *analyticsRepo) Aggregate(ctx context.Context, kind business.AnalyticsKi
|
||||
if len(rowMap) == 0 {
|
||||
return result, nil
|
||||
}
|
||||
if kind == business.ChannelAnalytics {
|
||||
location := time.FixedZone("Asia/Shanghai", 8*3600)
|
||||
begin, _ := time.ParseInLocation("2006-01-02", f.Begin, location)
|
||||
end, _ := time.ParseInLocation("2006-01-02", f.End, location)
|
||||
keys := []business.AnalyticsKey{}
|
||||
for key := range rowMap {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
for start := 0; start < len(keys); start += 300 {
|
||||
var count int64
|
||||
if err := db.Table("sys_business_channel_effectiveness e").Joins("JOIN sys_business_effectiveness_state s ON s.id=1 AND s.rule_key=e.rule_key").Where("(e.source_db,e.promote_id) IN ? AND e.qualified_at>=? AND e.qualified_at<?", analyticsPairs(keys[start:min(start+300, len(keys))]), begin.Unix(), end.AddDate(0, 0, 1).Unix()).Count(&count).Error; err != nil {
|
||||
return nil, business.ErrStorage
|
||||
}
|
||||
result.EffectiveCount += count
|
||||
}
|
||||
}
|
||||
if kind == business.GameAnalytics {
|
||||
available, err := businessTableAvailable(db, "tab_game")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user