From 4d9a92eec26c1eb3b793d6b6c1efce8fb75c74d8 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Wed, 14 Jun 2023 15:22:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E6=B2=A1=E8=B6=85=E8=BF=87=E4=B8=80?= =?UTF-8?q?=E5=A4=A9,=E4=B8=8D=E7=94=A8=E8=AE=A1=E7=AE=97=E6=98=8E?= =?UTF-8?q?=E5=B9=B4=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/cp_r/anniversary.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/route/cp_r/anniversary.go b/route/cp_r/anniversary.go index 990a100..429dbb1 100644 --- a/route/cp_r/anniversary.go +++ b/route/cp_r/anniversary.go @@ -148,6 +148,10 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) { // 计算下一个纪念日 func calcNextAnniversary(timestamp int64) int64 { now := time.Now() + // 还没超过一天,不用计算明年的 + if now.Unix()-timestamp < 86400 { + return timestamp + } birthday := time.Unix(timestamp, 0) // 计算今年的生日日期 thisYearBirthday := time.Date(now.Year(), birthday.Month(), birthday.Day(), birthday.Hour(), birthday.Minute(), birthday.Second(), 0, time.Local) -- 2.22.0