From edbe9f2c0a898f380e0033f3372bb0ba2d45bad3 Mon Sep 17 00:00:00 2001 From: lzh <1625167628@qq.com> Date: Sun, 15 Jun 2025 11:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E4=BD=99?= =?UTF-8?q?=E9=87=8F=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 12 +++++++----- internal/model/bundle.go | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index ae3b302..80aa2bf 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -123,19 +123,21 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (data model.UserBundleBalancePo, err error) { err = app.ModuleClients.BundleDB.Table("fiee_bundle.bundle_balance AS bb"). - Select("bor.uuid AS order_uuid, bor.bundle_name AS bundle_name, bor.status AS bundle_status, bor.pay_time AS pay_time, bor.expiration_time AS expired_time"). + Select("bb .*,bor.uuid AS order_uuid, bor.bundle_name AS bundle_name, bor.status AS bundle_status, bor.pay_time AS pay_time, bor.expiration_time AS expired_time"). Joins("LEFT JOIN bundle_order_records bor ON bor.customer_id = bb.user_id"). - Joins("LEFT JOIN micro_account.user u ON u.id = bb.user_id"). + Joins("LEFT JOIN `micro-account`.`user` u ON u.id = bb.user_id"). Where("bb.user_id = ?", req.UserId). + Where("bor.expiration_time > ?", time.Now()). First(&data).Error if err != nil { return } var additionalInfo model.UserBundleBalancePo - err = app.ModuleClients.BundleDB.Table("fiee_bundle.bundle_extension_records"). + err = app.ModuleClients.BundleDB.Model(&model.BundleExtensionRecords{}). Select("user_id, SUM(account_additional) as account_additional, SUM(images_additional) as images_additional, SUM(video_additional) as video_additional, SUM(data_additional) as data_additional"). - Where("user_id = ?", 61). - Group("user_id"). + Where("type = 1"). // 手动扩展 + Where("user_id = ?", req.UserId). + Where("created_at > ?", data.PayTime). // 判断扩展是否生效 First(&additionalInfo).Error if err != nil { return diff --git a/internal/model/bundle.go b/internal/model/bundle.go index e41ca99..8e93ab7 100644 --- a/internal/model/bundle.go +++ b/internal/model/bundle.go @@ -159,7 +159,7 @@ type UserBundleBalancePo struct { BundleUuid string `json:"bundleUuid" gorm:"column:bundle_uuid"` BundleName string `json:"bundleName" gorm:"column:bundle_name"` BundleStatus string `json:"bundleStatus" gorm:"column:bundle_status"` - PayTime int64 `json:"payTime" gorm:"column:pay_time"` + PayTime string `json:"payTime" gorm:"column:pay_time"` ExpiredTime string `json:"expiredTime" gorm:"column:expiration_time"` PaymentAmount string `json:"paymentAmount" gorm:"column:payment_amount"` AccountNumber int32 `json:"accountNumber" gorm:"column:account_number"`