diff --git a/app/admin/models/purchase.go b/app/admin/models/purchase.go index ec2deaf..89487f6 100644 --- a/app/admin/models/purchase.go +++ b/app/admin/models/purchase.go @@ -2809,7 +2809,12 @@ func GetLastWeekRange() (time.Time, time.Time) { return time.Date(year, month, day, 0, 0, 0, 0, t.Location()) } - return startOfDay(lastWeekStart), startOfDay(lastWeekEnd) + endOfDay := func(t time.Time) time.Time { + year, month, day := t.Date() + return time.Date(year, month, day, 23, 59, 59, 0, t.Location()) + } + + return startOfDay(lastWeekStart), endOfDay(lastWeekEnd) } // GetLastMonthRange 获取上个月的时间范围 @@ -2818,6 +2823,8 @@ func GetLastMonthRange() (time.Time, time.Time) { year, month, _ := now.Date() firstDay := time.Date(year, month-1, 1, 0, 0, 0, 0, now.Location()) lastDay := firstDay.AddDate(0, 1, -1) + lastDay = time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 23, 59, 59, 0, now.Location()) + return firstDay, lastDay }