From 8929a17c974f33ff7b02f751f23288afb8087952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Thu, 19 Mar 2026 19:01:23 +0800 Subject: [PATCH] =?UTF-8?q?```=20fix(player):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=87=91=E5=B8=81=E5=85=91=E6=8D=A2=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除未使用的getgold变量计算,修正兑换金币数量计算公式, 避免因变量未定义导致的潜在运行时错误,确保兑换功能正常工作。 ``` --- modules/player/controller/admin/gold_list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/player/controller/admin/gold_list.go b/modules/player/controller/admin/gold_list.go index 5671c6ba..709d2546 100644 --- a/modules/player/controller/admin/gold_list.go +++ b/modules/player/controller/admin/gold_list.go @@ -44,7 +44,7 @@ func (c *GoldListController) DuihuanGold(ctx context.Context, req *DuihuanGoldAd } costfree := r.Rate * float64(r.ExchangeNum) - getgold := 1 / r.Rate * float64(r.ExchangeNum) + if base.NewBaseSysUserService().GetFreeGold(t.UserId) < int64(costfree*100) { err = fmt.Errorf("余额不足") return @@ -54,7 +54,7 @@ func (c *GoldListController) DuihuanGold(ctx context.Context, req *DuihuanGoldAd return } base.NewBaseSysUserService().DuihuanFreeGold(uint32(r.PlayerID), int64(r.ExchangeNum*100), int64(costfree*95)) - base.NewBaseSysUserService().DuihuanGold(uint32(t.UserId), int64(getgold*95), int64(costfree*100)) + base.NewBaseSysUserService().DuihuanGold(uint32(t.UserId), int64(r.ExchangeNum*95), int64(costfree*100)) res = cool.Ok(nil) return }