dev_aagame_provider
zhora 2 months ago
parent 6b75067d26
commit 86424f0f4c
  1. 17
      call/config.go
  2. 1
      call/pay.go
  3. 11
      call/provider.go
  4. 9
      call/reload.go
  5. 48
      call/user.go
  6. 4
      common/config.go
  7. 12
      common/player.go
  8. 1
      common/recharge.go
  9. 2
      modules/backend/handler/guser/getGameUserInfo.go
  10. 1
      modules/backend/migrate.go
  11. 2
      modules/backend/values/gm.go
  12. 10
      modules/web/providers/jin2/handler.go
  13. 2
      modules/web/providers/sn/handler.go

@ -98,6 +98,8 @@ var (
configShareMap map[int]*common.ConfigShare
configWeekCard *common.ConfigWeekCard
configRtpControl []*common.ConfigRtpControl
)
var (
@ -2573,3 +2575,18 @@ func GetConfigShareRankAwardMap(shareRankType ...int) (result map[int]common.Ran
}
return configShareRankAwardMap[2]
}
func LoadConfigRtpControl() (err error) {
var result []*common.ConfigRtpControl
err = db.Mysql().C().Model(&common.ConfigRtpControl{}).Order("recharge_day,withdraw_per").Find(&result).Error
if err != nil {
log.Error("err:%v", err)
return err
}
configRtpControl = result
return nil
}
func GetConfigRtpControl() []*common.ConfigRtpControl {
return configRtpControl
}

@ -181,6 +181,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
"total_recharge_count": gorm.Expr("total_recharge_count + 1"),
"total_recharge": gorm.Expr("total_recharge + ?", amount),
"last_recharge": now,
"first_recharge": gorm.Expr("CASE WHEN first_recharge = 0 THEN ? ELSE first_recharge END", now),
}
if r.Times > 0 {
updates["buy_amount_data"] = amountCountData

@ -86,17 +86,6 @@ func GetConfigProviderGameListByID(provider, gameID int) *common.ConfigProviderG
return nil
}
func GetProviderGameRtp(uid int) int {
rtp := 85
if v := GetConfigPlatform().Rtp; v > 0 {
rtp = v
}
if v := GetUserRtp(uid); v != nil && v.Rtp > 0 {
rtp = v.Rtp
}
return rtp
}
func GetProviderUserName(name string) string {
return "c" + name
}

@ -632,4 +632,13 @@ func CommonReload(c map[int][]func(*pb.ReloadGameConfig) error) {
return nil
}}
}
if _, ok := c[common.ReloadConfigRtpControl]; !ok {
c[common.ReloadConfigRtpControl] = []func(*pb.ReloadGameConfig) error{func(rgc *pb.ReloadGameConfig) error {
if err := LoadConfigRtpControl(); err != nil {
log.Error("error : [%s]", err.Error())
return err
}
return nil
}}
}
}

@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"math"
"math/rand"
"reflect"
"regexp"
@ -824,3 +825,50 @@ func GetRtpControl(uid int) int {
}
return rtp
}
func GetRtpControlV1(uid int) int {
rtp := 85
if v := GetConfigPlatform().Rtp; v > 0 {
rtp = v
}
rechargeInfo := GetRechargeInfo(uid)
cash := GetUserCurrency(uid, common.CurrencyINR) // 当前现金
var withdrawRechargePer int64
if rechargeInfo.TotalRecharge > 0 {
withdrawRechargePer = (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash + cash) * 100 / rechargeInfo.TotalRecharge
}
if rechargeInfo.FirstRecharge == 0 { // 找表
var tmpRechargeOrder common.RechargeOrder
err := db.Mysql().C().Model(&common.RechargeOrder{}).Where("uid = ? and `status` = ?", uid, common.StatusROrderPay).
Order("id").Limit(1).Find(&tmpRechargeOrder).Error
if err == nil {
rechargeInfo.FirstRecharge = tmpRechargeOrder.CreateTime
}
}
rechargeDay := int(math.Ceil(float64(time.Now().Unix()-rechargeInfo.FirstRecharge) / float64(24*60*60)))
rtpControls := GetConfigRtpControl()
var rtpControl, defaultRtpControl *common.ConfigRtpControl
for _, v := range rtpControls {
if rechargeDay != v.RechargeDay && v.RechargeDay != -1 {
continue
}
if v.WithdrawPer == -1 || v.RechargeDay == -1 {
defaultRtpControl = v
}
if int(withdrawRechargePer) < v.WithdrawPer {
rtpControl = v
break
}
}
if rtpControl == nil && defaultRtpControl != nil {
rtpControl = defaultRtpControl
}
if rtpControl != nil {
log.Debug("rtpControl, uid:%d totalWithdraw:%d withdrawing:%d cash:%d totalRecharge:%d withdrawPer:%d rechargeDay:%d | %+v",
uid, rechargeInfo.TotalWithdraw, rechargeInfo.WithdrawingCash, cash, rechargeInfo.TotalRecharge, withdrawRechargePer, rechargeDay, *rtpControl)
rtp = rtpControl.Rtp
}
return rtp
}

@ -73,7 +73,7 @@ const (
ReloadTypeConfigWithdrawWeight
ReloadTypeConfigShareRankAward
ReloadConfigWeekCard // 周卡
ReloadConfigRtpControl
ReloadTypeExcel
)
@ -202,6 +202,8 @@ func GetConfigStructByType(t int) (interface{}, interface{}) {
return &ConfigShareRankAward{}, &[]ConfigShareRankAward{}
case ReloadConfigWeekCard:
return &ConfigWeekCard{}, &[]ConfigWeekCard{}
case ReloadConfigRtpControl:
return &ConfigRtpControl{}, &[]ConfigRtpControl{}
default:
return nil, nil
}

@ -326,3 +326,15 @@ type PlayerRtpData struct {
func (c *PlayerRtpData) TableName() string {
return "player_rtp_data"
}
type ConfigRtpControl struct {
ID int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key"`
RechargeDay int `gorm:"column:recharge_day;type:bigint(20);comment:充值天数" web:"recharge_day"`
WithdrawPer int `gorm:"column:withdraw_per;type:bigint(20);comment:提存比" web:"withdraw_per"`
Rtp int `gorm:"column:rtp;type:int(11);comment:rtp" web:"rtp"`
UpdatedBase
}
func (m *ConfigRtpControl) TableName() string {
return "config_rtp_control"
}

@ -202,6 +202,7 @@ type RechargeInfo struct {
ProductPayCount int64 `gorm:"column:product_paycount;type:bigint(20);default:0;comment:记录玩家购买商品次数,映射表在代码里"`
DayRecharge int64 `gorm:"column:day_recharge;type:bigint(20);default:0;comment:日充值"`
TotalRechargeCount int64 `gorm:"column:total_recharge_count;type:bigint(20);default:0;comment:总充值次数"`
FirstRecharge int64 `gorm:"column:first_recharge;type:bigint(20);default:0;comment:第一次充值的时间戳"`
LastRecharge int64 `gorm:"column:last_recharge;type:bigint(20);default:0;comment:最近一次充值的时间戳"`
TotalRecharge int64 `gorm:"column:total_recharge;type:bigint(20);default:0;comment:总充值数额,不论货币"`
TotalWithdrawCount int64 `gorm:"column:total_withdraw_count;type:bigint(20);default:0;comment:总退出次数"`

@ -95,7 +95,7 @@ func GetGameUserInfo(c *gin.Context) {
// usdtInfo := call.GetPlayerRechargeInfoByCurrency(uid, common.CurrencyUSDT)
resp.RechargeBrl = brlInfo.TotalRecharge
resp.WithdrawBrl = brlInfo.TotalWithdraw
resp.Rtp = call.GetUserRtp(uid).Rtp
resp.Rtp = call.GetRtpControlV1(uid)
// resp.RechargeUsdt = usdtInfo.TotalRecharge
// resp.WithdrawUsdt = usdtInfo.TotoalWithdraw

@ -151,6 +151,7 @@ func MigrateDB() {
new(common.LuckyWheelReward),
new(common.ConfigWeekCard),
new(common.WeekCardData),
new(common.ConfigRtpControl),
)
if err != nil {
panic("Migrate db fail")

@ -206,6 +206,8 @@ func GetControlType(path string) int {
return common.ReloadTypeConfigShareRankAward
case "weekCard":
return common.ReloadConfigWeekCard
case "rtpControl":
return common.ReloadConfigRtpControl
default:
return 0
}

@ -60,7 +60,7 @@ func GetBalance(c *gin.Context) {
}
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
resp.Data.Level = call.GetProviderGameRtp(uid)
resp.Data.Level = call.GetRtpControlV1(uid)
log.Debug("GetBalanceResp:%+v", resp)
}
@ -123,7 +123,7 @@ func GameBet(c *gin.Context) {
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
resp.Data.Level = call.GetProviderGameRtp(uid)
resp.Data.Level = call.GetRtpControlV1(uid)
return
}
betReq.SettleAmount = int64(req.Amount * common.DecimalDigits)
@ -138,7 +138,7 @@ func GameBet(c *gin.Context) {
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
resp.Data.Level = call.GetProviderGameRtp(uid)
resp.Data.Level = call.GetRtpControlV1(uid)
return
}
record = &common.ProviderBetRecord{
@ -176,7 +176,7 @@ func GameBet(c *gin.Context) {
}
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
resp.Data.Level = call.GetProviderGameRtp(uid)
resp.Data.Level = call.GetRtpControlV1(uid)
return
} else {
if record.ID >= 0 {
@ -217,7 +217,7 @@ func GameBet(c *gin.Context) {
}
resp.Data.Balance = util.Decimal(float64(adjustResp.Balance)/common.DecimalDigits, 2)
}
resp.Data.Level = call.GetProviderGameRtp(uid)
resp.Data.Level = call.GetRtpControlV1(uid)
log.Debug("GameBetResp:%+v", resp)
a.Data = resp
}

@ -623,7 +623,7 @@ func Control(uid int, controlId int) error {
TargetRtp int `json:"target_rtp"`
}{
{
TargetRtp: call.GetProviderGameRtp(uid),
TargetRtp: call.GetRtpControlV1(uid),
},
},
}

Loading…
Cancel
Save