|
@@ -37,6 +37,10 @@ func (l *CronTask) computeStatistic() {
|
|
|
currentHour := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
|
|
|
currentHourInt, _ := strconv.Atoi(currentHour.Format("2006010215"))
|
|
|
|
|
|
+ // 上一个小时的起始时间
|
|
|
+ lastHour := currentHour.Add(-time.Hour * 1)
|
|
|
+ lastHourInt, _ := strconv.Atoi(lastHour.Format("2006010215"))
|
|
|
+
|
|
|
for _, wxinfo := range wxbots {
|
|
|
l.Logger.Infof("开始计算小时数据:%d\n", currentHourInt)
|
|
|
|
|
@@ -51,10 +55,6 @@ func (l *CronTask) computeStatistic() {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
- // 上一个小时的起始时间
|
|
|
- lastHour := currentHour.Add(-time.Hour * 1)
|
|
|
- lastHourInt, _ := strconv.Atoi(lastHour.Format("2006010215"))
|
|
|
-
|
|
|
// AI回复包括:SOP次数+AI次数
|
|
|
// SOP次数:content 非空,source_type = 3 或 4,sub_source_id = 0
|
|
|
// AI次数:app = 1 或 3
|
|
@@ -155,8 +155,8 @@ func (l *CronTask) computeStatistic() {
|
|
|
firstHourInt, _ := strconv.Atoi(firstHour.Format("20060102"))
|
|
|
|
|
|
// 获取今天的最后一小时
|
|
|
- lastHour := time.Date(now.Year(), now.Month(), now.Day(), 23, 0, 0, 0, now.Location())
|
|
|
- lastHourInt, _ := strconv.Atoi(lastHour.Format("20060102"))
|
|
|
+ lastHour = time.Date(now.Year(), now.Month(), now.Day(), 23, 0, 0, 0, now.Location())
|
|
|
+ lastHourInt, _ = strconv.Atoi(lastHour.Format("20060102"))
|
|
|
|
|
|
for _, wxinfo := range wxbots {
|
|
|
l.Logger.Infof("开始计算日数据:%d\n", day)
|
|
@@ -176,7 +176,7 @@ func (l *CronTask) computeStatistic() {
|
|
|
usagestatistichour.Type(1),
|
|
|
usagestatistichour.BotID(wxinfo.Wxid),
|
|
|
usagestatistichour.AddtimeGTE(uint64(firstHourInt)),
|
|
|
- usagestatistichour.AddtimeLT(uint64(lastHourInt)),
|
|
|
+ usagestatistichour.AddtimeLTE(uint64(lastHourInt)),
|
|
|
).All(l.ctx)
|
|
|
|
|
|
var aiResponse, sopRun, totalFriend, totalGroup, accountBalance, consumeToken, activeUser uint64
|