Browse Source

Merge branch 'feature/dashboard' into debug

* feature/dashboard:
  优化
  优化
boweniac 3 months ago
parent
commit
7dfe26c996
1 changed files with 4 additions and 5 deletions
  1. 4 5
      internal/logic/dashboard/get_charts_logic.go

+ 4 - 5
internal/logic/dashboard/get_charts_logic.go

@@ -106,8 +106,7 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 	activeUser := types.ChartsUint{}
 	newUser := types.ChartsInt{}
 	var labelDists []custom_types.LabelDist
-
-	if isCurrentDay && layoutsType == 1 && req.StartDate == req.EndDate {
+	if isCurrentDay && layoutsType == 1 && *req.StartDate == *req.EndDate {
 		// 返回当日每小时的数据
 		startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
 		startAddTimeString := startOfDay.Format("2006010200")
@@ -121,7 +120,7 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 		if organizationId != 0 {
 			predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
 		}
-		predicates = append(predicates, usagestatistichour.BotIDIsNil())
+		predicates = append(predicates, usagestatistichour.BotID(""))
 		predicates = append(predicates, usagestatistichour.AddtimeGTE(startAddTime))
 		usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
 		if err != nil {
@@ -188,7 +187,7 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 		if organizationId != 0 {
 			predicatesDay = append(predicatesDay, usagestatisticday.OrganizationID(organizationId))
 		}
-		predicatesDay = append(predicatesDay, usagestatisticday.BotIDIsNil())
+		predicatesDay = append(predicatesDay, usagestatisticday.BotID(""))
 		predicatesDay = append(predicatesDay, usagestatisticday.AddtimeGTE(startAddTime))
 		predicatesDay = append(predicatesDay, usagestatisticday.AddtimeLTE(endAddTime))
 		usageStatisticDay, err := l.svcCtx.DB.UsageStatisticDay.Query().Where(predicatesDay...).All(l.ctx)
@@ -250,7 +249,7 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 			if organizationId != 0 {
 				predicates = append(predicates, usagestatistichour.OrganizationID(organizationId))
 			}
-			predicates = append(predicates, usagestatistichour.BotIDIsNil())
+			predicates = append(predicates, usagestatistichour.BotID(""))
 			predicates = append(predicates, usagestatistichour.AddtimeGTE(startOfDayAddTime))
 			usageStatisticHour, err := l.svcCtx.DB.UsageStatisticHour.Query().Where(predicates...).All(l.ctx)
 			if err != nil {