From 75a75e948095ff6e400f15f92b100f6b9fddf162 Mon Sep 17 00:00:00 2001 From: lzh <1625167628@qq.com> Date: Fri, 20 Jun 2025 16:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E5=8C=BA=E9=94=99=E8=AF=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 3 ++- internal/logic/bundleExtendLogic.go | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index 20a441d..2443bae 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -27,7 +27,8 @@ func AddBundleExtendRecord(data model.BundleExtensionRecords) error { } var expireTime time.Time if record.ExpirationTime != "" { - et, _ := time.Parse(time.DateTime, record.ExpirationTime) + loc, _ := time.LoadLocation("Asia/Shanghai") + et, _ := time.ParseInLocation(time.DateTime, record.ExpirationTime, loc) expireTime = et } else { expireTime = time.Now() diff --git a/internal/logic/bundleExtendLogic.go b/internal/logic/bundleExtendLogic.go index 5f59245..0927e0a 100644 --- a/internal/logic/bundleExtendLogic.go +++ b/internal/logic/bundleExtendLogic.go @@ -63,7 +63,8 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl resp.Data = lo.Map(data, func(m model.BundleBalancePo, _ int) *bundle.BundleBalanceItem { result := &bundle.BundleBalanceItem{} copier.Copy(result, &m) - t, _ := time.Parse(time.DateTime, m.ExpirationTime) + loc, _ := time.LoadLocation("Asia/Shanghai") + t, _ := time.ParseInLocation(time.DateTime, m.ExpirationTime, loc) result.ExpiredTime = t.UnixMilli() return result }) @@ -78,9 +79,10 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle. } result := &bundle.GetBundleBalanceByUserIdResp{} copier.Copy(result, &data) - t, _ := time.Parse(time.DateTime, data.ExpiredTime) + loc, _ := time.LoadLocation("Asia/Shanghai") + t, _ := time.ParseInLocation(time.DateTime, data.ExpiredTime, loc) result.ExpiredTime = t.UnixMilli() - t, _ = time.Parse(time.DateTime, data.PayTime) + t, _ = time.ParseInLocation(time.DateTime, data.PayTime, loc) result.PayTime = t.UnixMilli() return result, nil }