Merge branch 'dev' into release

# Conflicts:
#	common/config.go
#	modules/backend/migrate.go
#	modules/backend/values/gm.go
#	modules/web/handler/game.go
dev
mofangmin 1 year ago
commit 115b1ff269
  1. 32
      call/config.go
  2. 11
      call/mail.go
  3. 44
      call/pay.go
  4. 10
      call/reload.go
  5. 24
      call/share.go
  6. 26
      call/user.go
  7. 13
      common/activity.go
  8. 36
      common/config.go
  9. 1
      common/platform.go
  10. 10
      common/player.go
  11. 1
      common/provider.go
  12. 1
      main.go
  13. 6
      modules/backend/handler/examine/examine.go
  14. 21
      modules/backend/handler/guser/editGameUserGold.go
  15. 5
      modules/backend/handler/guser/getGameUserInfo.go
  16. 2
      modules/backend/migrate.go
  17. 1
      modules/backend/routers/routers_guser.go
  18. 6
      modules/backend/values/gameuser.go
  19. 2
      modules/backend/values/gm.go
  20. 179
      modules/web/handler/activity.go
  21. 30
      modules/web/handler/game.go
  22. 2
      modules/web/handler/recharge.go
  23. 45
      modules/web/handler/share.go
  24. 1
      modules/web/handler/user.go
  25. 4
      modules/web/handler/withdraw.go
  26. 3
      modules/web/module.go
  27. 3
      modules/web/providers/all/all.go
  28. 58
      modules/web/providers/base/base.go
  29. 145
      modules/web/providers/jili2/api.go
  30. 75
      modules/web/providers/jili2/base.go
  31. 147
      modules/web/providers/jili2/handler.go
  32. 14
      modules/web/providers/jili2/sign.go
  33. 24
      modules/web/providers/jili2/values.go
  34. 15
      modules/web/providers/pg2/api.go
  35. 39
      modules/web/providers/pg2/base.go
  36. 48
      modules/web/providers/pg2/handler.go
  37. 43
      modules/web/providers/pg2/values.go
  38. 4
      modules/web/values/activity.go
  39. 5
      modules/web/values/share.go
  40. 2
      pb/proto/inner.proto
  41. 6
      pb/proto/platform.proto

@ -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
@ -562,7 +563,7 @@ func LoadGames() (err error) {
for _, v := range tmplist { for _, v := range tmplist {
for _, k := range providers { for _, k := range providers {
if v.GameProvider == k.ProviderID { if v.GameProvider == k.ProviderID {
if v.GameProvider == common.ProviderPG2 || k.Open == 1 { // 特殊过滤 if k.Open == 1 { // 特殊过滤
list = append(list, v) list = append(list, v)
} }
break break
@ -625,6 +626,9 @@ func GetConfigGameProviderAll() []*common.ConfigGameProvider {
func GetConfigGameProviderAllOpen() []*common.ConfigGameProvider { func GetConfigGameProviderAllOpen() []*common.ConfigGameProvider {
ret := []*common.ConfigGameProvider{} ret := []*common.ConfigGameProvider{}
for _, v := range configGameProvider { for _, v := range configGameProvider {
if v.ProviderID == common.ProviderPG2 || v.ProviderID == common.ProviderJiLi2 {
continue
}
if v.Show == 2 { if v.Show == 2 {
continue continue
} }
@ -725,7 +729,7 @@ func GetConfigGameList(num int, cond ...int) []*common.ConfigGameList {
continue continue
} }
} }
if v.GameProvider == common.ProviderPG2 { if v.GameProvider == common.ProviderPG2 || v.GameProvider == common.ProviderJiLi2 {
continue continue
} }
ret = append(ret, v) ret = append(ret, v)
@ -1583,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
}

@ -11,11 +11,12 @@ import (
) )
var ( var (
SystemTitle = "System Notice" SystemTitle = "System Notice"
EmailWithdrawPass = "Your order %v, amount: $%v is in the payment status, please be patient." EmailWithdrawPass = "Your order %v, amount: $%v is in the payment status, please be patient."
EmailWithdrawSuccess = "Your order %v, amount: $%v has been credited, please check. If you have any questions, you can contact customer service." EmailWithdrawSuccess = "Your order %v, amount: $%v has been credited, please check. If you have any questions, you can contact customer service."
EmailWithdrawFail = "Your order %v, Amount: $%v\nYour withdrawal failed due to incorrect information. Please verify or change your withdrawal details and resubmit" EmailWithdrawFail = "Your order %v, Amount: $%v\nYour withdrawal failed due to incorrect information. Please verify or change your withdrawal details and resubmit"
EmailDiscount = "Congratulations, you have received a $%v coupon for a top-up of $%v or more." EmailShareWithdrawFail = "Your friend's invitation reward withdrawal order: %v, Amount: %v\nYour withdrawal failed due to incorrect information. Please verify or change your withdrawal details and resubmit.\n"
EmailDiscount = "Congratulations, you have received a $%v coupon for a top-up of $%v or more."
) )
func checkMail(uid int, red *common.PlayerRed) { func checkMail(uid int, red *common.PlayerRed) {

@ -81,6 +81,17 @@ func Withdraw(data *pb.InnerWithdrawReq) (*pb.InnerWithdrawResp, error) {
return retData, nil return retData, nil
} }
// CheckUserBet 检测玩家余额
func CheckUserBet(uid int, t common.CurrencyType) {
cash := GetUserCurrency(uid, t)
if cash < config.GetConfig().Web.BreakLimit {
_, err := db.Mysql().UpdateRes(&common.PlayerProfile{UID: uid}, map[string]interface{}{"need_bet": 0})
if err != nil {
log.Error("err:%v", err)
}
}
}
// RechargeCallback 充值回调 // RechargeCallback 充值回调
func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra string) (err error) { func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra string) (err error) {
log.Info("RechargeCallback:%+v,%v,%v,%v,", r, success, payAccount, extra) log.Info("RechargeCallback:%+v,%v,%v,%v,", r, success, payAccount, extra)
@ -101,8 +112,9 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
log.Error("get recharage info err:%v,uid:%v", err, r.UID) log.Error("get recharage info err:%v,uid:%v", err, r.UID)
return err return err
} }
amount := r.Amount
CheckUserBet(uid, r.CurrencyType)
amount := r.Amount
notCharge := re.TotalRecharge == 0 notCharge := re.TotalRecharge == 0
re.TotalRecharge += amount re.TotalRecharge += amount
now := time.Now().Unix() now := time.Now().Unix()
@ -418,18 +430,24 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa
return err return err
} }
if status != common.StatusROrderCreate { if status != common.StatusROrderCreate {
if err := UpdateCurrency(&common.UpdateCurrency{ if or.Extra != "share" {
CurrencyBalance: &common.CurrencyBalance{ if err := UpdateCurrency(&common.UpdateCurrency{
UID: or.UID, CurrencyBalance: &common.CurrencyBalance{
Type: or.CurrencyType, UID: or.UID,
Value: or.WithdrawCash, Type: or.CurrencyType,
Event: common.CurrencyEventWithDrawBack, Value: or.WithdrawCash,
Exs1: or.OrderID, Event: common.CurrencyEventWithDrawBack,
}, Exs1: or.OrderID,
}, tx); err != nil { },
log.Error("Withdraw callback err:%v", err) }, tx); err != nil {
tx.Rollback() log.Error("Withdraw callback err:%v", err)
return err tx.Rollback()
return err
}
} else {
db.Mysql().Update(&common.ShareInfo{UID: or.UID}, map[string]interface{}{
"available_reward": gorm.Expr("available_reward + ?", or.WithdrawCash),
})
} }
} }
// 退还代付券 // 退还代付券

@ -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 {

@ -25,15 +25,21 @@ func GetShareInfo(uid int) *common.ShareInfo {
} }
return shareInfo return shareInfo
} }
func GetShareInfoByCode(code string) *common.ShareInfo {
shareInfo := &common.ShareInfo{Share: code}
db.Mysql().Get(shareInfo)
return shareInfo
}
// 分享查询 // 分享查询
func ShareBind(share string, isOld bool, uid, cid int) { func ShareBind(share string, isOld bool, uid, cid int) {
// 绑定 // 绑定
if share == "" || isOld { if share == "" {
return return
} }
activityId := 0 activityId := 0
now := time.Now().Unix() now := time.Now().Unix()
// 关联活动分享码
codeInfo := &common.ShareActivityCode{ShareCode: share} codeInfo := &common.ShareActivityCode{ShareCode: share}
upInfo := &common.ShareInfo{} upInfo := &common.ShareInfo{}
db.Mysql().Get(codeInfo) db.Mysql().Get(codeInfo)
@ -54,9 +60,19 @@ func ShareBind(share string, isOld bool, uid, cid int) {
if upInfo.ID <= 0 { if upInfo.ID <= 0 {
return return
} }
shareInfo := &common.ShareInfo{UID: uid, UP1: upInfo.UID, UP2: upInfo.UP1, UP3: upInfo.UP2, Time: time.Now().Unix(), ChannelID: cid, Share: util.GetShareCode(uid), ActivityId: activityId} if !isOld {
db.Mysql().Create(shareInfo) shareInfo := &common.ShareInfo{UID: uid, UP1: upInfo.UID, UP2: upInfo.UP1, UP3: upInfo.UP2, Time: time.Now().Unix(), ChannelID: cid, Share: util.GetShareCode(uid), ActivityId: activityId}
db.Mysql().Create(shareInfo)
} else {
err := db.Mysql().Update(&common.ShareInfo{UID: uid}, map[string]interface{}{
"up1": upInfo.UID,
"up2": upInfo.UP1,
"up3": upInfo.UP2,
})
if err != nil {
log.Error("ShareBind err:%v", err)
}
}
// 更新上级邀请玩家数 // 更新上级邀请玩家数
db.Mysql().Update(&common.ShareInfo{UID: upInfo.UID}, map[string]interface{}{"invites": gorm.Expr("invites + 1")}) db.Mysql().Update(&common.ShareInfo{UID: upInfo.UID}, map[string]interface{}{"invites": gorm.Expr("invites + 1")})

@ -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 * 100
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,10 +53,10 @@ const (
ReloadConfigBetDraw // 下注抽奖 ReloadConfigBetDraw // 下注抽奖
ReloadConfigActivityPopup // 活动弹窗 ReloadConfigActivityPopup // 活动弹窗
ReloadConfigDiscountTicket // 折扣券 ReloadConfigDiscountTicket // 折扣券
ReloadConfigRTP // rtp配置
ReloadConfigCustomerRobot // 客服系统机器人配置 ReloadConfigCustomerRobot // 客服系统机器人配置
ReloadConfigCustomerLabel // 客服系统订单标签 ReloadConfigCustomerLabel // 客服系统订单标签
ReloadConfigCustomer // 客服系统订单标签 ReloadConfigCustomer // 客服系统订单标签
) )
// GetConfigStructByType 获取相应配置的结构 // GetConfigStructByType 获取相应配置的结构
@ -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
} }
@ -164,18 +166,20 @@ func GetConfigStructByType(t int) (interface{}, interface{}) {
// WithdrawRecharge 退出需付费的金额 // WithdrawRecharge 退出需付费的金额
// NewControlEnd 新手调控结束阀值 // NewControlEnd 新手调控结束阀值
type ConfigPlatform struct { type ConfigPlatform struct {
ID int `gorm:"primarykey"` ID int `gorm:"primarykey"`
NewPlayerGift int64 `gorm:"column:new_player_gift;type:int(11);default:1000;comment:新玩家赠送金币" json:"NewPlayerGift" web:"new_player_gift"` NewPlayerGift int64 `gorm:"column:new_player_gift;type:int(11);default:1000;comment:新玩家赠送金币" json:"NewPlayerGift" web:"new_player_gift"`
BindPhoneGift int64 `gorm:"column:bind_phone_gift;type:int(11);default:1000;comment:绑定手机赠送" json:"BindPhoneGift" web:"bind_phone_gift"` BindPhoneGift int64 `gorm:"column:bind_phone_gift;type:int(11);default:1000;comment:绑定手机赠送" json:"BindPhoneGift" web:"bind_phone_gift"`
AvatarCount int `gorm:"column:avatar_count;type:int(11);default:400;comment:最大头像数目" json:"AvatarCount" web:"avatar_count"` AvatarCount int `gorm:"column:avatar_count;type:int(11);default:400;comment:最大头像数目" json:"AvatarCount" web:"avatar_count"`
CartoonCount int `gorm:"column:cartoon_count;type:int(11);default:15;comment:卡通头像数目" json:"CartoonCount" web:"cartoon_count"` CartoonCount int `gorm:"column:cartoon_count;type:int(11);default:15;comment:卡通头像数目" json:"CartoonCount" web:"cartoon_count"`
SmsChannel int `gorm:"column:sms_channel;type:int(11);default:1;comment:短信服务商 1Antgst 2Buka" json:"SmsChannel" web:"sms_channel"` SmsChannel int `gorm:"column:sms_channel;type:int(11);default:1;comment:短信服务商 1Antgst 2Buka" json:"SmsChannel" web:"sms_channel"`
Telegram string `gorm:"column:telegram;type:varchar(256);default:'+66636640245';comment:客服telegram" json:"Telegram" web:"telegram"` Telegram string `gorm:"column:telegram;type:varchar(256);default:'+66636640245';comment:客服telegram" json:"Telegram" web:"telegram"`
Whatsapp string `gorm:"column:whatsapp;type:varchar(256);default:'+66636640245';comment:客服whatsapp" json:"Whatsapp" web:"whatsapp"` Whatsapp string `gorm:"column:whatsapp;type:varchar(256);default:'+66636640245';comment:客服whatsapp" json:"Whatsapp" web:"whatsapp"`
Email string `gorm:"column:email;type:varchar(256);default:'rummywallah@gmail.com';comment:客服email" json:"Email" web:"email"` Email string `gorm:"column:email;type:varchar(256);default:'rummywallah@gmail.com';comment:客服email" json:"Email" web:"email"`
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"`
ShareBindReward int64 `gorm:"column:share_bind_reward;type:bigint(20);default:0;comment:分享奖励" json:"ShareBindReward" web:"share_bind_reward"`
} }
func (c *ConfigPlatform) TableName() string { func (c *ConfigPlatform) TableName() string {

@ -202,6 +202,7 @@ type Channel struct {
FBAccessToken string `gorm:"column:fb_accesstoken;type:varchar(256);not null;comment:fb验证码" json:"fb_accesstoken"` FBAccessToken string `gorm:"column:fb_accesstoken;type:varchar(256);not null;comment:fb验证码" json:"fb_accesstoken"`
UP int `gorm:"column:up;type:int(11);default:0;comment:上级渠道" json:"up"` UP int `gorm:"column:up;type:int(11);default:0;comment:上级渠道" json:"up"`
ADUpload int `gorm:"column:ad_upload;type:int(11);default:0;comment:上报事件的平台" json:"ad_upload"` ADUpload int `gorm:"column:ad_upload;type:int(11);default:0;comment:上报事件的平台" json:"ad_upload"`
ShareUrl string `gorm:"column:share_url;type:varchar(256);comment:分享地址;NOT NULL" json:"share_url"`
} }
func (c *Channel) TableName() string { func (c *Channel) 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"
}

@ -36,6 +36,7 @@ const (
ProviderCMD368 ProviderCMD368
ProviderSBO ProviderSBO
ProviderPG2 ProviderPG2
ProviderJiLi2
ProviderAll ProviderAll
) )

@ -34,6 +34,7 @@ import (
) )
func main() { func main() {
log.Info("启动游戏服务器 ...") log.Info("启动游戏服务器 ...")
rand.Seed(time.Now().UTC().UnixNano()) rand.Seed(time.Now().UTC().UnixNano())
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

@ -179,7 +179,11 @@ func WithdrawExamine(c *gin.Context) {
if err != nil { if err != nil {
log.Error(err.Error()) log.Error(err.Error())
} }
call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailWithdrawFail, one.OrderID, one.Amount/common.DecimalDigits)) if one.Extra == "share" {
call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailShareWithdrawFail, one.OrderID, one.Amount/common.DecimalDigits))
} else {
call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailWithdrawFail, one.OrderID, one.Amount/common.DecimalDigits))
}
return return
} }
call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailWithdrawPass, one.OrderID, one.Amount/common.DecimalDigits)) call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailWithdrawPass, one.OrderID, one.Amount/common.DecimalDigits))

@ -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
} }

@ -12,6 +12,7 @@ import (
"server/pb" "server/pb"
"server/util" "server/util"
"sort" "sort"
"strconv"
"strings" "strings"
"time" "time"
@ -773,91 +774,126 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
if !a.S(req) { if !a.S(req) {
return return
} }
now := time.Now()
luckyCode := &common.ActivityLuckyCode{Code: req.LuckyCode, Date: now.Format("20060102")}
if !a.MGet(luckyCode) {
a.Code = values.CodeParam
a.Msg = "आपक दरज कि गयड गलत ह"
return
}
resp := &values.ActivityLuckyCodeDrawResp{} resp := &values.ActivityLuckyCodeDrawResp{}
a.Data = resp a.Data = resp
code, _ := strconv.Atoi(req.LuckyCode)
var reward int64
codeType := luckyCode.Type // 判断是否为分享吗
data := &common.ActivityLuckyCodeData{UID: a.UID} upShareInfo := call.GetShareInfoByCode(req.LuckyCode)
db.Mysql().Get(data) if upShareInfo.ID > 0 {
if (codeType == common.LuckyCodeTypeNormal && util.IsSameDayTimeStamp(now.Unix(), data.LastDraw)) || if upShareInfo.UID == a.UID {
(codeType == common.LuckyCodeTypeVip && util.IsSameDayTimeStamp(now.Unix(), data.LastVipDraw)) { a.Code = values.CodeRetry
a.Code = values.CodeParam a.Msg = "code error"
a.Msg = "इस कड क पहल उपयग कि" return
return
}
// 开始发奖
con := call.GetConfigAcitivityLuckyCode(codeType)
total := call.GetConfigAcitivityLuckyCodeTotalWeight(codeType)
if total == 0 {
log.Error("con:%+v invalid,uid:%d", con, a.UID)
a.Code = values.CodeParam
a.Msg = "रतरण कड ति"
return
}
if data.ID == 0 {
codeData := &common.ActivityLuckyCodeData{UID: a.UID, Type: codeType}
if codeType == common.LuckyCodeTypeNormal {
codeData.LastDraw = now.Unix()
} else if codeType == common.LuckyCodeTypeVip {
codeData.LastVipDraw = now.Unix()
} }
err := db.Mysql().Create(codeData) shareInfo := call.GetShareInfo(a.UID)
if shareInfo.UP1 > 0 {
a.Code = values.CodeRetry
a.Msg = "has binding"
return
}
call.ShareBind(req.LuckyCode, true, a.UID, a.Channel)
reward = call.GetConfigPlatform().ShareBindReward
_, err := call.UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: a.UID,
Type: common.CurrencyINR,
Value: reward,
Event: common.CurrencyEventTask,
Exi1: code,
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
},
})
if err != nil { if err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry a.Code = values.CodeRetry
a.Msg = "code error"
return return
} }
} else { } else {
updates := map[string]interface{}{} now := time.Now()
if codeType == common.LuckyCodeTypeNormal { luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")}
updates["last_draw"] = now.Unix() if !a.MGet(luckyCode) {
} else if codeType == common.LuckyCodeTypeVip { a.Code = values.CodeParam
updates["last_vip_draw"] = now.Unix() a.Msg = "The code you entered is incorrect"
}
rows, err := db.Mysql().UpdateRes(&common.ActivityLuckyCodeData{UID: a.UID, LastDraw: data.LastDraw}, updates)
if rows == 0 || err != nil {
a.Code = values.CodeRetry
return return
} }
}
ran := rand.Int63n(total) codeType := luckyCode.Type
var rans, reward int64 data := &common.ActivityLuckyCodeData{UID: a.UID}
id := 0 db.Mysql().Get(data)
for _, v := range con { if (codeType == common.LuckyCodeTypeNormal && util.IsSameDayTimeStamp(now.Unix(), data.LastDraw)) ||
rans += v.Per (codeType == common.LuckyCodeTypeVip && util.IsSameDayTimeStamp(now.Unix(), data.LastVipDraw)) {
if ran < rans { a.Code = values.CodeParam
id = v.ID a.Msg = "This code has already been used"
reward = v.Reward return
break }
// 开始发奖
con := call.GetConfigAcitivityLuckyCode(codeType)
total := call.GetConfigAcitivityLuckyCodeTotalWeight(codeType)
if total == 0 {
log.Error("con:%+v invalid,uid:%d", con, a.UID)
a.Code = values.CodeParam
a.Msg = "code error"
return
}
if data.ID == 0 {
codeData := &common.ActivityLuckyCodeData{UID: a.UID, Type: codeType}
if codeType == common.LuckyCodeTypeNormal {
codeData.LastDraw = now.Unix()
} else if codeType == common.LuckyCodeTypeVip {
codeData.LastVipDraw = now.Unix()
}
err := db.Mysql().Create(codeData)
if err != nil {
a.Code = values.CodeRetry
return
}
} else {
updates := map[string]interface{}{}
if codeType == common.LuckyCodeTypeNormal {
updates["last_draw"] = now.Unix()
} else if codeType == common.LuckyCodeTypeVip {
updates["last_vip_draw"] = now.Unix()
}
rows, err := db.Mysql().UpdateRes(&common.ActivityLuckyCodeData{UID: a.UID, LastDraw: data.LastDraw}, updates)
if rows == 0 || err != nil {
a.Code = values.CodeRetry
return
}
} }
}
_, err := call.UpdateCurrencyPro(&common.UpdateCurrency{ ran := rand.Int63n(total)
CurrencyBalance: &common.CurrencyBalance{ var rans int64
UID: a.UID, for _, v := range con {
Type: common.CurrencyINR, rans += v.Per
Value: reward, if ran < rans {
Event: common.CurrencyEventTask, reward = v.Reward
Exs1: fmt.Sprintf("%d", codeType), break
Exi1: req.LuckyCode, }
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), }
}, _, err := call.UpdateCurrencyPro(&common.UpdateCurrency{
}) CurrencyBalance: &common.CurrencyBalance{
if err != nil { UID: a.UID,
log.Error("err:%v", err) Type: common.CurrencyINR,
a.Code = values.CodeRetry Value: reward,
a.Msg = "रतरण कड ति" Event: common.CurrencyEventTask,
return Exs1: fmt.Sprintf("%d", codeType),
Exi1: code,
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
},
})
if err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry
a.Msg = "code error"
return
}
call.UploadActivityData(a.UID, common.ActivityIDLuckyCode, common.ActivityDataJoin, reward)
} }
call.UploadActivityData(a.UID, common.ActivityIDLuckyCode, common.ActivityDataJoin, reward)
resp.ID = id resp.Reward = reward
} }
// day 二进制从0位开始,实际签到日期需减1 // day 二进制从0位开始,实际签到日期需减1
@ -1356,6 +1392,7 @@ func ActivityWeekCardInfo(c *gin.Context) {
if resp.Status && resp.RechargeStatus { if resp.Status && resp.RechargeStatus {
call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1) call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1)
} }
call.UploadActivityData(a.UID, common.ActivityIDSign, common.ActivityDataClick, 0)
} }
func ActivityWeekCardDraw(c *gin.Context) { func ActivityWeekCardDraw(c *gin.Context) {
@ -1481,7 +1518,7 @@ func ActivityWeekCardDraw(c *gin.Context) {
}) })
} }
call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 0) call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 0)
call.UploadActivityData(a.UID, common.ActivityIDSign, common.ActivityDataJoin, reward)
} }
func ActivitySlotsInfo(c *gin.Context) { func ActivitySlotsInfo(c *gin.Context) {

@ -82,16 +82,26 @@ func EnterGame(c *gin.Context) {
} }
a.Data = resp a.Data = resp
// step:特殊逻辑处理 // step:特殊逻辑处理
// if req.Provider == common.ProviderPGSoft { providerId := 0
// a.Code = values.CodeParam if req.Provider == common.ProviderPGSoft {
// a.Msg = "Under Maintenance,please try later." providerId = common.ProviderPG2
// provider = call.GetConfigGameProvider(common.ProviderPG2) }
// game := call.GetConfigGameListByID(common.ProviderPG2, req.GameID) if req.Provider == common.ProviderJili {
// if game != nil && game.Open == 1 && rand.Intn(100) < 100 { providerId = common.ProviderJiLi2
// req.Provider = common.ProviderPG2 }
// resp.Method = provider.Method if providerId > 0 {
// } provider = call.GetConfigGameProvider(providerId)
// } game := call.GetConfigGameListByID(providerId, req.GameID)
if game != nil && game.Open == 1 {
req.Provider = providerId
resp.Method = provider.Method
} else {
a.Code = values.CodeParam
a.Msg = "Under Maintenance,please try later."
return
}
}
if req.IsDemo { if req.IsDemo {
log.Debug("player enter demo game %+v", *req) log.Debug("player enter demo game %+v", *req)
enter := &base.EnterGameReq{ enter := &base.EnterGameReq{

@ -40,7 +40,7 @@ func RechargeInfo(c *gin.Context) {
defer func() { defer func() {
a.Response() a.Response()
}() }()
list := call.GetConfigPayProduct() list := call.GetConfigPayProductByActivityID(0)
resp := &values.RechargeInfoResp{Tips: call.GetConfigPlatform().PayTips, SelectID: config.GetConfig().Web.SelectID} resp := &values.RechargeInfoResp{Tips: call.GetConfigPlatform().PayTips, SelectID: config.GetConfig().Web.SelectID}
a.Data = resp a.Data = resp
resp.Channels = call.GetConfigPayChannels() resp.Channels = call.GetConfigPayChannels()

@ -84,13 +84,14 @@ func ShareInfo(c *gin.Context) {
} }
channel := call.GetChannelByID(a.Channel) channel := call.GetChannelByID(a.Channel)
if channel != nil { if channel != nil {
resp.ShareLink += channel.URL + "?code=" + "xxxxxx" // resp.ShareLink += channel.URL + "?code=" + "xxxxxx"
if a.Prefix != "" { // if a.Prefix != "" {
resp.ShareLink = a.Prefix + "." + resp.ShareLink // resp.ShareLink = a.Prefix + "." + resp.ShareLink
} else { // } else {
resp.ShareLink = "www." + resp.ShareLink // resp.ShareLink = "www." + resp.ShareLink
} // }
resp.ShareLink = "https://" + resp.ShareLink // resp.ShareLink = "https://" + resp.ShareLink
resp.ShareLink = channel.ShareUrl
} }
a.GetUID() a.GetUID()
if a.UID <= 0 { if a.UID <= 0 {
@ -105,20 +106,21 @@ func ShareInfo(c *gin.Context) {
resp.AvailableReward = shareInfo.AvailableReward resp.AvailableReward = shareInfo.AvailableReward
resp.RechargeCount = call.GetUserShareRecharges(a.UID, 1) resp.RechargeCount = call.GetUserShareRecharges(a.UID, 1)
resp.TotalRecharge = call.GetUserShareRechargeAmount(a.UID, 1) resp.TotalRecharge = call.GetUserShareRechargeAmount(a.UID, 1)
if channel != nil { resp.ShareCode = shareInfo.Share
num := 10000 // if channel != nil {
channelId := channel.ChannelID // num := 10000
if channel.ChannelID < num { // channelId := channel.ChannelID
channelId += num // if channel.ChannelID < num {
} // channelId += num
resp.ShareLink = channel.URL + "?code=" + shareInfo.Share + "&ch=" + fmt.Sprintf("%d", channelId) // }
if a.Prefix != "" { // resp.ShareLink = channel.URL + "?code=" + shareInfo.Share + "&ch=" + fmt.Sprintf("%d", channelId)
resp.ShareLink = a.Prefix + "." + resp.ShareLink // if a.Prefix != "" {
} else { // resp.ShareLink = a.Prefix + "." + resp.ShareLink
resp.ShareLink = "www." + resp.ShareLink // } else {
} // resp.ShareLink = "www." + resp.ShareLink
resp.ShareLink = "https://" + resp.ShareLink // }
} // resp.ShareLink = "https://" + resp.ShareLink
// }
num := 0 num := 0
if resp.AvailableReward > 0 { if resp.AvailableReward > 0 {
num = 1 num = 1
@ -297,6 +299,7 @@ func ShareWithdraw(c *gin.Context) {
OrderID: orderID, OrderID: orderID,
APIPayID: "", APIPayID: "",
// ProductID: one.ID, // ProductID: one.ID,
Extra: "share",
CreateTime: time.Now().Unix(), CreateTime: time.Now().Unix(),
Amount: realAmount, Amount: realAmount,
WithdrawCash: req.Amount, WithdrawCash: req.Amount,

@ -102,6 +102,7 @@ func GetUserInfo(c *gin.Context) {
util.Go(func() { util.Go(func() {
CheckRedPoint(uid, c) CheckRedPoint(uid, c)
}) })
} }
func EditUserInfo(c *gin.Context) { func EditUserInfo(c *gin.Context) {

@ -465,14 +465,14 @@ func NewWithdraw(req *values.WithdrawReq, uid int, ip string, uuid string) (stri
if pi.BankCardNo != one.BankCardNo { if pi.BankCardNo != one.BankCardNo {
sql := fmt.Sprintf("bank_card_no = '%v'", one.BankCardNo) sql := fmt.Sprintf("bank_card_no = '%v'", one.BankCardNo)
if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) { if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) {
return "", values.CodeBankCardNoLimit return "Bank card error", values.CodeBankCardNoLimit
} }
} }
} else if one.PayType == common.PayTypeUPI { // UPI } else if one.PayType == common.PayTypeUPI { // UPI
if pi.BankCode != one.BankCode { if pi.BankCode != one.BankCode {
sql := fmt.Sprintf("bank_code = '%v'", one.BankCode) sql := fmt.Sprintf("bank_code = '%v'", one.BankCode)
if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) { if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) {
return "", values.CodeBankCardNoLimit return "Bank card error", values.CodeBankCardNoLimit
} }
} }
} }

@ -37,17 +37,18 @@ func (w *Web) GetType() string {
// 很关键,需要与配置文件中的Module配置对应 // 很关键,需要与配置文件中的Module配置对应
return "web" return "web"
} }
func (w *Web) Version() string { func (w *Web) Version() string {
// 可以在监控时了解代码版本 // 可以在监控时了解代码版本
return "1.0.0" return "1.0.0"
} }
func (w *Web) OnInit(app module.App, settings *conf.ModuleSettings) { func (w *Web) OnInit(app module.App, settings *conf.ModuleSettings) {
w.BaseModule.OnInit(w, app, settings) w.BaseModule.OnInit(w, app, settings)
db.InitDB(&rdb.RedisClient{}, &edb.EsClient{}, &mdb.MysqlClient{}) db.InitDB(&rdb.RedisClient{}, &edb.EsClient{}, &mdb.MysqlClient{})
log.Info("[%v]module init finish, config:%+v", w.GetType(), config.GetConfig().Web) log.Info("[%v]module init finish, config:%+v", w.GetType(), config.GetConfig().Web)
log.Info("[%v]module init finish, base:%+v", w.GetType(), config.GetBase()) log.Info("[%v]module init finish, base:%+v", w.GetType(), config.GetBase())
// 自动初始化数据库 // 自动初始化数据库
// MigrateDB() // MigrateDB()
call.NewCaller(w) call.NewCaller(w)

@ -7,6 +7,7 @@ import (
"server/db" "server/db"
"server/modules/web/providers/base" "server/modules/web/providers/base"
"server/modules/web/providers/gs" "server/modules/web/providers/gs"
"server/modules/web/providers/jili2"
"server/modules/web/providers/pg2" "server/modules/web/providers/pg2"
"server/modules/web/providers/pgsoft" "server/modules/web/providers/pgsoft"
"server/modules/web/providers/tada" "server/modules/web/providers/tada"
@ -49,6 +50,7 @@ type AllProvider struct {
CMD368 func(b *base.Base) CMD368 func(b *base.Base)
SBO func(b *base.Base) SBO func(b *base.Base)
PG2 func(b *base.Base) PG2 func(b *base.Base)
Jili2 func(b *base.Base)
} }
var All = &AllProvider{} var All = &AllProvider{}
@ -90,6 +92,7 @@ func initAll() {
All.CMD368 = gs.NewSub All.CMD368 = gs.NewSub
All.SBO = gs.NewSub All.SBO = gs.NewSub
All.PG2 = pg2.NewSub All.PG2 = pg2.NewSub
All.Jili2 = jili2.NewSub
} }
func InitRouter(r *gin.RouterGroup) { func InitRouter(r *gin.RouterGroup) {

@ -1,6 +1,7 @@
package base package base
import ( import (
"errors"
"fmt" "fmt"
"server/call" "server/call"
"server/common" "server/common"
@ -366,33 +367,36 @@ func SessionBet(req *BetReq) (resp BetResp) {
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }
pro := call.MineCurrencyProReal( if betAmount > 0 {
&common.UpdateCurrency{ pro := call.MineCurrencyProReal(
CurrencyBalance: &common.CurrencyBalance{ &common.UpdateCurrency{
UID: uid, CurrencyBalance: &common.CurrencyBalance{
Type: ct, UID: uid,
Event: common.CurrencyEventGameBet, Type: ct,
Value: -betAmount, Event: common.CurrencyEventGameBet,
Exi1: req.Provider.ProviderID, Value: -betAmount,
Exi2: req.GameID, Exi1: req.Provider.ProviderID,
Exs1: fmt.Sprintf("%d", uuid), Exi2: req.GameID,
Exs2: req.BetID, Exs1: fmt.Sprintf("%d", uuid),
Exs3: req.SessionID, Exs2: req.BetID,
Exs3: req.SessionID,
},
}, },
}, )
) 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 errors.Is(pro.Err, call.ErrNotEnoughBalance) {
if pro.Err == call.ErrNotEnoughBalance { resp.Code = CodeNotEnoughAmount
resp.Code = CodeNotEnoughAmount }
}
if req.SessionType == SessionTypeBet {
resp.Balance = pro.Balance
resp.MyUUID = uuid
return
} }
} }
if req.SessionType == SessionTypeBet { var pro *call.ProRes
resp.Balance = pro.Balance
resp.MyUUID = uuid
return
}
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),
}) })
}) })
resp.Balance = pro.Balance if pro != nil {
resp.Balance = pro.Balance
} else {
resp.Balance = call.GetUserCurrency(uid, ct)
}
resp.MyUUID = uuid resp.MyUUID = uuid
return return
} }

@ -0,0 +1,145 @@
package jili2
import (
"fmt"
"server/common"
"server/db"
"server/util"
"strconv"
"time"
)
const (
ErrCodeSuccess = 0
ErrCodePlayerNotFound = 2000 // 玩家不存在
ErrCodePlayerToken = 2001 // Token错误
ErrCodeInvalidGameID = 102 // 无效的GameDI
ErrCodeInternalError = 3000 // 内部错误
ErrCodeInsufficientBal = 2010 // 投注失败,如余额不足
)
type GameListResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data GameListData `json:"data"`
}
type GameListData struct {
GameList []GameListItem `json:"glist"`
}
type GameListItem struct {
Icon string `json:"icon"`
MapID string `json:"mapid"`
Name string `json:"name"`
Site string `json:"site"`
GameID string `json:"gameid"`
}
// EnterGameRequest 进入游戏
type EnterGameRequest struct {
Uname string `json:"uname"`
GameID string `json:"gameid"`
Token string `json:"token,omitempty"`
Lang string `json:"lang,omitempty"`
Nick string `json:"nick,omitempty"`
RtpPool int `json:"rtp_pool"`
}
type EnterGameResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
GameURL string `json:"gameurl"`
} `json:"data"`
}
// PlaceBetRequest 下注
type PlaceBetRequest struct {
Uname string `json:"uname"`
Token string `json:"token"`
BetID string `json:"betid"`
SessionID string `json:"sessionid"`
GameID string `json:"gameid"`
Bet float64 `json:"bet"`
Award float64 `json:"award"`
IsEndRound bool `json:"is_end_round"`
Ctime int64 `json:"ctime"`
}
type PlaceBetResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Uname string `json:"uname"`
BetID string `json:"betid"`
Balance float64 `json:"balance"`
} `json:"data"`
}
type VerifySessionReq struct {
Uname string `json:"uname"`
Token string `json:"token"`
}
type VerifySessionResp struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Uname string `json:"uname"`
Balance float64 `json:"balance"`
} `json:"data"`
}
type GetBalanceRequest struct {
GameId string `json:"gameid"`
Uname string `json:"uname"`
}
type GetBalanceResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Uname string `json:"uname"`
Balance float64 `json:"balance"`
} `json:"data"`
}
func GetGameList() {
API = APITest
AgentMap = AgentMapTest
url := fmt.Sprintf("%s/api/game/loadlist", APITest)
mchid := AgentMap.MchId
key := AgentMap.Key
timestamp := time.Now().Unix()
headers := map[string]string{
"X-Atgame-Mchid": mchid,
"X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10),
"Content-Type": "application/json;charset=UTF-8",
}
type empty struct{}
var e empty
// Generate sign
emptyBody := "{}"
sign := GenerateSign(emptyBody, timestamp, key)
headers["X-Atgame-Sign"] = sign
var response GameListResponse
err := util.HttpPost(url, e, &response, headers)
if err != nil {
return
}
var gameList []*common.ConfigGameList
for _, item := range response.Data.GameList {
id, _ := strconv.Atoi(item.MapID)
gameList = append(gameList, &common.ConfigGameList{
GameProvider: common.ProviderJiLi2,
GameID: id,
GameCode: item.GameID,
Icon: item.Icon,
Name: item.Name,
})
}
db.Mysql().Create(gameList)
}

@ -0,0 +1,75 @@
package jili2
import (
"encoding/json"
"fmt"
"server/call"
"server/config"
"server/modules/web/providers/base"
utils "server/util"
"strconv"
"time"
"github.com/liangdas/mqant/log"
)
type Sub struct {
Base *base.Base
}
func NewSub(base *base.Base) {
base.Sub = &Sub{Base: base}
base.SubInitRouter = JiLi
}
func (s *Sub) Init() {
API = APITest
AgentMap = AgentMapTest
if config.GetBase().Release {
API = APIRlease
AgentMap = AgentMapRelease
}
}
func (s *Sub) EnterGame() string {
url := fmt.Sprintf("%s/api/usr/ingame", API)
timestamp := time.Now().Unix()
uid := s.Base.EnterGameReq.UID
token := s.Base.EnterGameReq.Token
providerID := s.Base.EnterGameReq.ProviderID
gameID := s.Base.EnterGameReq.GameID
mchid := AgentMap.MchId
key := AgentMap.Key
rtp := call.GetRtpControl(uid)
log.Info("uid:%v,rtp:%v", uid, rtp)
headers := map[string]string{
"X-Atgame-Mchid": mchid,
"X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10),
"Content-Type": "application/json;charset=UTF-8",
}
// Generate sign
game := call.GetConfigGameListByID(providerID, gameID)
if game == nil {
return ""
}
request := EnterGameRequest{
Uname: fmt.Sprintf("%d", uid),
GameID: game.GameCode,
Token: token,
Lang: Lang,
Nick: "",
RtpPool: rtp,
}
body, _ := json.Marshal(request)
sign := GenerateSign(string(body), timestamp, key)
headers["X-Atgame-Sign"] = sign
// Decode response
var response EnterGameResponse
err := utils.HttpPost(url, request, &response, headers)
if err != nil {
log.Error("err:%v", err)
return ""
}
return response.Data.GameURL
}

@ -0,0 +1,147 @@
package jili2
import (
"server/call"
"server/common"
"server/db"
"server/modules/web/app"
"server/modules/web/providers/base"
"server/util"
"strconv"
"time"
"github.com/gin-gonic/gin"
"github.com/liangdas/mqant/log"
)
func JiLi(e *gin.RouterGroup) {
e.POST("/VerifySession", VerifySession)
e.POST("/Cash/Get", GetPlayerBalance)
e.POST("/Cash/Bet", PlaceBet)
}
func GetGameID(providerID int, gameCode string) int {
game := call.GetConfigGameListByCode(providerID, gameCode)
if game != nil {
return game.GameID
}
return 0
}
func VerifySession(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.ResponseB()
}()
req := &VerifySessionReq{}
resp := &VerifySessionResp{}
a.RetData = resp
if !a.SB(req) {
resp.Code = ErrCodeInternalError
return
}
log.Debug("VerifySession req:%+v", req)
uid, err := strconv.Atoi(req.Uname)
if err != nil {
log.Error("err:%v", err)
resp.Code = ErrCodePlayerNotFound
return
}
currency, err := db.Redis().GetInt(common.GetRedisKeyGameCurrency(uid))
if err != nil {
log.Error("err:%v", err)
resp.Code = ErrCodeInternalError
return
}
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
a.Data = resp
}
func GetPlayerBalance(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.ResponseB()
}()
req := &GetBalanceRequest{}
resp := &GetBalanceResponse{}
a.RetData = resp
if !a.SB(req) {
resp.Code = ErrCodeInternalError
return
}
log.Debug("GetPlayerBalance req:%+v", req)
uid, err := strconv.Atoi(req.Uname)
if err != nil {
log.Error("err:%v", err)
resp.Code = ErrCodePlayerNotFound
return
}
currency, err := db.Redis().GetInt(common.GetRedisKeyGameCurrency(uid))
if err != nil {
log.Error("err:%v", err)
resp.Code = ErrCodeInternalError
return
}
resp.Data.Uname = req.Uname
resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2)
a.Data = resp
}
func PlaceBet(c *gin.Context) {
a := app.NewApp(c)
defer func() {
a.ResponseB()
}()
req := &PlaceBetRequest{}
resp := &PlaceBetResponse{}
a.RetData = resp
if !a.SB(req) {
resp.Code = ErrCodeInternalError
return
}
log.Debug("PlaceBet:%+v", req)
// 验证token
uid, _ := db.Redis().GetInt(common.GetRedisKeyToken(req.Token))
if uid == 0 {
resp.Code = ErrCodePlayerNotFound
return
}
provider := call.GetConfigGameProvider(common.ProviderJiLi2)
now := time.Now().Unix()
if req.Bet != 0 || req.Award != 0 {
betReq := &base.BetReq{
UID: uid,
CurrencyType: common.CurrencyINR,
BetAmount: int64(req.Bet * common.DecimalDigits),
TurnOver: int64(req.Bet * common.DecimalDigits),
SettleAmount: int64(req.Award * common.DecimalDigits),
SessionType: common.SessionTypeSettle,
GameID: GetGameID(common.ProviderPG2, req.GameID),
GameName: req.GameID,
Provider: provider,
BetID: req.BetID,
SessionID: req.SessionID,
Time: now,
}
betResp := base.SessionBet(betReq)
if betResp.Code != base.CodeOk {
resp.Code = ErrCodeInternalError
if betResp.Code == base.CodeAccepted {
resp.Code = ErrCodeInternalError
} else if betResp.Code == base.CodeNotEnoughAmount {
resp.Code = ErrCodeInsufficientBal
}
return
}
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
}

@ -0,0 +1,14 @@
package jili2
import (
"crypto/md5"
"encoding/hex"
"strconv"
"strings"
)
func GenerateSign(body string, timestamp int64, key string) string {
data := body + strconv.FormatInt(timestamp, 10) + key
hash := md5.Sum([]byte(data))
return strings.ToUpper(hex.EncodeToString(hash[:]))
}

@ -0,0 +1,24 @@
package jili2
const (
APIRlease = "https://openapi-br.atgameapp.com/pub"
APITest = "https://api.jgameworks.com"
LaunchGameURL = "/api/usr/ingame"
GetGameListURL = "/api/game/loadlist"
Lang = "en"
)
type Agent struct {
MchId string `json:"mch_id"`
Key string `json:"key"`
}
var (
API = ""
AgentMap Agent
AgentMapTest = Agent{
MchId: "10017",
Key: "C54E411A1B89C54BFB977EBAA7BB1D39",
}
AgentMapRelease = Agent{}
)

@ -38,11 +38,12 @@ type GameListItem struct {
// EnterGameRequest 进入游戏 // EnterGameRequest 进入游戏
type EnterGameRequest struct { type EnterGameRequest struct {
Uname string `json:"uname"` Uname string `json:"uname"`
GameID string `json:"gameid"` GameID string `json:"gameid"`
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 {
@ -108,8 +109,8 @@ func GetGameList() {
API = APITest API = APITest
AgentMap = AgentMapTest AgentMap = AgentMapTest
url := fmt.Sprintf("%s/api/game/loadlist", APITest) url := fmt.Sprintf("%s/api/game/loadlist", APITest)
mchid := "" mchid := AgentMap.MchId
key := "" key := AgentMap.Key
timestamp := time.Now().Unix() timestamp := time.Now().Unix()
headers := map[string]string{ headers := map[string]string{
"X-Atgame-Mchid": mchid, "X-Atgame-Mchid": mchid,

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"server/call" "server/call"
"server/common"
"server/config" "server/config"
"server/modules/web/providers/base" "server/modules/web/providers/base"
utils "server/util" utils "server/util"
@ -39,29 +38,10 @@ func (s *Sub) EnterGame() string {
token := s.Base.EnterGameReq.Token token := s.Base.EnterGameReq.Token
providerID := s.Base.EnterGameReq.ProviderID providerID := s.Base.EnterGameReq.ProviderID
gameID := s.Base.EnterGameReq.GameID gameID := s.Base.EnterGameReq.GameID
/** mchid := AgentMap.MchId
玩家再次点击游戏根据玩家盈利倍数盈利倍数=玩家余额+已提现金额/玩家总充值金额调取假PG不同档位的接口 key := AgentMap.Key
1盈利倍数1进入90%档位 rtp := call.GetRtpControl(uid)
2盈利倍数1-7进入80%档位 log.Info("uid:%v,rtp:%v", uid, rtp)
3盈利倍数7-10进入60%档位
4盈利倍数10进入30%档位
*/
rechargeInfo := call.GetRechargeInfo(uid)
cash := call.GetUserCurrency(uid, common.CurrencyINR)
earnBet := (rechargeInfo.TotalWithdraw + cash) / rechargeInfo.TotalRecharge
log.Info("uid:%d,earnBet:%d", uid, earnBet)
mchid := ""
key := ""
if earnBet <= 7 {
mchid = AgentMap[80].MchId
key = AgentMap[80].Key
} else if earnBet <= 10 {
mchid = AgentMap[60].MchId
key = AgentMap[60].Key
} else {
mchid = AgentMap[30].MchId
key = AgentMap[30].Key
}
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),
@ -73,11 +53,12 @@ func (s *Sub) EnterGame() string {
return "" return ""
} }
request := EnterGameRequest{ request := EnterGameRequest{
Uname: fmt.Sprintf("%d", uid), Uname: fmt.Sprintf("%d", uid),
GameID: game.GameCode, GameID: game.GameCode,
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,31 +113,35 @@ func PlaceBet(c *gin.Context) {
provider := call.GetConfigGameProvider(common.ProviderPG2) provider := call.GetConfigGameProvider(common.ProviderPG2)
now := time.Now().Unix() now := time.Now().Unix()
betReq := &base.BetReq{ if req.Bet != 0 || req.Award != 0 {
UID: uid, betReq := &base.BetReq{
CurrencyType: common.CurrencyINR, UID: uid,
BetAmount: int64(req.Bet * common.DecimalDigits), CurrencyType: common.CurrencyINR,
TurnOver: int64(req.Bet * common.DecimalDigits), BetAmount: int64(req.Bet * common.DecimalDigits),
SettleAmount: int64(req.Award * common.DecimalDigits), TurnOver: int64(req.Bet * common.DecimalDigits),
SessionType: common.SessionTypeSettle, SettleAmount: int64(req.Award * common.DecimalDigits),
GameID: GetGameID(common.ProviderPG2, req.GameID), SessionType: common.SessionTypeSettle,
GameName: req.GameID, GameID: GetGameID(common.ProviderPG2, req.GameID),
Provider: provider, GameName: req.GameID,
BetID: req.BetID, Provider: provider,
SessionID: req.SessionID, BetID: req.BetID,
Time: now, SessionID: req.SessionID,
} Time: now,
betResp := base.SessionBet(betReq) }
if betResp.Code != base.CodeOk { betResp := base.SessionBet(betReq)
resp.Code = ErrCodeInternalError if betResp.Code != base.CodeOk {
if betResp.Code == base.CodeAccepted {
resp.Code = ErrCodeInternalError resp.Code = ErrCodeInternalError
} else if betResp.Code == base.CodeNotEnoughAmount { if betResp.Code == base.CodeAccepted {
resp.Code = ErrCodeInsufficientBal resp.Code = ErrCodeInternalError
} else if betResp.Code == base.CodeNotEnoughAmount {
resp.Code = ErrCodeInsufficientBal
}
return
} }
return 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)
} }
resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2)
a.Data = resp a.Data = resp
} }

@ -5,7 +5,7 @@ const (
APITest = "https://openapi.windygame.net/demo" APITest = "https://openapi.windygame.net/demo"
LaunchGameURL = "/api/usr/ingame" LaunchGameURL = "/api/usr/ingame"
GetGameListURL = "/api/game/loadlist" GetGameListURL = "/api/game/loadlist"
Lang = "pt" Lang = "en"
) )
type Agent struct { type Agent struct {
@ -15,41 +15,10 @@ type Agent struct {
var ( var (
API = "" API = ""
AgentMap map[int]Agent AgentMap Agent
AgentMapTest = map[int]Agent{ AgentMapTest = Agent{
90: { "10071",
"10055", "E3D1A83FA82F04D9725ACB5A77578A65",
"170779CCC5E9FE29DBB3F5FEDBB304A0",
},
80: {
"10055",
"170779CCC5E9FE29DBB3F5FEDBB304A0",
},
60: {
"10055",
"170779CCC5E9FE29DBB3F5FEDBB304A0",
},
30: {
"10055",
"170779CCC5E9FE29DBB3F5FEDBB304A0",
},
}
AgentMapRelease = map[int]Agent{
90: {
"10270",
"ECFEF01A0842C8F7BC9A4EFC089D7E6D",
},
80: {
"10269",
"0A18B714E125D9C99ABC41E7124D1B15",
},
60: {
"10268",
"AC846D0F6C83C2F65A7B07AB530DB978",
},
30: {
"10267",
"30C9928DC1240B507889D4768A186139",
},
} }
AgentMapRelease = Agent{}
) )

@ -81,12 +81,12 @@ type ActivityLuckyCodeInfoReq struct {
// Type 类型,预留用于后续其他活动兑换码 // Type 类型,预留用于后续其他活动兑换码
type ActivityLuckyCodeDrawReq struct { type ActivityLuckyCodeDrawReq struct {
Type int Type int
LuckyCode int `json:"LuckyCode" binding:"required"` LuckyCode string `json:"LuckyCode" binding:"required"`
} }
// ID 奖品id // ID 奖品id
type ActivityLuckyCodeDrawResp struct { type ActivityLuckyCodeDrawResp struct {
ID int Reward int64
} }
// Sign 玩家签到情况数据 二进制 如第一天签了,第二天没签,第三天签了,第四天签了 就是1101 // Sign 玩家签到情况数据 二进制 如第一天签了,第二天没签,第三天签了,第四天签了 就是1101

@ -29,6 +29,7 @@ type ShareInfoResp struct {
PlatformTotalReward int64 PlatformTotalReward int64
Rank []*OneShareRank Rank []*OneShareRank
Msg string // 后台配置消息 Msg string // 后台配置消息
ShareCode string
} }
type SharePlatformResp struct { type SharePlatformResp struct {
@ -202,3 +203,7 @@ type GetActivityCodeReq struct {
type GetActivityCodeResp struct { type GetActivityCodeResp struct {
ShareLink string ShareLink string
} }
type ShareCodeBindReq struct {
Code string
}

@ -28,7 +28,7 @@ message InnerBroadcast {
int32 ID = 1; int32 ID = 1;
string Content = 2; string Content = 2;
int32 Priority = 3; int32 Priority = 3;
int32 Frequency = 4; int32 Frequency = 4;
int32 Interval = 5; int32 Interval = 5;
} }

@ -132,9 +132,9 @@ message PlayerBalanceResp{
} }
message BroadcastMsg{ message BroadcastMsg{
string Content = 1; string Content = 1; //
uint32 Priority = 2; uint32 Priority = 2; //
int64 Loop = 3; // int64 Loop = 3; //
int64 Interval = 4; // int64 Interval = 4; //
} }

Loading…
Cancel
Save