|
@@ -39,12 +39,15 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
"2006-01-02", // 对应 "2024-01-01"
|
|
|
}
|
|
|
|
|
|
+ var layoutsType int
|
|
|
+
|
|
|
var startTime time.Time
|
|
|
- for _, layout := range layouts {
|
|
|
+ for i, layout := range layouts {
|
|
|
startTime, err = time.Parse(layout, *req.StartDate)
|
|
|
if err == nil {
|
|
|
break
|
|
|
}
|
|
|
+ layoutsType = i
|
|
|
}
|
|
|
if err != nil {
|
|
|
fmt.Println("解析开始时间失败:", err)
|
|
@@ -63,5 +66,19 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 判断截止日期是否包含当前日
|
|
|
+ var isCurrentDay bool
|
|
|
+ now := time.Now()
|
|
|
+
|
|
|
+ if layoutsType == 0 {
|
|
|
+ isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month()
|
|
|
+ } else {
|
|
|
+ isCurrentDay = endTime.Year() == now.Year() && endTime.Month() == now.Month() && endTime.Day() == now.Day()
|
|
|
+ }
|
|
|
+
|
|
|
+ if isCurrentDay && layoutsType == 1 && req.StartDate == req.EndDate {
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|