|
|
|
@ -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 |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if v.WithdrawPer == -1 { |
|
|
|
|
|
|
|
defaultRtpControl = v |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if int(withdrawRechargePer) < v.WithdrawPer { |
|
|
|
|
|
|
|
rtpControl = v |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if rtpControl == nil && defaultRtpControl != nil { |
|
|
|
|
|
|
|
rtpControl = defaultRtpControl |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
rtpControl = v |
|
|
|
|
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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 { |
|
|
|
|