From 8b6b184863a2f780e4e6d1171caf78c6f0549a20 Mon Sep 17 00:00:00 2001 From: lzh <1625167628@qq.com> Date: Thu, 16 Oct 2025 09:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BF=80=E6=B4=BB=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index e31b721..19c20f1 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -480,9 +480,6 @@ func BundleActivate(ids []uint32) error { app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error { activate := model.BundleActivate{} if err := tx.Model(&model.BundleActivate{}).Where("user_id = ?", v).First(&activate).Error; err != nil { - return tx.Model(&model.BundleActivate{}).Where("user_id = ?", v).Create(&model.BundleActivate{UserId: int(v), Activate: 2}).Error - } - if activate.Activate != 2 { // 第一次激活重新计算余量的开始时间和过期时间 balance := model.BundleBalance{} if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", v).First(&balance).Error; err != nil { return err @@ -492,8 +489,7 @@ func BundleActivate(ids []uint32) error { if err := tx.Model(&model.BundleBalance{}).Save(balance).Error; err != nil { return err } - activate.Activate = 2 - return tx.Model(&model.BundleActivate{}).Save(activate).Error + return tx.Model(&model.BundleActivate{}).Where("user_id = ?", v).Create(&model.BundleActivate{UserId: int(v), Activate: 2}).Error } return nil })