Update:增加月份筛选

This commit is contained in:
jiaji.H 2026-06-11 11:01:11 +08:00
parent 8efae21524
commit 8e52bba692

View File

@ -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