From eea7bf4af66e409198a54700fff88494f90bb463 Mon Sep 17 00:00:00 2001 From: mofangmin Date: Mon, 9 Sep 2024 16:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- call/config.go | 2 +- call/mail.go | 11 +- call/pay.go | 44 +++-- call/share.go | 24 ++- call/user.go | 2 +- common/config.go | 35 ++-- common/platform.go | 1 + main.go | 1 + modules/backend/handler/examine/examine.go | 6 +- modules/web/handler/activity.go | 179 +++++++++++++-------- modules/web/handler/game.go | 22 +-- modules/web/handler/recharge.go | 2 +- modules/web/handler/share.go | 45 +++--- modules/web/handler/user.go | 1 + modules/web/handler/withdraw.go | 4 +- modules/web/values/activity.go | 4 +- modules/web/values/share.go | 5 + pb/proto/inner.proto | 2 +- pb/proto/platform.proto | 6 +- 19 files changed, 240 insertions(+), 156 deletions(-) diff --git a/call/config.go b/call/config.go index 8c605fa..b16778f 100644 --- a/call/config.go +++ b/call/config.go @@ -563,7 +563,7 @@ func LoadGames() (err error) { for _, v := range tmplist { for _, k := range providers { if v.GameProvider == k.ProviderID { - if v.GameProvider == common.ProviderPG2 || v.GameProvider == common.ProviderJiLi2 || k.Open == 1 { // 特殊过滤 + if k.Open == 1 { // 特殊过滤 list = append(list, v) } break diff --git a/call/mail.go b/call/mail.go index ce9ee28..dad4203 100644 --- a/call/mail.go +++ b/call/mail.go @@ -11,11 +11,12 @@ import ( ) var ( - SystemTitle = "System Notice" - 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." - 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." + SystemTitle = "System Notice" + 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." + EmailWithdrawFail = "Your order %v, Amount: $%v\nYour withdrawal failed due to incorrect information. Please verify or change your withdrawal details and resubmit" + 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) { diff --git a/call/pay.go b/call/pay.go index e845a94..d53f384 100644 --- a/call/pay.go +++ b/call/pay.go @@ -81,6 +81,17 @@ func Withdraw(data *pb.InnerWithdrawReq) (*pb.InnerWithdrawResp, error) { 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 充值回调 func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra string) (err error) { 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) return err } - amount := r.Amount + CheckUserBet(uid, r.CurrencyType) + amount := r.Amount notCharge := re.TotalRecharge == 0 re.TotalRecharge += amount now := time.Now().Unix() @@ -418,18 +430,24 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa return err } if status != common.StatusROrderCreate { - if err := UpdateCurrency(&common.UpdateCurrency{ - CurrencyBalance: &common.CurrencyBalance{ - UID: or.UID, - Type: or.CurrencyType, - Value: or.WithdrawCash, - Event: common.CurrencyEventWithDrawBack, - Exs1: or.OrderID, - }, - }, tx); err != nil { - log.Error("Withdraw callback err:%v", err) - tx.Rollback() - return err + if or.Extra != "share" { + if err := UpdateCurrency(&common.UpdateCurrency{ + CurrencyBalance: &common.CurrencyBalance{ + UID: or.UID, + Type: or.CurrencyType, + Value: or.WithdrawCash, + Event: common.CurrencyEventWithDrawBack, + Exs1: or.OrderID, + }, + }, tx); err != nil { + log.Error("Withdraw callback err:%v", 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), + }) } } // 退还代付券 diff --git a/call/share.go b/call/share.go index dfda928..23b72ae 100644 --- a/call/share.go +++ b/call/share.go @@ -25,15 +25,21 @@ func GetShareInfo(uid int) *common.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) { // 绑定 - if share == "" || isOld { + if share == "" { return } activityId := 0 now := time.Now().Unix() + // 关联活动分享码 codeInfo := &common.ShareActivityCode{ShareCode: share} upInfo := &common.ShareInfo{} db.Mysql().Get(codeInfo) @@ -54,9 +60,19 @@ func ShareBind(share string, isOld bool, uid, cid int) { if upInfo.ID <= 0 { 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} - db.Mysql().Create(shareInfo) - + if !isOld { + 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")}) diff --git a/call/user.go b/call/user.go index 106c415..94df911 100644 --- a/call/user.go +++ b/call/user.go @@ -793,7 +793,7 @@ func GetUserRtp(uid int) *common.PlayerRtpData { func GetRtpControl(uid int) int { rechargeInfo := GetRechargeInfo(uid) - withdrawRechargePer := (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash) / rechargeInfo.TotalRecharge + withdrawRechargePer := (rechargeInfo.TotalWithdraw + rechargeInfo.WithdrawingCash) / rechargeInfo.TotalRecharge * 100 rtpConf := GetConfigRTPByAmount(rechargeInfo.TotalRecharge) rtpData := GetUserRtp(uid) // 1.优先玩家配置 diff --git a/common/config.go b/common/config.go index eab6482..4df8d4e 100644 --- a/common/config.go +++ b/common/config.go @@ -166,19 +166,20 @@ func GetConfigStructByType(t int) (interface{}, interface{}) { // WithdrawRecharge 退出需付费的金额 // NewControlEnd 新手调控结束阀值 type ConfigPlatform struct { - ID int `gorm:"primarykey"` - 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"` - 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"` - 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"` - 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"` - 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"` - 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"` + ID int `gorm:"primarykey"` + 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"` + 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"` + 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"` + 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"` + 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"` + 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 { @@ -461,10 +462,6 @@ type ConfigBroadcast struct { ConditionUp int `gorm:"column:condition_up;type:int(11);comment:触发条件上限" web:"condition_up"` } -func (c *ConfigBroadcast) TableName() string { - return "config_broadcast" -} - type ConfigNotice struct { ID int `gorm:"primarykey"` Title1 string `gorm:"column:title1;type:varchar(255);comment:标题1" web:"title1"` // 公告标题_1(英语) @@ -479,10 +476,6 @@ type ConfigNotice struct { PushTimes int `gorm:"column:push_times;type:int(11);comment:推送次数" web:"push_times"` // 推送次数 } -func (c *ConfigNotice) TableName() string { - return "config_notice" -} - // 货币汇率(各种货币转换成美元的汇率) type ConfigCurrencyRateUSD struct { ID int `gorm:"primary_key;AUTO_INCREMENT;column:id"` diff --git a/common/platform.go b/common/platform.go index bf0cb59..2cb932c 100644 --- a/common/platform.go +++ b/common/platform.go @@ -202,6 +202,7 @@ type Channel struct { 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"` 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 { diff --git a/main.go b/main.go index 704bd38..e5dae90 100644 --- a/main.go +++ b/main.go @@ -34,6 +34,7 @@ import ( ) func main() { + log.Info("启动游戏服务器 ...") rand.Seed(time.Now().UTC().UnixNano()) runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/backend/handler/examine/examine.go b/modules/backend/handler/examine/examine.go index 22c052e..aabb622 100644 --- a/modules/backend/handler/examine/examine.go +++ b/modules/backend/handler/examine/examine.go @@ -178,7 +178,11 @@ func WithdrawExamine(c *gin.Context) { if err != nil { 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 } call.SendMailWithContent(one.UID, call.SystemTitle, fmt.Sprintf(call.EmailWithdrawPass, one.OrderID, one.Amount/common.DecimalDigits)) diff --git a/modules/web/handler/activity.go b/modules/web/handler/activity.go index 574116c..4bd434c 100644 --- a/modules/web/handler/activity.go +++ b/modules/web/handler/activity.go @@ -12,6 +12,7 @@ import ( "server/pb" "server/util" "sort" + "strconv" "strings" "time" @@ -773,91 +774,126 @@ func ActivityLuckyCodeDraw(c *gin.Context) { if !a.S(req) { 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{} a.Data = resp + code, _ := strconv.Atoi(req.LuckyCode) + var reward int64 - codeType := luckyCode.Type - data := &common.ActivityLuckyCodeData{UID: a.UID} - db.Mysql().Get(data) - if (codeType == common.LuckyCodeTypeNormal && util.IsSameDayTimeStamp(now.Unix(), data.LastDraw)) || - (codeType == common.LuckyCodeTypeVip && util.IsSameDayTimeStamp(now.Unix(), data.LastVipDraw)) { - a.Code = values.CodeParam - a.Msg = "इस कोड का पहले ही उपयोग किया जा चुका है" - 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() + // 判断是否为分享吗 + upShareInfo := call.GetShareInfoByCode(req.LuckyCode) + if upShareInfo.ID > 0 { + if upShareInfo.UID == a.UID { + a.Code = values.CodeRetry + a.Msg = "code error" + return } - 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 { + log.Error("err:%v", err) a.Code = values.CodeRetry + a.Msg = "code error" 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 + now := time.Now() + luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")} + if !a.MGet(luckyCode) { + a.Code = values.CodeParam + a.Msg = "The code you entered is incorrect" return } - } - ran := rand.Int63n(total) - var rans, reward int64 - id := 0 - for _, v := range con { - rans += v.Per - if ran < rans { - id = v.ID - reward = v.Reward - break + codeType := luckyCode.Type + data := &common.ActivityLuckyCodeData{UID: a.UID} + db.Mysql().Get(data) + if (codeType == common.LuckyCodeTypeNormal && util.IsSameDayTimeStamp(now.Unix(), data.LastDraw)) || + (codeType == common.LuckyCodeTypeVip && util.IsSameDayTimeStamp(now.Unix(), data.LastVipDraw)) { + a.Code = values.CodeParam + a.Msg = "This code has already been used" + 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 = "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{ - CurrencyBalance: &common.CurrencyBalance{ - UID: a.UID, - Type: common.CurrencyINR, - Value: reward, - Event: common.CurrencyEventTask, - Exs1: fmt.Sprintf("%d", codeType), - Exi1: req.LuckyCode, - NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), - }, - }) - if err != nil { - log.Error("err:%v", err) - a.Code = values.CodeRetry - a.Msg = "रूपांतरण कोड त्रुटि" - return + ran := rand.Int63n(total) + var rans int64 + for _, v := range con { + rans += v.Per + if ran < rans { + reward = v.Reward + break + } + } + _, err := call.UpdateCurrencyPro(&common.UpdateCurrency{ + CurrencyBalance: &common.CurrencyBalance{ + UID: a.UID, + Type: common.CurrencyINR, + Value: reward, + Event: common.CurrencyEventTask, + 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 @@ -1356,6 +1392,7 @@ func ActivityWeekCardInfo(c *gin.Context) { if resp.Status && resp.RechargeStatus { call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1) } + call.UploadActivityData(a.UID, common.ActivityIDSign, common.ActivityDataClick, 0) } func ActivityWeekCardDraw(c *gin.Context) { @@ -1481,7 +1518,7 @@ func ActivityWeekCardDraw(c *gin.Context) { }) } call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 0) - + call.UploadActivityData(a.UID, common.ActivityIDSign, common.ActivityDataJoin, reward) } func ActivitySlotsInfo(c *gin.Context) { diff --git a/modules/web/handler/game.go b/modules/web/handler/game.go index cbbe92f..f74bec8 100644 --- a/modules/web/handler/game.go +++ b/modules/web/handler/game.go @@ -82,22 +82,26 @@ func EnterGame(c *gin.Context) { } a.Data = resp // step:特殊逻辑处理 + providerId := 0 if req.Provider == common.ProviderPGSoft { - provider = call.GetConfigGameProvider(common.ProviderPG2) - game := call.GetConfigGameListByID(common.ProviderPG2, req.GameID) - if game != nil && game.Open == 1 { - req.Provider = common.ProviderPG2 - resp.Method = provider.Method - } + providerId = common.ProviderPG2 } if req.Provider == common.ProviderJili { - provider = call.GetConfigGameProvider(common.ProviderJiLi2) - game := call.GetConfigGameListByID(common.ProviderJiLi2, req.GameID) + providerId = common.ProviderJiLi2 + } + if providerId > 0 { + provider = call.GetConfigGameProvider(providerId) + game := call.GetConfigGameListByID(providerId, req.GameID) if game != nil && game.Open == 1 { - req.Provider = common.ProviderJiLi2 + req.Provider = providerId resp.Method = provider.Method + } else { + a.Code = values.CodeParam + a.Msg = "Under Maintenance,please try later." + return } } + if req.IsDemo { log.Debug("player enter demo game %+v", *req) enter := &base.EnterGameReq{ diff --git a/modules/web/handler/recharge.go b/modules/web/handler/recharge.go index b94764c..6a04c06 100644 --- a/modules/web/handler/recharge.go +++ b/modules/web/handler/recharge.go @@ -40,7 +40,7 @@ func RechargeInfo(c *gin.Context) { defer func() { a.Response() }() - list := call.GetConfigPayProduct() + list := call.GetConfigPayProductByActivityID(0) resp := &values.RechargeInfoResp{Tips: call.GetConfigPlatform().PayTips, SelectID: config.GetConfig().Web.SelectID} a.Data = resp resp.Channels = call.GetConfigPayChannels() diff --git a/modules/web/handler/share.go b/modules/web/handler/share.go index 8141022..8e38b21 100644 --- a/modules/web/handler/share.go +++ b/modules/web/handler/share.go @@ -84,13 +84,14 @@ func ShareInfo(c *gin.Context) { } channel := call.GetChannelByID(a.Channel) if channel != nil { - resp.ShareLink += channel.URL + "?code=" + "xxxxxx" - if a.Prefix != "" { - resp.ShareLink = a.Prefix + "." + resp.ShareLink - } else { - resp.ShareLink = "www." + resp.ShareLink - } - resp.ShareLink = "https://" + resp.ShareLink + // resp.ShareLink += channel.URL + "?code=" + "xxxxxx" + // if a.Prefix != "" { + // resp.ShareLink = a.Prefix + "." + resp.ShareLink + // } else { + // resp.ShareLink = "www." + resp.ShareLink + // } + // resp.ShareLink = "https://" + resp.ShareLink + resp.ShareLink = channel.ShareUrl } a.GetUID() if a.UID <= 0 { @@ -105,20 +106,21 @@ func ShareInfo(c *gin.Context) { resp.AvailableReward = shareInfo.AvailableReward resp.RechargeCount = call.GetUserShareRecharges(a.UID, 1) resp.TotalRecharge = call.GetUserShareRechargeAmount(a.UID, 1) - if channel != nil { - num := 10000 - channelId := channel.ChannelID - if channel.ChannelID < num { - channelId += num - } - resp.ShareLink = channel.URL + "?code=" + shareInfo.Share + "&ch=" + fmt.Sprintf("%d", channelId) - if a.Prefix != "" { - resp.ShareLink = a.Prefix + "." + resp.ShareLink - } else { - resp.ShareLink = "www." + resp.ShareLink - } - resp.ShareLink = "https://" + resp.ShareLink - } + resp.ShareCode = shareInfo.Share + // if channel != nil { + // num := 10000 + // channelId := channel.ChannelID + // if channel.ChannelID < num { + // channelId += num + // } + // resp.ShareLink = channel.URL + "?code=" + shareInfo.Share + "&ch=" + fmt.Sprintf("%d", channelId) + // if a.Prefix != "" { + // resp.ShareLink = a.Prefix + "." + resp.ShareLink + // } else { + // resp.ShareLink = "www." + resp.ShareLink + // } + // resp.ShareLink = "https://" + resp.ShareLink + // } num := 0 if resp.AvailableReward > 0 { num = 1 @@ -297,6 +299,7 @@ func ShareWithdraw(c *gin.Context) { OrderID: orderID, APIPayID: "", // ProductID: one.ID, + Extra: "share", CreateTime: time.Now().Unix(), Amount: realAmount, WithdrawCash: req.Amount, diff --git a/modules/web/handler/user.go b/modules/web/handler/user.go index 4e2279f..85b94b6 100644 --- a/modules/web/handler/user.go +++ b/modules/web/handler/user.go @@ -102,6 +102,7 @@ func GetUserInfo(c *gin.Context) { util.Go(func() { CheckRedPoint(uid, c) }) + } func EditUserInfo(c *gin.Context) { diff --git a/modules/web/handler/withdraw.go b/modules/web/handler/withdraw.go index db21388..d0ec33f 100644 --- a/modules/web/handler/withdraw.go +++ b/modules/web/handler/withdraw.go @@ -465,14 +465,14 @@ func NewWithdraw(req *values.WithdrawReq, uid int, ip string, uuid string) (stri if pi.BankCardNo != one.BankCardNo { sql := fmt.Sprintf("bank_card_no = '%v'", one.BankCardNo) 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 if pi.BankCode != one.BankCode { sql := fmt.Sprintf("bank_code = '%v'", one.BankCode) if db.Mysql().Count(&common.PayInfo{}, sql) >= int64(config.GetConfig().Web.MaxBankCardCount) { - return "", values.CodeBankCardNoLimit + return "Bank card error", values.CodeBankCardNoLimit } } } diff --git a/modules/web/values/activity.go b/modules/web/values/activity.go index 8f06174..1da9614 100644 --- a/modules/web/values/activity.go +++ b/modules/web/values/activity.go @@ -81,12 +81,12 @@ type ActivityLuckyCodeInfoReq struct { // Type 类型,预留用于后续其他活动兑换码 type ActivityLuckyCodeDrawReq struct { Type int - LuckyCode int `json:"LuckyCode" binding:"required"` + LuckyCode string `json:"LuckyCode" binding:"required"` } // ID 奖品id type ActivityLuckyCodeDrawResp struct { - ID int + Reward int64 } // Sign 玩家签到情况数据 二进制 如第一天签了,第二天没签,第三天签了,第四天签了 就是1101 diff --git a/modules/web/values/share.go b/modules/web/values/share.go index d3e0865..084c609 100644 --- a/modules/web/values/share.go +++ b/modules/web/values/share.go @@ -29,6 +29,7 @@ type ShareInfoResp struct { PlatformTotalReward int64 Rank []*OneShareRank Msg string // 后台配置消息 + ShareCode string } type SharePlatformResp struct { @@ -202,3 +203,7 @@ type GetActivityCodeReq struct { type GetActivityCodeResp struct { ShareLink string } + +type ShareCodeBindReq struct { + Code string +} diff --git a/pb/proto/inner.proto b/pb/proto/inner.proto index e03c836..7fb2d54 100644 --- a/pb/proto/inner.proto +++ b/pb/proto/inner.proto @@ -28,7 +28,7 @@ message InnerBroadcast { int32 ID = 1; string Content = 2; int32 Priority = 3; - int32 Frequency = 4; + int32 Frequency = 4; int32 Interval = 5; } diff --git a/pb/proto/platform.proto b/pb/proto/platform.proto index f9c68d0..eadbfff 100644 --- a/pb/proto/platform.proto +++ b/pb/proto/platform.proto @@ -132,9 +132,9 @@ message PlayerBalanceResp{ } message BroadcastMsg{ - string Content = 1; - uint32 Priority = 2; - int64 Loop = 3; // 重复次数 + string Content = 1; // 内容 + uint32 Priority = 2; // 优先级 + int64 Loop = 3; // 重复次数 int64 Interval = 4; // 时间间隔 }