接入pg和jili,rtp策略调整

dev
mofangmin 1 year ago
parent 6abd764baf
commit 87bdf82aa6
  1. 25
      call/config.go
  2. 10
      call/reload.go
  3. 26
      call/user.go
  4. 13
      common/activity.go
  5. 5
      common/config.go
  6. 10
      common/player.go
  7. 21
      modules/backend/handler/guser/editGameUserGold.go
  8. 5
      modules/backend/handler/guser/getGameUserInfo.go
  9. 2
      modules/backend/migrate.go
  10. 1
      modules/backend/routers/routers_guser.go
  11. 6
      modules/backend/values/gameuser.go
  12. 2
      modules/backend/values/gm.go
  13. 10
      modules/web/providers/base/base.go
  14. 1
      modules/web/providers/jili2/api.go
  15. 3
      modules/web/providers/jili2/base.go
  16. 6
      modules/web/providers/jili2/handler.go
  17. 1
      modules/web/providers/pg2/api.go
  18. 3
      modules/web/providers/pg2/base.go
  19. 4
      modules/web/providers/pg2/handler.go
  20. 4
      modules/web/providers/pg2/values.go

@ -65,6 +65,7 @@ var (
configBetDraw []*common.ConfigActivityBetDraw configBetDraw []*common.ConfigActivityBetDraw
configActivityPopup []*common.ConfigActivityPopup configActivityPopup []*common.ConfigActivityPopup
configDiscountTicket []common.ConfigDiscountTicket configDiscountTicket []common.ConfigDiscountTicket
configRtp []common.ConfigRtp
// 客服 // 客服
configCustomerRobot []*common.ConfigCustomerRobot configCustomerRobot []*common.ConfigCustomerRobot
customerOrderLabel []*common.CustomerOrderLabel customerOrderLabel []*common.CustomerOrderLabel
@ -1586,3 +1587,27 @@ func GetConfigDiscountTicketByAmount(amount int64) (ret common.ConfigDiscountTic
} }
return return
} }
func LoadConfigRTP() (err error) {
var list []common.ConfigRtp
if _, err = db.Mysql().QueryAll("", "", &common.ConfigRtp{}, &list); err != nil {
log.Error("err:%v", err)
return err
}
configRtp = list
return nil
}
func GetConfigRTP() []common.ConfigRtp {
return configRtp
}
// GetConfigRTPByAmount
func GetConfigRTPByAmount(amount int64) (ret common.ConfigRtp) {
for _, item := range configRtp {
if amount >= item.MinRecharge && amount <= item.MinRecharge {
return item
}
}
return
}

@ -476,6 +476,16 @@ func CommonReload(c map[int][]func(*pb.ReloadGameConfig) error) {
return nil return nil
}} }}
} }
if _, ok := c[common.ReloadConfigRTP]; !ok {
c[common.ReloadConfigRTP] = []func(*pb.ReloadGameConfig) error{func(rgc *pb.ReloadGameConfig) error {
if err := LoadConfigRTP(); err != nil {
log.Error("error : [%s]", err.Error())
return err
}
return nil
}}
}
// 客服 // 客服
if _, ok := c[common.ReloadConfigCustomerRobot]; !ok { if _, ok := c[common.ReloadConfigCustomerRobot]; !ok {
c[common.ReloadConfigCustomerRobot] = []func(*pb.ReloadGameConfig) error{func(rgc *pb.ReloadGameConfig) error { c[common.ReloadConfigCustomerRobot] = []func(*pb.ReloadGameConfig) error{func(rgc *pb.ReloadGameConfig) error {

@ -784,3 +784,29 @@ func GetPlayerFavoriteList(uid, num int) (gameList []*common.ConfigGameList) {
} }
return return
} }
func GetUserRtp(uid int) *common.PlayerRtpData {
data := &common.PlayerRtpData{Uid: uid}
db.Mysql().Get(&data)
return data
}
func GetRtpControl(uid int) int {
rechargeInfo := GetRechargeInfo(uid)
withdrawRechargePer := (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash) / rechargeInfo.TotalRecharge
rtpConf := GetConfigRTPByAmount(rechargeInfo.TotalRecharge)
rtpData := GetUserRtp(uid)
// 1.优先玩家配置
// 2.个控
// 3.大盘
rtp := GetConfigPlatform().Rtp
if rtpData.Id > 0 {
rtp = rtpData.Rtp
}
if rtp > 0 && rtpConf.Id > 0 {
if withdrawRechargePer >= int64(rtpConf.EnterPer) && withdrawRechargePer <= int64(rtpConf.ExitPer) {
rtp = rtpConf.Rtp
}
}
return rtp
}

@ -561,3 +561,16 @@ type ConfigDiscountTicket struct {
func (m *ConfigDiscountTicket) TableName() string { func (m *ConfigDiscountTicket) TableName() string {
return "config_discount_ticket" return "config_discount_ticket"
} }
type ConfigRtp struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
MinRecharge int64 `gorm:"column:min_recharge;type:bigint(20);comment:最小充值" json:"min_recharge"`
MaxRecharge int64 `gorm:"column:max_recharge;type:bigint(20);comment:最小充值" json:"max_recharge"`
Rtp int `gorm:"column:rtp;type:int(11);comment:rtp" json:"rtp"`
EnterPer int `gorm:"column:enter_per;type:int(11);comment:进入提存比" json:"enter_per"`
ExitPer int `gorm:"column:exit_per;type:int(11);comment:退出提存比" json:"exit_per"`
}
func (m *ConfigRtp) TableName() string {
return "config_rtp"
}

@ -53,7 +53,7 @@ const (
ReloadConfigBetDraw // 下注抽奖 ReloadConfigBetDraw // 下注抽奖
ReloadConfigActivityPopup // 活动弹窗 ReloadConfigActivityPopup // 活动弹窗
ReloadConfigDiscountTicket // 折扣券 ReloadConfigDiscountTicket // 折扣券
ReloadConfigRTP // rtp配置
ReloadConfigCustomerRobot // 客服系统机器人配置 ReloadConfigCustomerRobot // 客服系统机器人配置
ReloadConfigCustomerLabel // 客服系统订单标签 ReloadConfigCustomerLabel // 客服系统订单标签
ReloadConfigCustomer // 客服系统订单标签 ReloadConfigCustomer // 客服系统订单标签
@ -150,6 +150,8 @@ func GetConfigStructByType(t int) (interface{}, interface{}) {
return &ConfigActivityPopup{}, &[]ConfigActivityPopup{} return &ConfigActivityPopup{}, &[]ConfigActivityPopup{}
case ReloadConfigDiscountTicket: case ReloadConfigDiscountTicket:
return &ConfigDiscountTicket{}, &[]ConfigDiscountTicket{} return &ConfigDiscountTicket{}, &[]ConfigDiscountTicket{}
case ReloadConfigRTP:
return &ConfigRtp{}, &[]ConfigRtp{}
default: default:
return nil, nil return nil, nil
} }
@ -176,6 +178,7 @@ type ConfigPlatform struct {
PayTips string `gorm:"column:pay_tips;type:varchar(256);default:'';comment:充值提示语" json:"PayTips" web:"pay_tips"` PayTips string `gorm:"column:pay_tips;type:varchar(256);default:'';comment:充值提示语" json:"PayTips" web:"pay_tips"`
WithdrawTips string `gorm:"column:withdraw_tips;type:varchar(256);default:'';comment:tx提示语" json:"WithdrawTips" web:"withdraw_tips"` WithdrawTips string `gorm:"column:withdraw_tips;type:varchar(256);default:'';comment:tx提示语" json:"WithdrawTips" web:"withdraw_tips"`
BlackList int `gorm:"column:black_list;type:int(11);default:0;comment:是否开启黑名单 0不开 1开启" json:"BlackList" web:"black_list"` BlackList int `gorm:"column:black_list;type:int(11);default:0;comment:是否开启黑名单 0不开 1开启" json:"BlackList" web:"black_list"`
Rtp int `gorm:"column:rtp;type:int(11);default:0;comment:平台RTP" json:"Rtp" web:"rtp"`
} }
func (c *ConfigPlatform) TableName() string { func (c *ConfigPlatform) TableName() string {

@ -311,3 +311,13 @@ type PlayerPayData struct {
func (c *PlayerPayData) TableName() string { func (c *PlayerPayData) TableName() string {
return "player_pay_data" return "player_pay_data"
} }
type PlayerRtpData struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
Uid int `gorm:"column:uid;type:int(11)" json:"uid"`
Rtp int `gorm:"column:rtp;type:int(11)" json:"rtp"`
}
func (c *PlayerRtpData) TableName() string {
return "player_rtp_data"
}

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"server/call" "server/call"
"server/common" "server/common"
"server/db"
"server/modules/backend/app" "server/modules/backend/app"
"server/modules/backend/values" "server/modules/backend/values"
@ -40,3 +41,23 @@ func EditGameUserGold(c *gin.Context) {
} }
a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%v金币:%v", req.UID, req.Amount)) a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%v金币:%v", req.UID, req.Amount))
} }
func EditGameUserRtp(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.Response()
}()
req := new(values.EditGameUserRtpReq)
if !a.S(req) {
return
}
err := db.Mysql().Update(&common.PlayerRtpData{Uid: req.UID}, map[string]interface{}{
"rtp": req.Val,
})
if err != nil {
a.Code = values.CodeRetry
a.Msg = "modify rtp error"
}
a.RecordEdit(values.PowerGUser, fmt.Sprintf("修改玩家%vRtp:%v", req.UID, req.Val))
}

@ -93,6 +93,11 @@ func GetGameUserInfo(c *gin.Context) {
// usdtInfo := call.GetPlayerRechargeInfoByCurrency(uid, common.CurrencyUSDT) // usdtInfo := call.GetPlayerRechargeInfoByCurrency(uid, common.CurrencyUSDT)
resp.RechargeBrl = brlInfo.TotalRecharge resp.RechargeBrl = brlInfo.TotalRecharge
resp.WithdrawBrl = brlInfo.TotalWithdraw resp.WithdrawBrl = brlInfo.TotalWithdraw
rtp := call.GetUserRtp(uid)
if rtp.Id == 0 {
db.Mysql().Create(rtp)
}
resp.Rtp = rtp.Rtp
// resp.RechargeUsdt = usdtInfo.TotalRecharge // resp.RechargeUsdt = usdtInfo.TotalRecharge
// resp.WithdrawUsdt = usdtInfo.TotoalWithdraw // resp.WithdrawUsdt = usdtInfo.TotoalWithdraw

@ -117,6 +117,8 @@ func MigrateDB() {
new(common.SheetBroadcastConfig), new(common.SheetBroadcastConfig),
new(common.SheetNoticeConfig), new(common.SheetNoticeConfig),
new(common.ConfigDiscountTicket), new(common.ConfigDiscountTicket),
new(common.ConfigRtp),
new(common.PlayerRtpData),
) )
if err != nil { if err != nil {
panic("Migrate db fail") panic("Migrate db fail")

@ -19,6 +19,7 @@ func guser(e *gin.Engine) {
e.POST("/guser/controlBalance", handler.GetGameUserControlBalance) e.POST("/guser/controlBalance", handler.GetGameUserControlBalance)
// e.POST("/guser/controlCardData", handler.ControlCardData) // e.POST("/guser/controlCardData", handler.ControlCardData)
e.POST("/guser/editGold", handler.EditGameUserGold) e.POST("/guser/editGold", handler.EditGameUserGold)
e.POST("/guser/editRtp", handler.EditGameUserRtp)
e.POST("/guser/editStatus", handler.EditGameUserStatus) e.POST("/guser/editStatus", handler.EditGameUserStatus)
e.POST("/guser/addUserTag", handler.AddUserTag) e.POST("/guser/addUserTag", handler.AddUserTag)
e.POST("/guser/deleteUserTag", handler.AddUserTag) e.POST("/guser/deleteUserTag", handler.AddUserTag)

@ -137,6 +137,7 @@ type GetGameUserInfoResp struct {
OutputData map[string]string OutputData map[string]string
Gpsadid string Gpsadid string
SubAccount []int SubAccount []int
Rtp int
} }
type UserGameInfo struct { type UserGameInfo struct {
@ -415,6 +416,11 @@ type EditGameUserGoldReq struct {
Amount int64 `json:"Amount" binding:"required"` Amount int64 `json:"Amount" binding:"required"`
} }
type EditGameUserRtpReq struct {
UID int `json:"UID" binding:"required"`
Val int
}
// EditGameUserGoldReq 修改玩家状态,解封/封禁 // EditGameUserGoldReq 修改玩家状态,解封/封禁
// UID 玩家uid // UID 玩家uid
// Status 修改的状态 1正常 2封禁 // Status 修改的状态 1正常 2封禁

@ -164,6 +164,8 @@ func GetControlType(path string) int {
return common.ReloadConfigActivityPopup return common.ReloadConfigActivityPopup
case "discountTicket": case "discountTicket":
return common.ReloadConfigDiscountTicket return common.ReloadConfigDiscountTicket
case "configRtp":
return common.ReloadConfigRTP
default: default:
return 0 return 0
} }

@ -1,6 +1,7 @@
package base package base
import ( import (
"errors"
"fmt" "fmt"
"server/call" "server/call"
"server/common" "server/common"
@ -366,6 +367,7 @@ func SessionBet(req *BetReq) (resp BetResp) {
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }
if betAmount > 0 {
pro := call.MineCurrencyProReal( pro := call.MineCurrencyProReal(
&common.UpdateCurrency{ &common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{ CurrencyBalance: &common.CurrencyBalance{
@ -384,7 +386,7 @@ func SessionBet(req *BetReq) (resp BetResp) {
if pro.Err != nil { if pro.Err != nil {
log.Error("err:%v", pro.Err) log.Error("err:%v", pro.Err)
resp.Code = CodeInnerError resp.Code = CodeInnerError
if pro.Err == call.ErrNotEnoughBalance { if errors.Is(pro.Err, call.ErrNotEnoughBalance) {
resp.Code = CodeNotEnoughAmount resp.Code = CodeNotEnoughAmount
} }
} }
@ -393,6 +395,8 @@ func SessionBet(req *BetReq) (resp BetResp) {
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }
}
var pro *call.ProRes
setValue := settle + req.Preserve setValue := settle + req.Preserve
if setValue != 0 { if setValue != 0 {
cb := &common.CurrencyBalance{ cb := &common.CurrencyBalance{
@ -430,7 +434,11 @@ func SessionBet(req *BetReq) (resp BetResp) {
MyUUID: fmt.Sprintf("%d", uuid), MyUUID: fmt.Sprintf("%d", uuid),
}) })
}) })
if pro != nil {
resp.Balance = pro.Balance resp.Balance = pro.Balance
} else {
resp.Balance = call.GetUserCurrency(uid, ct)
}
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }

@ -43,6 +43,7 @@ type EnterGameRequest struct {
Token string `json:"token,omitempty"` Token string `json:"token,omitempty"`
Lang string `json:"lang,omitempty"` Lang string `json:"lang,omitempty"`
Nick string `json:"nick,omitempty"` Nick string `json:"nick,omitempty"`
RtpPool int `json:"rtp_pool"`
} }
type EnterGameResponse struct { type EnterGameResponse struct {

@ -40,6 +40,8 @@ func (s *Sub) EnterGame() string {
gameID := s.Base.EnterGameReq.GameID gameID := s.Base.EnterGameReq.GameID
mchid := AgentMap.MchId mchid := AgentMap.MchId
key := AgentMap.Key key := AgentMap.Key
rtp := call.GetRtpControl(uid)
log.Info("uid:%v,rtp:%v", uid, rtp)
headers := map[string]string{ headers := map[string]string{
"X-Atgame-Mchid": mchid, "X-Atgame-Mchid": mchid,
"X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10), "X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10),
@ -56,6 +58,7 @@ func (s *Sub) EnterGame() string {
Token: token, Token: token,
Lang: Lang, Lang: Lang,
Nick: "", Nick: "",
RtpPool: rtp,
} }
body, _ := json.Marshal(request) body, _ := json.Marshal(request)
sign := GenerateSign(string(body), timestamp, key) sign := GenerateSign(string(body), timestamp, key)

@ -113,6 +113,7 @@ func PlaceBet(c *gin.Context) {
provider := call.GetConfigGameProvider(common.ProviderJiLi2) provider := call.GetConfigGameProvider(common.ProviderJiLi2)
now := time.Now().Unix() now := time.Now().Unix()
if req.Bet != 0 || req.Award != 0 {
betReq := &base.BetReq{ betReq := &base.BetReq{
UID: uid, UID: uid,
CurrencyType: common.CurrencyINR, CurrencyType: common.CurrencyINR,
@ -120,7 +121,7 @@ func PlaceBet(c *gin.Context) {
TurnOver: int64(req.Bet * common.DecimalDigits), TurnOver: int64(req.Bet * common.DecimalDigits),
SettleAmount: int64(req.Award * common.DecimalDigits), SettleAmount: int64(req.Award * common.DecimalDigits),
SessionType: common.SessionTypeSettle, SessionType: common.SessionTypeSettle,
GameID: GetGameID(common.ProviderJiLi2, req.GameID), GameID: GetGameID(common.ProviderPG2, req.GameID),
GameName: req.GameID, GameName: req.GameID,
Provider: provider, Provider: provider,
BetID: req.BetID, BetID: req.BetID,
@ -138,6 +139,9 @@ func PlaceBet(c *gin.Context) {
return return
} }
resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2) resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2)
} else {
resp.Data.Balance = util.Decimal(float64(call.GetUserCurrency(uid, common.CurrencyINR))/common.DecimalDigits, 2)
}
a.Data = resp a.Data = resp
} }

@ -43,6 +43,7 @@ type EnterGameRequest struct {
Token string `json:"token,omitempty"` Token string `json:"token,omitempty"`
Lang string `json:"lang,omitempty"` Lang string `json:"lang,omitempty"`
Nick string `json:"nick,omitempty"` Nick string `json:"nick,omitempty"`
RtpPool int `json:"rtp_pool"`
} }
type EnterGameResponse struct { type EnterGameResponse struct {

@ -40,6 +40,8 @@ func (s *Sub) EnterGame() string {
gameID := s.Base.EnterGameReq.GameID gameID := s.Base.EnterGameReq.GameID
mchid := AgentMap.MchId mchid := AgentMap.MchId
key := AgentMap.Key key := AgentMap.Key
rtp := call.GetRtpControl(uid)
log.Info("uid:%v,rtp:%v", uid, rtp)
headers := map[string]string{ headers := map[string]string{
"X-Atgame-Mchid": mchid, "X-Atgame-Mchid": mchid,
"X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10), "X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10),
@ -56,6 +58,7 @@ func (s *Sub) EnterGame() string {
Token: token, Token: token,
Lang: Lang, Lang: Lang,
Nick: "", Nick: "",
RtpPool: rtp,
} }
body, _ := json.Marshal(request) body, _ := json.Marshal(request)
sign := GenerateSign(string(body), timestamp, key) sign := GenerateSign(string(body), timestamp, key)

@ -113,6 +113,7 @@ func PlaceBet(c *gin.Context) {
provider := call.GetConfigGameProvider(common.ProviderPG2) provider := call.GetConfigGameProvider(common.ProviderPG2)
now := time.Now().Unix() now := time.Now().Unix()
if req.Bet != 0 || req.Award != 0 {
betReq := &base.BetReq{ betReq := &base.BetReq{
UID: uid, UID: uid,
CurrencyType: common.CurrencyINR, CurrencyType: common.CurrencyINR,
@ -138,6 +139,9 @@ func PlaceBet(c *gin.Context) {
return return
} }
resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2) resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2)
} else {
resp.Data.Balance = util.Decimal(float64(call.GetUserCurrency(uid, common.CurrencyINR))/common.DecimalDigits, 2)
}
a.Data = resp a.Data = resp
} }

@ -17,8 +17,8 @@ var (
API = "" API = ""
AgentMap Agent AgentMap Agent
AgentMapTest = Agent{ AgentMapTest = Agent{
"10055", "10071",
"170779CCC5E9FE29DBB3F5FEDBB304A0", "E3D1A83FA82F04D9725ACB5A77578A65",
} }
AgentMapRelease = Agent{} AgentMapRelease = Agent{}
) )

Loading…
Cancel
Save