From b9d8c2a71c4d46b3f1fdc1f9db07e6d08e75b360 Mon Sep 17 00:00:00 2001 From: zhora Date: Tue, 30 Sep 2025 16:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BBwithdraw=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/user.go | 26 +++++++++++++++++++ .../backend/handler/guser/getGameUserInfo.go | 3 +++ modules/backend/values/gameuser.go | 1 + 3 files changed, 30 insertions(+) diff --git a/call/user.go b/call/user.go index 125919b..bbd924b 100644 --- a/call/user.go +++ b/call/user.go @@ -857,6 +857,32 @@ func GetRtpControl(uid int) int { return rtp } +func GetAllWithdrawPer(uids []int) (withdrawPer int) { + deduplicateUids := make([]int, 0, len(uids)) + uidMap := make(map[int]struct{}) + for _, v := range uids { + if _, ok := uidMap[v]; !ok { + uidMap[v] = struct{}{} + deduplicateUids = append(deduplicateUids, v) + } + } + if len(deduplicateUids) == 0 { + return + } + var totalWithdraw, totalWithdrawing, totalRecharge, totalCash int64 + for _, uid := range deduplicateUids { + totalCash += GetUserCurrency(uid, common.CurrencyINR) + rechargeInfo := GetRechargeInfo(uid) + totalWithdraw += rechargeInfo.TotalWithdraw + totalWithdrawing += rechargeInfo.WithdrawingCash + totalRecharge += rechargeInfo.TotalRecharge + } + if totalRecharge > 0 { + withdrawPer = int((totalWithdraw + totalWithdrawing + totalCash) * 100 / totalRecharge) + } + return +} + func GetRtpControlV1(uid int, withdrawPer ...*int) int { rtp := 85 if v := GetConfigPlatform().Rtp; v > 0 { diff --git a/modules/backend/handler/guser/getGameUserInfo.go b/modules/backend/handler/guser/getGameUserInfo.go index c986893..e6044de 100644 --- a/modules/backend/handler/guser/getGameUserInfo.go +++ b/modules/backend/handler/guser/getGameUserInfo.go @@ -81,6 +81,9 @@ func GetGameUserInfo(c *gin.Context) { SameIPUids: call.GetUserByDeviceIp(user.IP, "", user.Id), SameDeviceUids: call.GetUserByDeviceIp("", user.DeviceId, user.Id), } + if len(resp.SameIPUids) > 0 || len(resp.SameDeviceUids) > 0 { + resp.AllWithdrawPer = call.GetAllWithdrawPer(append(append(resp.SameIPUids, resp.SameDeviceUids...), uid)) + } currency := &common.PlayerCurrency{UID: uid} db.Mysql().Get(currency) diff --git a/modules/backend/values/gameuser.go b/modules/backend/values/gameuser.go index e639111..45c5e4c 100644 --- a/modules/backend/values/gameuser.go +++ b/modules/backend/values/gameuser.go @@ -141,6 +141,7 @@ type GetGameUserInfoResp struct { SubAccount []int Rtp int WithdrawPer int + AllWithdrawPer int } type GetGameUserInfoV1Resp struct {