From 8e52bba692cad0bc977c27eeb118cd928c379980 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 11 Jun 2026 11:01:11 +0800 Subject: [PATCH] =?UTF-8?q?Update:=E5=A2=9E=E5=8A=A0=E6=9C=88=E4=BB=BD?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index 819c2cb..2a2be87 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -232,6 +232,12 @@ func GetPayLaterBundleBalanceList(req *bundle.GetPayLaterBundleBalanceListReq) ( if req.StartTimeEnd != 0 { session = session.Where("bor.created_at <= ?", time.UnixMilli(req.StartTimeEnd)) } + if len(req.Month) == 0 { + newestMonthQuery := app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).Select("max(month) as month,user_id").Group("user_id") + session.Joins("LEFT JOIN (?) as newest_month on newest_month.user_id = bb.user_id", newestMonthQuery).Where("") + } else { + session = session.Where("bb.month in (?)", req.Month) + } err = session.Count(&total).Error if err != nil { return