瀏覽代碼

修复bug

boweniac 3 月之前
父節點
當前提交
3c3a56d2c9
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      internal/logic/dashboard/get_charts_logic.go

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

@@ -44,14 +44,13 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 	// 获取组织id
 	var organizationId uint64 = 0
 	isAdmin := l.ctx.Value("isAdmin").(bool)
-	if isAdmin && req.OrganizationId != nil && *req.OrganizationId != 0 {
+	if isAdmin {
 		if req.OrganizationId != nil && *req.OrganizationId != 0 {
 			organizationId = *req.OrganizationId
 		}
 	} else {
 		organizationId = l.ctx.Value("organizationId").(uint64)
 	}
-
 	// 解析起始和截止时间
 	layouts := []string{
 		"2006-01",    // 对应 "2024-01"
@@ -113,7 +112,7 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 			fmt.Println("转换开始时间失败:", err)
 			return nil, err
 		}
-		
+
 		nextDayMidnight := time.Date(startTime.Year(), startTime.Month(), startTime.Day()+1, 0, 0, 0, 0, startTime.Location())
 		nextDayMidnightString := nextDayMidnight.Format("2006010200")
 		nextDayAddTime, err := strconv.ParseUint(nextDayMidnightString, 10, 64)
@@ -133,7 +132,6 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 		}
 		for _, hourData := range usageStatisticHour {
 			addtimeLastTwoDigits := hourData.Addtime % 100
-
 			aiResponse.Count += hourData.AiResponse
 			aiResponse.Val = append(aiResponse.Val, hourData.AiResponse)
 			aiResponse.Label = append(aiResponse.Label, fmt.Sprintf("%02d点", addtimeLastTwoDigits))