|
|
|
|
@ -675,6 +675,7 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) { |
|
|
|
|
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDFirstRechargeBack) |
|
|
|
|
resp.Recharge = data.Amount |
|
|
|
|
resp.BackPer = conf.MaxBack |
|
|
|
|
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR) |
|
|
|
|
if data.RechargeTime == 0 { |
|
|
|
|
resp.CanRecharge = true |
|
|
|
|
return |
|
|
|
|
@ -1855,16 +1856,47 @@ func ActivityBetDrawInfo(c *gin.Context) { |
|
|
|
|
db.Mysql().Create(drawInfo) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
vipInfo := call.GetVIP(a.UID) |
|
|
|
|
confList := call.GetConfigBetDraw() |
|
|
|
|
resp := &values.ActivityBetDrawInfoResp{ |
|
|
|
|
List: call.GetConfigBetDraw(), |
|
|
|
|
List: confList, |
|
|
|
|
Lucky: drawInfo.Lucky, |
|
|
|
|
} |
|
|
|
|
a.Data = resp |
|
|
|
|
var types []int |
|
|
|
|
var confs []*common.ConfigActivityBetDraw |
|
|
|
|
for _, item := range resp.List { |
|
|
|
|
if resp.Lucky >= item.Cost { |
|
|
|
|
if resp.Lucky >= item.Cost && vipInfo.Level >= item.VipUnlock { |
|
|
|
|
call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(1)) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
if !util.SliceContain(types, item.Type) { |
|
|
|
|
types = append(types, item.Type) |
|
|
|
|
confs = append(confs, item) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
now := time.Now() |
|
|
|
|
update := false |
|
|
|
|
for _, item := range confs { |
|
|
|
|
typ := item.Type |
|
|
|
|
spinInfo := drawInfo.SpinInfo[typ] |
|
|
|
|
if spinInfo == nil { |
|
|
|
|
drawInfo.SpinInfo[typ] = &common.LuckyData{} |
|
|
|
|
spinInfo = drawInfo.SpinInfo[typ] |
|
|
|
|
} |
|
|
|
|
if !util.IsSameDayTimeStamp(spinInfo.LastSpinTime, now.Unix()) { |
|
|
|
|
spinInfo.SpinNum = 0 |
|
|
|
|
update = true |
|
|
|
|
} |
|
|
|
|
resp.SpinInfo = append(resp.SpinInfo, &common.LuckyData{ |
|
|
|
|
SpinNum: spinInfo.SpinNum, |
|
|
|
|
NextSpinTIme: spinInfo.NextSpinTIme, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if update && a.UID > 0 { |
|
|
|
|
db.Mysql().Update(&common.ActivityBetDrawData{UID: a.UID}, map[string]interface{}{ |
|
|
|
|
"spin_info": drawInfo.SpinInfo, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
call.UploadActivityData(a.UID, common.ActivityIDBetDraw, common.ActivityDataClick, 0) |
|
|
|
|
} |
|
|
|
|
@ -1881,6 +1913,7 @@ func ActivityBetDrawDraw(c *gin.Context) { |
|
|
|
|
if !a.CheckActivityExpire(common.ActivityIDBetDraw) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
configList, weightList := call.GetConfigBetDrawByType(req.WheelType) |
|
|
|
|
if len(configList) == 0 { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
@ -1889,6 +1922,23 @@ func ActivityBetDrawDraw(c *gin.Context) { |
|
|
|
|
conf := configList[0] |
|
|
|
|
drawInfo := common.ActivityBetDrawData{UID: a.UID} |
|
|
|
|
db.Mysql().Get(&drawInfo) |
|
|
|
|
now := time.Now() |
|
|
|
|
spinInfo, ok := drawInfo.SpinInfo[req.WheelType] |
|
|
|
|
if !ok { |
|
|
|
|
drawInfo.SpinInfo[req.WheelType] = &common.LuckyData{} |
|
|
|
|
spinInfo = drawInfo.SpinInfo[req.WheelType] |
|
|
|
|
} |
|
|
|
|
// step:判断cd
|
|
|
|
|
if spinInfo.LastSpinTime != 0 && now.Unix()-spinInfo.LastSpinTime < conf.Cd { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
a.Msg = "Unarrived spin time" |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if spinInfo.SpinNum >= conf.LimitNum { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
a.Msg = "No spin times" |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if drawInfo.Lucky < conf.Cost { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
a.Msg = "lucky not enough" |
|
|
|
|
@ -1902,8 +1952,14 @@ func ActivityBetDrawDraw(c *gin.Context) { |
|
|
|
|
} |
|
|
|
|
rewardConf := configList[idx] |
|
|
|
|
reward := rewardConf.Reward |
|
|
|
|
err := db.Mysql().Update(&drawInfo, map[string]interface{}{ |
|
|
|
|
"lucky": gorm.Expr("lucky - ?", conf.Cost), |
|
|
|
|
spinInfo.LastSpinTime = time.Now().Unix() |
|
|
|
|
spinInfo.SpinNum += 1 |
|
|
|
|
spinInfo.NextSpinTIme = spinInfo.LastSpinTime + conf.Cd |
|
|
|
|
err := db.Mysql().Update(&common.ActivityBetDrawData{ |
|
|
|
|
UID: a.UID, |
|
|
|
|
}, map[string]interface{}{ |
|
|
|
|
"lucky": gorm.Expr("lucky - ?", conf.Cost), |
|
|
|
|
"spin_info": drawInfo.SpinInfo, |
|
|
|
|
}) |
|
|
|
|
if err != nil { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
|