调控增加个人rtp判断

dev_aagame_provider
zhora 1 month ago
parent 1204e26e61
commit 90b03ff2bd
  1. 146
      call/config.go
  2. 2
      call/pay.go
  3. 46
      call/user.go
  4. 2
      modules/web/providers/pg3/base.go

@ -2585,79 +2585,79 @@ func LoadConfigRtpControl() (err error) {
log.Error("err:%v", err) log.Error("err:%v", err)
return err return err
} }
//sort.Slice(result, func(i, j int) bool { sort.Slice(result, func(i, j int) bool {
// a, b := result[i], result[j] a, b := result[i], result[j]
//
// // 处理RechargeDay:-1排到最后 // 处理RechargeDay:-1排到最后
// if a.RechargeDay == -1 && b.RechargeDay != -1 { if a.RechargeDay == -1 && b.RechargeDay != -1 {
// return false // a排在b后面 return false // a排在b后面
// } }
// if a.RechargeDay != -1 && b.RechargeDay == -1 { if a.RechargeDay != -1 && b.RechargeDay == -1 {
// return true // a排在b前面 return true // a排在b前面
// } }
// if a.RechargeDay == -1 && b.RechargeDay == -1 { if a.RechargeDay == -1 && b.RechargeDay == -1 {
// // 都是-1,继续比较下一个字段 // 都是-1,继续比较下一个字段
// if a.WithdrawPer == -1 && b.WithdrawPer != -1 { if a.WithdrawPer == -1 && b.WithdrawPer != -1 {
// return false return false
// } }
// if a.WithdrawPer != -1 && b.WithdrawPer == -1 { if a.WithdrawPer != -1 && b.WithdrawPer == -1 {
// return true return true
// } }
// if a.WithdrawPer == -1 && b.WithdrawPer == -1 { if a.WithdrawPer == -1 && b.WithdrawPer == -1 {
// if a.PersonalRtp == -1 && b.PersonalRtp != -1 { if a.PersonalRtp == -1 && b.PersonalRtp != -1 {
// return false return false
// } }
// if a.PersonalRtp != -1 && b.PersonalRtp == -1 { if a.PersonalRtp != -1 && b.PersonalRtp == -1 {
// return true return true
// } }
// return a.PersonalRtp < b.PersonalRtp return a.PersonalRtp < b.PersonalRtp
// } else { } else {
// if a.WithdrawPer != b.WithdrawPer { if a.WithdrawPer != b.WithdrawPer {
// return a.WithdrawPer < b.WithdrawPer return a.WithdrawPer < b.WithdrawPer
// } }
// } }
// } else { } else {
// if a.RechargeDay != b.RechargeDay { if a.RechargeDay != b.RechargeDay {
// return a.RechargeDay < b.RechargeDay return a.RechargeDay < b.RechargeDay
// } }
// } }
//
// // 处理WithdrawPer:-1排到最后 // 处理WithdrawPer:-1排到最后
// if a.WithdrawPer == -1 && b.WithdrawPer != -1 { if a.WithdrawPer == -1 && b.WithdrawPer != -1 {
// return false return false
// } }
// if a.WithdrawPer != -1 && b.WithdrawPer == -1 { if a.WithdrawPer != -1 && b.WithdrawPer == -1 {
// return true return true
// } }
// if a.WithdrawPer == -1 && b.WithdrawPer == -1 { if a.WithdrawPer == -1 && b.WithdrawPer == -1 {
// // 都是-1,继续比较下一个字段 // 都是-1,继续比较下一个字段
// if a.PersonalRtp == -1 && b.PersonalRtp != -1 { if a.PersonalRtp == -1 && b.PersonalRtp != -1 {
// return false return false
// } }
// if a.PersonalRtp != -1 && b.PersonalRtp == -1 { if a.PersonalRtp != -1 && b.PersonalRtp == -1 {
// return true return true
// } }
// return a.PersonalRtp < b.PersonalRtp return a.PersonalRtp < b.PersonalRtp
// } else { } else {
// if a.WithdrawPer != b.WithdrawPer { if a.WithdrawPer != b.WithdrawPer {
// return a.WithdrawPer < b.WithdrawPer return a.WithdrawPer < b.WithdrawPer
// } }
// } }
//
// // 处理PersonalRtp:-1排到最后 // 处理PersonalRtp:-1排到最后
// if a.PersonalRtp == -1 && b.PersonalRtp != -1 { if a.PersonalRtp == -1 && b.PersonalRtp != -1 {
// return false return false
// } }
// if a.PersonalRtp != -1 && b.PersonalRtp == -1 { if a.PersonalRtp != -1 && b.PersonalRtp == -1 {
// return true return true
// } }
// if a.PersonalRtp == -1 && b.PersonalRtp == -1 { if a.PersonalRtp == -1 && b.PersonalRtp == -1 {
// // 都是-1,相等 // 都是-1,相等
// return false return false
// } else { } else {
// return a.PersonalRtp < b.PersonalRtp return a.PersonalRtp < b.PersonalRtp
// } }
//}) })
configRtpControl = result configRtpControl = result
return nil return nil
} }

@ -171,7 +171,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
if re.LastRechargeAmount > 0 { if re.LastRechargeAmount > 0 {
eliminateBetCfg := GetConfigEliminateBet() eliminateBetCfg := GetConfigEliminateBet()
if eliminateBetCfg.ID != 0 { if eliminateBetCfg.ID != 0 {
playerProfile := GetPlayerProfileByCurrency(uid, common.CurrencyINR) playerProfile := GetPlayerProfile(uid)
if playerProfile.NeedBet > 0 { if playerProfile.NeedBet > 0 {
cash := GetUserCurrency(uid, common.CurrencyINR) cash := GetUserCurrency(uid, common.CurrencyINR)
log.Debug("eliminateBet check, uid:%d cash:%d value:%d lastRecharge:%d bankruptcyCoefficient:%d", log.Debug("eliminateBet check, uid:%d cash:%d value:%d lastRecharge:%d bankruptcyCoefficient:%d",

@ -548,7 +548,7 @@ func UpdatePlayerRechargeInfoCurrency(uid int, t common.CurrencyType, u map[stri
return db.Mysql().C().Table(tableName).Where("uid = ?", uid).Updates(u).Error return db.Mysql().C().Table(tableName).Where("uid = ?", uid).Updates(u).Error
} }
func GetPlayerProfileByCurrency(uid int, t common.CurrencyType) *common.PlayerProfile { func GetPlayerProfile(uid int) *common.PlayerProfile {
pp := &common.PlayerProfile{} pp := &common.PlayerProfile{}
db.Mysql().C().Model(&common.PlayerProfile{}).Where("uid = ?", uid).Find(pp) db.Mysql().C().Model(&common.PlayerProfile{}).Where("uid = ?", uid).Find(pp)
return pp return pp
@ -832,10 +832,14 @@ func GetRtpControlV1(uid int, withdrawPer ...*int) int {
} }
rechargeInfo := GetRechargeInfo(uid) rechargeInfo := GetRechargeInfo(uid)
cash := GetUserCurrency(uid, common.CurrencyINR) // 当前现金 cash := GetUserCurrency(uid, common.CurrencyINR) // 当前现金
var withdrawRechargePer int64 var withdrawRechargePer, personalRtp int64
if rechargeInfo.TotalRecharge > 0 { if rechargeInfo.TotalRecharge > 0 {
withdrawRechargePer = (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash + cash) * 100 / rechargeInfo.TotalRecharge withdrawRechargePer = (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash + cash) * 100 / rechargeInfo.TotalRecharge
} }
playerProfile := GetPlayerProfile(uid)
if playerProfile != nil {
personalRtp = playerProfile.TotalSettle * 100 / playerProfile.TotalBet
}
if rechargeInfo.FirstRecharge == 0 { // 找表 if rechargeInfo.FirstRecharge == 0 { // 找表
var tmpRechargeOrder common.RechargeOrder var tmpRechargeOrder common.RechargeOrder
err := db.Mysql().C().Model(&common.RechargeOrder{}).Where("uid = ? and `status` = ?", uid, common.StatusROrderPay). err := db.Mysql().C().Model(&common.RechargeOrder{}).Where("uid = ? and `status` = ?", uid, common.StatusROrderPay).
@ -847,46 +851,26 @@ func GetRtpControlV1(uid int, withdrawPer ...*int) int {
rechargeDay := int(math.Ceil(float64(time.Now().Unix()-rechargeInfo.FirstRecharge) / float64(24*60*60))) rechargeDay := int(math.Ceil(float64(time.Now().Unix()-rechargeInfo.FirstRecharge) / float64(24*60*60)))
rtpControls := GetConfigRtpControl() rtpControls := GetConfigRtpControl()
var rtpControl, defaultRtpControl *common.ConfigRtpControl var rtpControl *common.ConfigRtpControl
for _, v := range rtpControls { for _, v := range rtpControls {
if v.RechargeDay == -1 { if rechargeDay > v.RechargeDay && v.RechargeDay != -1 {
continue continue
} }
if rechargeDay != v.RechargeDay { if int(withdrawRechargePer) > v.WithdrawPer && v.WithdrawPer != -1 {
continue continue
} }
if v.WithdrawPer == -1 { if int(personalRtp) > v.PersonalRtp && v.PersonalRtp != -1 {
defaultRtpControl = v
}
if int(withdrawRechargePer) < v.WithdrawPer {
rtpControl = v
break
}
}
if rtpControl == nil && defaultRtpControl != nil {
rtpControl = defaultRtpControl
}
if rtpControl == nil {
for _, v := range rtpControls {
if v.RechargeDay != -1 {
continue continue
} }
if v.WithdrawPer == -1 {
defaultRtpControl = v
}
if int(withdrawRechargePer) < v.WithdrawPer {
rtpControl = v rtpControl = v
break break
} }
}
if rtpControl == nil && defaultRtpControl != nil {
rtpControl = defaultRtpControl
}
}
if rtpControl != nil { if rtpControl != nil {
log.Debug("rtpControl, uid:%d totalWithdraw:%d withdrawing:%d cash:%d totalRecharge:%d withdrawPer:%d rechargeDay:%d | %+v", log.Debug("rtpControl, uid:%d rechargeDay:%d withdrawPer:%d[(%d+%d+%d)*100/%d] rtp:%d[%d*100/%d] | %+v",
uid, rechargeInfo.TotalWithdraw, rechargeInfo.WithdrawingCash, cash, rechargeInfo.TotalRecharge, withdrawRechargePer, rechargeDay, *rtpControl) uid, rechargeDay,
withdrawRechargePer, rechargeInfo.TotalWithdraw, rechargeInfo.WithdrawingCash, cash, rechargeInfo.TotalRecharge,
personalRtp, playerProfile.TotalSettle, playerProfile.TotalBet,
*rtpControl)
rtp = rtpControl.Rtp rtp = rtpControl.Rtp
} }
if len(withdrawPer) != 0 { if len(withdrawPer) != 0 {

@ -52,7 +52,7 @@ func (s *Sub) EnterGame() string {
} }
rechargeInfo := call.GetRechargeInfo(uid) rechargeInfo := call.GetRechargeInfo(uid)
balance := call.GetUserCurrency(uid, common.CurrencyINR) balance := call.GetUserCurrency(uid, common.CurrencyINR)
playerProfile := call.GetPlayerProfileByCurrency(uid, common.CurrencyINR) playerProfile := call.GetPlayerProfile(uid)
// Generate sign // Generate sign
game := call.GetConfigGameListByID(providerID, gameID) game := call.GetConfigGameListByID(providerID, gameID)
if game == nil { if game == nil {

Loading…
Cancel
Save