mofangmin 1 year ago
parent 3e94fcfcc8
commit 9cc17ff8df
  1. 3
      call/pay.go
  2. 1
      common/activity.go
  3. 13
      modules/web/handler/activity.go
  4. 2
      modules/web/values/activity.go

@ -531,8 +531,9 @@ func PayActivity(r *common.RechargeOrder, notCharge bool, user *common.PlayerDBI
func ActivityFirstRechargeBack(r *common.RechargeOrder) {
if IsActivityValid(common.ActivityIDFirstRechargeBack) {
conf := GetConfigActivityFirstRechargeBack()
rechargeBackData := GetUserFirstRechargeBackData(r.UID)
if rechargeBackData.RechargeTime == 0 {
if rechargeBackData.RechargeTime == 0 && r.Amount >= conf.MinRecharge {
db.Mysql().Create(&common.ActivityFirstRechargeBackData{UID: r.UID, RechargeTime: time.Now().Unix(), Amount: r.Amount})
}
}

@ -210,6 +210,7 @@ type ActivityFirstRechargeBackData struct {
RechargeTime int64 `gorm:"column:recharge_time;type:bigint(20);default:0;comment:首次充值时间"`
Amount int64 `gorm:"column:amount;type:bigint(20);default:0;comment:总充值金额"`
Lost int64 `gorm:"column:lost;type:bigint(20);default:0;comment:活动时间内总损失"`
RewardTime int64 `gorm:"column:reward_time;type:bigint(20);default:0;comment:领取时间"`
}
func (c *ActivityFirstRechargeBackData) TableName() string {

@ -663,6 +663,7 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) {
defer func() {
a.Response()
}()
a.GetUID()
if !a.CheckActivityExpire(common.ActivityIDFirstRechargeBack) {
return
}
@ -671,21 +672,23 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) {
a.Data = resp
data := call.GetUserFirstRechargeBackData(a.UID)
log.Debug("ActivityFirstRechargeBackInfo:%+v", data)
if data.RechargeTime == 0 {
resp.CanRecharge = true
}
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDFirstRechargeBack)
resp.Recharge = data.Amount
resp.BackPer = conf.MaxBack
if data.Amount < conf.MinRecharge {
if data.RechargeTime == 0 {
resp.CanRecharge = true
return
}
if data.RewardTime > 0 {
resp.Draw = true
}
val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR)
if val < 0 {
val = 0
}
val = val * conf.MaxBack / 100
resp.Back = val
resp.PayAmount = rand.Int63n(1000000) + 10000
resp.DrawTime = data.RechargeTime + common.ActivityFirstRechargeBackTime
}
@ -708,7 +711,7 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) {
a.Code = values.CodeRetry
return
}
rows, err := db.Mysql().UpdateRes(&common.ActivityFirstRechargeBackData{UID: a.UID}, map[string]interface{}{"lost": 0})
rows, err := db.Mysql().UpdateRes(&common.ActivityFirstRechargeBackData{UID: a.UID}, map[string]interface{}{"lost": 0, "reward_time": time.Now().Unix()})
if err != nil || rows == 0 {
a.Code = values.CodeRetry
return

@ -48,7 +48,9 @@ type ActivityFirstRechargeBackInfoResp struct {
Back int64
BackPer int64
CanRecharge bool
PayAmount int64 // 支付金额
DrawTime int64 // 领取时间
Draw bool // 是否领取
ProductList []*common.ConfigPayProduct
}

Loading…
Cancel
Save