From 89adb1779f1e80b3b9348d5d9c7994a791b3b78d Mon Sep 17 00:00:00 2001 From: mofangmin Date: Wed, 11 Sep 2024 10:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/pay.go | 6 ++--- call/user.go | 11 +++++---- cmd/build.sh | 4 ++-- common/activity.go | 22 +++++++++--------- common/config.go | 1 + common/currency.go | 1 + common/redis_keys.go | 5 ++++ .../backend/handler/guser/getGameUserInfo.go | 4 +++- modules/web/handler/activity.go | 23 +++++++++++-------- modules/web/handler/game.go | 4 ---- modules/web/providers/jili2/base.go | 3 +++ modules/web/providers/jili2/handler.go | 1 + modules/web/providers/jili2/values.go | 10 +++++--- modules/web/providers/pg2/base.go | 3 +++ modules/web/providers/pg2/handler.go | 2 ++ modules/web/providers/pg2/values.go | 7 ++++-- 16 files changed, 67 insertions(+), 40 deletions(-) diff --git a/call/pay.go b/call/pay.go index d53f384..a6c3e93 100644 --- a/call/pay.go +++ b/call/pay.go @@ -84,7 +84,7 @@ func Withdraw(data *pb.InnerWithdrawReq) (*pb.InnerWithdrawResp, error) { // CheckUserBet 检测玩家余额 func CheckUserBet(uid int, t common.CurrencyType) { cash := GetUserCurrency(uid, t) - if cash < config.GetConfig().Web.BreakLimit { + if cash < GetConfigPlatform().MiniAmount { _, err := db.Mysql().UpdateRes(&common.PlayerProfile{UID: uid}, map[string]interface{}{"need_bet": 0}) if err != nil { log.Error("err:%v", err) @@ -232,7 +232,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s if r.ProductID == 0 { ticket := GetConfigDiscountTicketByAmount(discountOriginAmount) log.Info("ticket:%v", ticket) - if ticket.Id > 0 { + if ticket.ID > 0 { // 赠送优惠券 tickets := GetConfigDiscountTicket() sort.Slice(tickets, func(i, j int) bool { @@ -257,7 +257,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s if val < ticket.CurProb { AddUserDiscountTicket(uid, ticket.DiscountAmount, ticket.RechargeAmount, -1, 0, true) SendMailWithContent(uid, SystemTitle, fmt.Sprintf(EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) - } else if nextTicket.Id > 0 { + } else if nextTicket.ID > 0 { AddUserDiscountTicket(uid, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, true) SendMailWithContent(uid, SystemTitle, fmt.Sprintf(EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) } diff --git a/call/user.go b/call/user.go index 94df911..e109caf 100644 --- a/call/user.go +++ b/call/user.go @@ -800,12 +800,13 @@ func GetRtpControl(uid int) int { // 2.个控 // 3.大盘 rtp := GetConfigPlatform().Rtp - if rtpData.Id > 0 { + if rtpData.Id > 0 && rtpData.Rtp > 0 { rtp = rtpData.Rtp - } - if rtp > 0 && rtpConf.Id > 0 { - if withdrawRechargePer >= int64(rtpConf.EnterPer) && withdrawRechargePer <= int64(rtpConf.ExitPer) { - rtp = rtpConf.Rtp + } else { + if rtpConf.ID > 0 { + if withdrawRechargePer >= int64(rtpConf.EnterPer) && withdrawRechargePer <= int64(rtpConf.ExitPer) { + rtp = rtpConf.Rtp + } } } return rtp diff --git a/cmd/build.sh b/cmd/build.sh index 037ba5e..a34264c 100644 --- a/cmd/build.sh +++ b/cmd/build.sh @@ -8,5 +8,5 @@ cd pb/proto # go generate cd ../.. #go build main.go -CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o indiaprovider main.go -#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gameserver main.go \ No newline at end of file +#CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o indiaprovider main.go +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gameserver main.go \ No newline at end of file diff --git a/common/activity.go b/common/activity.go index b1af671..a778638 100644 --- a/common/activity.go +++ b/common/activity.go @@ -551,11 +551,11 @@ func (m *ConfigActivityPopup) TableName() string { } type ConfigDiscountTicket struct { - Id int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key" json:"id"` - RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20)" json:"recharge_amount"` - DiscountAmount int64 `gorm:"column:discount_amount;type:bigint(20)" json:"discount_amount"` - CurProb int `gorm:"column:cur_prob;type:int(11)" json:"cur_prob"` - NextProb int `gorm:"column:next_prob;type:int(11)" json:"next_prob"` + ID int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key" json:"id"` + RechargeAmount int64 `gorm:"column:recharge_amount;type:bigint(20)" web:"recharge_amount"` + DiscountAmount int64 `gorm:"column:discount_amount;type:bigint(20)" web:"discount_amount"` + CurProb int `gorm:"column:cur_prob;type:int(11)" web:"cur_prob"` + NextProb int `gorm:"column:next_prob;type:int(11)" web:"next_prob"` } func (m *ConfigDiscountTicket) TableName() string { @@ -563,12 +563,12 @@ func (m *ConfigDiscountTicket) TableName() string { } 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"` + ID int `gorm:"column:id;type:int(11) AUTO_INCREMENT;primary_key"` + MinRecharge int64 `gorm:"column:min_recharge;type:bigint(20);comment:最小充值" web:"min_recharge"` + MaxRecharge int64 `gorm:"column:max_recharge;type:bigint(20);comment:最小充值" web:"max_recharge"` + Rtp int `gorm:"column:rtp;type:int(11);comment:rtp" json:"rtp" web:"rtp"` + EnterPer int `gorm:"column:enter_per;type:int(11);comment:进入提存比" web:"enter_per"` + ExitPer int `gorm:"column:exit_per;type:int(11);comment:退出提存比" web:"exit_per"` } func (m *ConfigRtp) TableName() string { diff --git a/common/config.go b/common/config.go index b0b79a1..00f1aa6 100644 --- a/common/config.go +++ b/common/config.go @@ -180,6 +180,7 @@ type ConfigPlatform struct { 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"` + MiniAmount int64 `gorm:"column:mini_amount;type:bigint(20);default:0;comment:小于这个金额就充值" json:"MiniAmount" web:"mini_amount"` } func (c *ConfigPlatform) TableName() string { diff --git a/common/currency.go b/common/currency.go index cbe2a02..a8a2142 100644 --- a/common/currency.go +++ b/common/currency.go @@ -100,6 +100,7 @@ const ( CurrencyEventActivitySlots // slots奖池 CurrencyEventActivitySuper // 超级1+2 CurrencyEventActivityBetDraw // 下注抽奖 + CurrencyEventActivityShareBind // 分享绑定 CurrencyEventAll CurrencyEventGM = 1000 // 后台修改货币 diff --git a/common/redis_keys.go b/common/redis_keys.go index 699edb0..7f0d7cf 100644 --- a/common/redis_keys.go +++ b/common/redis_keys.go @@ -45,6 +45,7 @@ const ( // RedisKeyPlayerPay = "playerPay" // 玩家10分钟内付费拉起的渠道记录 RedisKeyPlayerPayInterval = "playerPayInterval" // 玩家拉单间隔限制 RedisKeyGameCurrency = "gameCurrency" // 玩家进入游戏时选择的币种 + RedisKeyPlayerRTP = "playerRtp" ) const ( @@ -189,3 +190,7 @@ func GetBackendReviewKey(date string, channel *int) string { } return ret } + +func GetRedisKeyPlayerRtp(uid int) string { + return fmt.Sprintf("%v:%v", RedisKeyPlayerRTP, uid) +} diff --git a/modules/backend/handler/guser/getGameUserInfo.go b/modules/backend/handler/guser/getGameUserInfo.go index f8437e9..06bf0a5 100644 --- a/modules/backend/handler/guser/getGameUserInfo.go +++ b/modules/backend/handler/guser/getGameUserInfo.go @@ -96,8 +96,10 @@ func GetGameUserInfo(c *gin.Context) { rtp := call.GetUserRtp(uid) if rtp.Id == 0 { db.Mysql().Create(rtp) + rtp.Rtp, _ = db.Redis().GetInt(common.GetRedisKeyPlayerRtp(uid)) + } else { + resp.Rtp = rtp.Rtp } - resp.Rtp = rtp.Rtp // resp.RechargeUsdt = usdtInfo.TotalRecharge // resp.WithdrawUsdt = usdtInfo.TotoalWithdraw diff --git a/modules/web/handler/activity.go b/modules/web/handler/activity.go index 4bd434c..70b2e34 100644 --- a/modules/web/handler/activity.go +++ b/modules/web/handler/activity.go @@ -776,7 +776,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) { } resp := &values.ActivityLuckyCodeDrawResp{} a.Data = resp - code, _ := strconv.Atoi(req.LuckyCode) + var reward int64 // 判断是否为分享吗 @@ -800,8 +800,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) { UID: a.UID, Type: common.CurrencyINR, Value: reward, - Event: common.CurrencyEventTask, - Exi1: code, + Event: common.CurrencyEventActivityShareBind, NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), }, }) @@ -813,13 +812,19 @@ func ActivityLuckyCodeDraw(c *gin.Context) { } } else { now := time.Now() + code, err := strconv.Atoi(req.LuckyCode) + if err != nil { + a.Code = values.CodeParam + a.Msg = "The code you entered is incorrect" + return + } luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")} - if !a.MGet(luckyCode) { + err = db.Mysql().Get(&luckyCode) + if err != nil { a.Code = values.CodeParam a.Msg = "The code you entered is incorrect" return } - codeType := luckyCode.Type data := &common.ActivityLuckyCodeData{UID: a.UID} db.Mysql().Get(data) @@ -873,12 +878,12 @@ func ActivityLuckyCodeDraw(c *gin.Context) { break } } - _, err := call.UpdateCurrencyPro(&common.UpdateCurrency{ + _, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ CurrencyBalance: &common.CurrencyBalance{ UID: a.UID, Type: common.CurrencyINR, Value: reward, - Event: common.CurrencyEventTask, + Event: common.CurrencyEventActivityLuckyCode, Exs1: fmt.Sprintf("%d", codeType), Exi1: code, NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), @@ -1465,7 +1470,7 @@ func ActivityWeekCardDraw(c *gin.Context) { log.Info("maxAmount:%v", maxAmount) ticket := call.GetConfigDiscountTicketByAmount(maxAmount) log.Info("ticket:%v", ticket) - if ticket.Id > 0 { + if ticket.ID > 0 { // 赠送优惠券 tickets := call.GetConfigDiscountTicket() sort.Slice(tickets, func(i, j int) bool { @@ -1492,7 +1497,7 @@ func ActivityWeekCardDraw(c *gin.Context) { call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) resp.DiscountTicket = ticket.DiscountAmount resp.Amount = ticket.RechargeAmount - } else if nextTicket.Id > 0 { + } else if nextTicket.ID > 0 { call.AddUserDiscountTicket(a.UID, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, false) call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) resp.DiscountTicket = nextTicket.DiscountAmount diff --git a/modules/web/handler/game.go b/modules/web/handler/game.go index f74bec8..69358c8 100644 --- a/modules/web/handler/game.go +++ b/modules/web/handler/game.go @@ -95,10 +95,6 @@ func EnterGame(c *gin.Context) { 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 } } diff --git a/modules/web/providers/jili2/base.go b/modules/web/providers/jili2/base.go index 3906eb2..5fef8c4 100644 --- a/modules/web/providers/jili2/base.go +++ b/modules/web/providers/jili2/base.go @@ -4,7 +4,9 @@ import ( "encoding/json" "fmt" "server/call" + "server/common" "server/config" + "server/db" "server/modules/web/providers/base" utils "server/util" "strconv" @@ -42,6 +44,7 @@ func (s *Sub) EnterGame() string { key := AgentMap.Key rtp := call.GetRtpControl(uid) log.Info("uid:%v,rtp:%v", uid, rtp) + db.Redis().SetData(common.GetRedisKeyPlayerRtp(uid), rtp) headers := map[string]string{ "X-Atgame-Mchid": mchid, "X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10), diff --git a/modules/web/providers/jili2/handler.go b/modules/web/providers/jili2/handler.go index 7c480f7..fdfcab0 100644 --- a/modules/web/providers/jili2/handler.go +++ b/modules/web/providers/jili2/handler.go @@ -89,6 +89,7 @@ func GetPlayerBalance(c *gin.Context) { resp.Data.Uname = req.Uname resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2) a.Data = resp + log.Debug("GetPlayerBalance resp:%+v", resp) } func PlaceBet(c *gin.Context) { diff --git a/modules/web/providers/jili2/values.go b/modules/web/providers/jili2/values.go index f566899..2c038c3 100644 --- a/modules/web/providers/jili2/values.go +++ b/modules/web/providers/jili2/values.go @@ -1,11 +1,12 @@ package jili2 const ( - APIRlease = "https://openapi-br.atgameapp.com/pub" + APIRlease = "https://openapi.jfancygame.com" APITest = "https://api.jgameworks.com" LaunchGameURL = "/api/usr/ingame" GetGameListURL = "/api/game/loadlist" - Lang = "en" + + Lang = "en" ) type Agent struct { @@ -20,5 +21,8 @@ var ( MchId: "10017", Key: "C54E411A1B89C54BFB977EBAA7BB1D39", } - AgentMapRelease = Agent{} + AgentMapRelease = Agent{ + MchId: "10009", + Key: "DAAD7363FB8FBD824FB9B765BBCEC186", + } ) diff --git a/modules/web/providers/pg2/base.go b/modules/web/providers/pg2/base.go index 3a55ce5..be65e02 100644 --- a/modules/web/providers/pg2/base.go +++ b/modules/web/providers/pg2/base.go @@ -4,7 +4,9 @@ import ( "encoding/json" "fmt" "server/call" + "server/common" "server/config" + "server/db" "server/modules/web/providers/base" utils "server/util" "strconv" @@ -42,6 +44,7 @@ func (s *Sub) EnterGame() string { key := AgentMap.Key rtp := call.GetRtpControl(uid) log.Info("uid:%v,rtp:%v", uid, rtp) + db.Redis().SetData(common.GetRedisKeyPlayerRtp(uid), rtp) headers := map[string]string{ "X-Atgame-Mchid": mchid, "X-Atgame-Timestamp": strconv.FormatInt(timestamp, 10), diff --git a/modules/web/providers/pg2/handler.go b/modules/web/providers/pg2/handler.go index d08b34d..e692e80 100644 --- a/modules/web/providers/pg2/handler.go +++ b/modules/web/providers/pg2/handler.go @@ -89,6 +89,8 @@ func GetPlayerBalance(c *gin.Context) { resp.Data.Uname = req.Uname resp.Data.Balance = call.GetUserCurrencyFloat(uid, common.CurrencyType(currency), 2) a.Data = resp + + log.Debug("GetPlayerBalance resp:%+v", resp) } func PlaceBet(c *gin.Context) { diff --git a/modules/web/providers/pg2/values.go b/modules/web/providers/pg2/values.go index 2f246e3..a927f3e 100644 --- a/modules/web/providers/pg2/values.go +++ b/modules/web/providers/pg2/values.go @@ -1,7 +1,7 @@ package pg2 const ( - APIRlease = "https://openapi-br.atgameapp.com/pub" + APIRlease = "https://openapi-ind.atgameapp.com/pub" APITest = "https://openapi.windygame.net/demo" LaunchGameURL = "/api/usr/ingame" GetGameListURL = "/api/game/loadlist" @@ -20,5 +20,8 @@ var ( "10071", "E3D1A83FA82F04D9725ACB5A77578A65", } - AgentMapRelease = Agent{} + AgentMapRelease = Agent{ + "10025", + "E21B1CFF68CD984C6ADB25554BAF16C3", + } )