From 7e1dc4646b6351f5897d2934c2c83420579b196b Mon Sep 17 00:00:00 2001 From: chenlin Date: Tue, 24 Dec 2024 10:57:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96=E4=B8=8A?= =?UTF-8?q?=E6=9C=88=E6=97=B6=E9=97=B4=EF=BC=8C=E4=B8=8A=E5=91=A8=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E6=88=AA=E6=AD=A2=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E4=BB=8E"00:00:00"=E6=94=B9=E4=B8=BA"23:59:59"=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/purchase.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 }