|
|
|
|
@ -667,35 +667,25 @@ func ActivityFirstRechargeBackInfo(c *gin.Context) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
resp := &values.ActivityFirstRechargeBackInfoResp{} |
|
|
|
|
conf := call.GetConfigActivityFirstRechargeBack() |
|
|
|
|
a.Data = resp |
|
|
|
|
data := call.GetUserFirstRechargeBackData(a.UID) |
|
|
|
|
diff := time.Now().Unix() - data.RechargeTime |
|
|
|
|
log.Debug("ActivityFirstRechargeBackInfo:%+v", data) |
|
|
|
|
if data.RechargeTime == 0 { |
|
|
|
|
resp.CanRecharge = true |
|
|
|
|
} else { |
|
|
|
|
if diff > common.ActivityFirstRechargeBackTime*2 { |
|
|
|
|
a.Code = values.CodeActivityExpire |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
resp.CanRecharge = diff < common.ActivityFirstRechargeBackTime |
|
|
|
|
} |
|
|
|
|
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDFirstRechargeBack) |
|
|
|
|
resp.Recharge = data.Amount |
|
|
|
|
if data.Amount < call.GetConfigActivityFirstRechargeBack().MinRecharge { |
|
|
|
|
if data.Amount < conf.MinRecharge { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR) |
|
|
|
|
if val < 0 { |
|
|
|
|
val = 0 |
|
|
|
|
} |
|
|
|
|
max := call.GetConfigActivityFirstRechargeBack().MaxBack |
|
|
|
|
if max > 0 && val > max { |
|
|
|
|
val = max |
|
|
|
|
} |
|
|
|
|
if val > data.Amount { |
|
|
|
|
val = data.Amount |
|
|
|
|
} |
|
|
|
|
val = val * conf.MaxBack / 100 |
|
|
|
|
resp.Back = val |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func ActivityFirstRechargeBackDraw(c *gin.Context) { |
|
|
|
|
@ -706,6 +696,7 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) { |
|
|
|
|
if !a.CheckActivityExpire(common.ActivityIDFirstRechargeBack) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
conf := call.GetConfigActivityFirstRechargeBack() |
|
|
|
|
data := call.GetUserFirstRechargeBackData(a.UID) |
|
|
|
|
val := data.Amount - call.GetUserCurrencyTotal(a.UID, common.CurrencyINR) |
|
|
|
|
if val <= 0 { |
|
|
|
|
@ -716,22 +707,12 @@ func ActivityFirstRechargeBackDraw(c *gin.Context) { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if time.Now().Unix()-data.RechargeTime > common.ActivityFirstRechargeBackTime*2 { |
|
|
|
|
a.Code = values.CodeActivityExpire |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
rows, err := db.Mysql().UpdateRes(&common.ActivityFirstRechargeBackData{UID: a.UID}, map[string]interface{}{"lost": 0}) |
|
|
|
|
if err != nil || rows == 0 { |
|
|
|
|
a.Code = values.CodeRetry |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
max := call.GetConfigActivityFirstRechargeBack().MaxBack |
|
|
|
|
if max > 0 || val > max { |
|
|
|
|
val = max |
|
|
|
|
} |
|
|
|
|
if val > data.Amount { |
|
|
|
|
val = data.Amount |
|
|
|
|
} |
|
|
|
|
val = val * conf.MaxBack / 100 |
|
|
|
|
_, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ |
|
|
|
|
CurrencyBalance: &common.CurrencyBalance{ |
|
|
|
|
UID: a.UID, |
|
|
|
|
@ -1999,3 +1980,39 @@ func ActivityPopup(c *gin.Context) { |
|
|
|
|
resp.List = call.GetConfigActivityPopupByType(req.JumpType) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func WeekCardInfo(c *gin.Context) { |
|
|
|
|
a := app.NewApp(c) |
|
|
|
|
defer func() { |
|
|
|
|
a.Response() |
|
|
|
|
}() |
|
|
|
|
req := values.ActivityPopupReq{} |
|
|
|
|
if !a.S(&req) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
resp := new(values.ActivityPopupResp) |
|
|
|
|
a.Data = resp |
|
|
|
|
if req.JumpType == 0 { |
|
|
|
|
resp.List = call.GetConfigActivityPopup() |
|
|
|
|
} else { |
|
|
|
|
resp.List = call.GetConfigActivityPopupByType(req.JumpType) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func WeekCardDraw(c *gin.Context) { |
|
|
|
|
a := app.NewApp(c) |
|
|
|
|
defer func() { |
|
|
|
|
a.Response() |
|
|
|
|
}() |
|
|
|
|
req := values.ActivityPopupReq{} |
|
|
|
|
if !a.S(&req) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
resp := new(values.ActivityPopupResp) |
|
|
|
|
a.Data = resp |
|
|
|
|
if req.JumpType == 0 { |
|
|
|
|
resp.List = call.GetConfigActivityPopup() |
|
|
|
|
} else { |
|
|
|
|
resp.List = call.GetConfigActivityPopupByType(req.JumpType) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|