活动提交

dev
mofangmin 1 year ago
parent 87bdf82aa6
commit eea7bf4af6
  1. 2
      call/config.go
  2. 1
      call/mail.go
  3. 20
      call/pay.go
  4. 20
      call/share.go
  5. 2
      call/user.go
  6. 9
      common/config.go
  7. 1
      common/platform.go
  8. 1
      main.go
  9. 4
      modules/backend/handler/examine/examine.go
  10. 65
      modules/web/handler/activity.go
  11. 22
      modules/web/handler/game.go
  12. 2
      modules/web/handler/recharge.go
  13. 45
      modules/web/handler/share.go
  14. 1
      modules/web/handler/user.go
  15. 4
      modules/web/handler/withdraw.go
  16. 4
      modules/web/values/activity.go
  17. 5
      modules/web/values/share.go
  18. 4
      pb/proto/platform.proto

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

@ -15,6 +15,7 @@ var (
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."
)

@ -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,6 +430,7 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa
return err
}
if status != common.StatusROrderCreate {
if or.Extra != "share" {
if err := UpdateCurrency(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: or.UID,
@ -431,6 +444,11 @@ func ReturnBackWithdraw(or *common.WithdrawOrder, originStatus, status uint8, pa
tx.Rollback()
return err
}
} else {
db.Mysql().Update(&common.ShareInfo{UID: or.UID}, map[string]interface{}{
"available_reward": gorm.Expr("available_reward + ?", or.WithdrawCash),
})
}
}
// 退还代付券
// if or.Extra == "useFreeWithdraw" {

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

@ -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.优先玩家配置

@ -179,6 +179,7 @@ type ConfigPlatform struct {
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"`

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

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

@ -178,7 +178,11 @@ func WithdrawExamine(c *gin.Context) {
if err != nil {
log.Error(err.Error())
}
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))

@ -12,6 +12,7 @@ import (
"server/pb"
"server/util"
"sort"
"strconv"
"strings"
"time"
@ -773,15 +774,51 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
if !a.S(req) {
return
}
resp := &values.ActivityLuckyCodeDrawResp{}
a.Data = resp
code, _ := strconv.Atoi(req.LuckyCode)
var reward int64
// 判断是否为分享吗
upShareInfo := call.GetShareInfoByCode(req.LuckyCode)
if upShareInfo.ID > 0 {
if upShareInfo.UID == a.UID {
a.Code = values.CodeRetry
a.Msg = "code error"
return
}
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 {
now := time.Now()
luckyCode := &common.ActivityLuckyCode{Code: req.LuckyCode, Date: now.Format("20060102")}
luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")}
if !a.MGet(luckyCode) {
a.Code = values.CodeParam
a.Msg = "आपक दरज कि गयड गलत ह"
a.Msg = "The code you entered is incorrect"
return
}
resp := &values.ActivityLuckyCodeDrawResp{}
a.Data = resp
codeType := luckyCode.Type
data := &common.ActivityLuckyCodeData{UID: a.UID}
@ -789,7 +826,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
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 = "इस कड क पहल उपयग कि"
a.Msg = "This code has already been used"
return
}
// 开始发奖
@ -798,7 +835,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
if total == 0 {
log.Error("con:%+v invalid,uid:%d", con, a.UID)
a.Code = values.CodeParam
a.Msg = "तरण कड ति"
a.Msg = "code error"
return
}
if data.ID == 0 {
@ -828,17 +865,14 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
}
ran := rand.Int63n(total)
var rans, reward int64
id := 0
var rans int64
for _, v := range con {
rans += v.Per
if ran < rans {
id = v.ID
reward = v.Reward
break
}
}
_, err := call.UpdateCurrencyPro(&common.UpdateCurrency{
CurrencyBalance: &common.CurrencyBalance{
UID: a.UID,
@ -846,18 +880,20 @@ func ActivityLuckyCodeDraw(c *gin.Context) {
Value: reward,
Event: common.CurrencyEventTask,
Exs1: fmt.Sprintf("%d", codeType),
Exi1: req.LuckyCode,
Exi1: code,
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward),
},
})
if err != nil {
log.Error("err:%v", err)
a.Code = values.CodeRetry
a.Msg = "तरण कड ति"
a.Msg = "code error"
return
}
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) {

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

@ -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()

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

@ -102,6 +102,7 @@ func GetUserInfo(c *gin.Context) {
util.Go(func() {
CheckRedPoint(uid, c)
})
}
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 {
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
}
}
}

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

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

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

Loading…
Cancel
Save