Browse Source

修复统计问题

boweniac 3 months ago
parent
commit
d8462fb103
1 changed files with 6 additions and 2 deletions
  1. 6 2
      crontask/compute_statistic.go

+ 6 - 2
crontask/compute_statistic.go

@@ -144,7 +144,7 @@ func (l *CronTask) computeStatistic() {
 				newUserInt = int(lastHourData.TotalFriend) - friendCountInt
 			}
 			orgNewUserInt += newUserInt
-
+			var lc []custom_types.LabelDist
 			_, err := l.svcCtx.DB.UsageStatisticHour.Create().
 				SetType(1).
 				SetBotID(wxinfo.Wxid).
@@ -158,6 +158,7 @@ func (l *CronTask) computeStatistic() {
 				SetActiveUser(uint64(activeUserInt)).
 				SetNewUser(int64(newUserInt)).
 				SetAddtime(uint64(currentHourInt)).
+				SetLabelDist(lc).
 				Save(l.ctx)
 			l.Errorf("save hour data error:%v \n", err)
 		}
@@ -255,6 +256,7 @@ func (l *CronTask) computeStatistic() {
 			orgActiveUserInt += activeUser
 			orgNewUserInt += newUser
 
+			var lc []custom_types.LabelDist
 			_, err := l.svcCtx.DB.UsageStatisticDay.Create().
 				SetAddtime(uint64(day)).
 				SetType(1).
@@ -268,6 +270,7 @@ func (l *CronTask) computeStatistic() {
 				SetConsumeToken(consumeToken).
 				SetActiveUser(activeUser).
 				SetNewUser(newUser).
+				SetLabelDist(lc).
 				Save(l.ctx)
 			if err != nil {
 				l.Errorf("create day data error:%v \n", err)
@@ -369,7 +372,7 @@ func (l *CronTask) computeStatistic() {
 			orgConsumeTokenInt += consumeToken
 			orgActiveUserInt += activeUser
 			orgNewUserInt += newUser
-
+			var lc []custom_types.LabelDist
 			_, err := l.svcCtx.DB.UsageStatisticMonth.Create().
 				SetAddtime(uint64(month)).
 				SetType(1).
@@ -383,6 +386,7 @@ func (l *CronTask) computeStatistic() {
 				SetConsumeToken(consumeToken).
 				SetActiveUser(activeUser).
 				SetNewUser(newUser).
+				SetLabelDist(lc).
 				Save(l.ctx)
 			if err != nil {
 				l.Errorf("create month data error:%v \n", err)