From 2c20f1fa3155b44a8c913fd835f9e5540e5c14e7 Mon Sep 17 00:00:00 2001 From: zhora Date: Tue, 14 Oct 2025 18:22:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=AF=E4=BB=98=E6=9D=83?= =?UTF-8?q?=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 19 ++++++++++--------- modules/pay/values/values.go | 5 ++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index 96e245b..33577a8 100644 --- a/config/config.go +++ b/config/config.go @@ -29,15 +29,16 @@ type Configure struct { } } Pay struct { - CertFile string - KeyFile string - CallbackURL string - Addr string - CheckLimit int // 触发充值权重检测的阀值 - RootChannel []int - PaySuccessWeight int // 成功改变的权重值 - PayFailWeight int // 失败改变的权重值 - BaseSuccess int // 基准成功率 + CertFile string + KeyFile string + CallbackURL string + Addr string + CheckLimit int // 触发充值权重检测的阀值 + RootChannel []int + PaySuccessWeightOdds int // 顶替成功后的权重值倍数 + PaySuccessWeight int // 成功改变的权重值 + PayFailWeight int // 失败改变的权重值 + BaseSuccess int // 基准成功率 // Release bool TLS bool SelectPayWay bool diff --git a/modules/pay/values/values.go b/modules/pay/values/values.go index 0d1ebfe..5534368 100644 --- a/modules/pay/values/values.go +++ b/modules/pay/values/values.go @@ -294,6 +294,9 @@ func PayFail(w PayWay) { for _, v := range call.ConfigPayChannels { if v.ChannelID == int(w) { v.PayPer -= failWeight + if v.PayPer <= 0 { + v.PayPer = 1 + } break } } @@ -310,7 +313,7 @@ func PaySuccess(w PayWay, isReplace int) { return } if isReplace == 1 { - successWeight *= 2 + successWeight *= config.GetConfig().Pay.PaySuccessWeightOdds } PayWeightLock.Lock() for _, v := range call.ConfigPayChannels {