From cb659df6f334aa3891e9474648098f24e54d2a89 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Thu, 12 Sep 2024 18:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0RTP=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/handler/guser/editGameUserGold.go | 19 +++++++++++++------ .../backend/handler/guser/getGameUserInfo.go | 8 +------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/backend/handler/guser/editGameUserGold.go b/modules/backend/handler/guser/editGameUserGold.go index 20cb6f3..f193ef2 100644 --- a/modules/backend/handler/guser/editGameUserGold.go +++ b/modules/backend/handler/guser/editGameUserGold.go @@ -51,12 +51,19 @@ func EditGameUserRtp(c *gin.Context) { if !a.S(req) { return } - err := db.Mysql().Update(&common.PlayerRtpData{Uid: req.UID}, map[string]interface{}{ - "rtp": req.Val, - }) - if err != nil { - a.Code = values.CodeRetry - a.Msg = "modify rtp error" + rtpData := &common.PlayerRtpData{Uid: req.UID} + db.Mysql().Get(rtpData) + if rtpData.Id == 0 { + rtpData.Rtp = req.Val + db.Mysql().Create(rtpData) + } else { + err := db.Mysql().Update(&common.PlayerRtpData{Uid: req.UID}, map[string]interface{}{ + "rtp": req.Val, + }) + if err != nil { + a.Code = values.CodeRetry + a.Msg = "modify rtp error" + } } a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%vRtp:%v", req.UID, req.Val)) diff --git a/modules/backend/handler/guser/getGameUserInfo.go b/modules/backend/handler/guser/getGameUserInfo.go index 06bf0a5..dd928d8 100644 --- a/modules/backend/handler/guser/getGameUserInfo.go +++ b/modules/backend/handler/guser/getGameUserInfo.go @@ -93,13 +93,7 @@ func GetGameUserInfo(c *gin.Context) { // usdtInfo := call.GetPlayerRechargeInfoByCurrency(uid, common.CurrencyUSDT) resp.RechargeBrl = brlInfo.TotalRecharge resp.WithdrawBrl = brlInfo.TotalWithdraw - rtp := call.GetUserRtp(uid) - if rtp.Id == 0 { - db.Mysql().Create(rtp) - rtp.Rtp, _ = db.Redis().GetInt(common.GetRedisKeyPlayerRtp(uid)) - } else { - resp.Rtp = rtp.Rtp - } + resp.Rtp, _ = db.Redis().GetInt(common.GetRedisKeyPlayerRtp(uid)) // resp.RechargeUsdt = usdtInfo.TotalRecharge // resp.WithdrawUsdt = usdtInfo.TotoalWithdraw