|
|
|
@ -776,7 +776,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
resp := &values.ActivityLuckyCodeDrawResp{} |
|
|
|
resp := &values.ActivityLuckyCodeDrawResp{} |
|
|
|
a.Data = resp |
|
|
|
a.Data = resp |
|
|
|
code, _ := strconv.Atoi(req.LuckyCode) |
|
|
|
|
|
|
|
var reward int64 |
|
|
|
var reward int64 |
|
|
|
|
|
|
|
|
|
|
|
// 判断是否为分享吗
|
|
|
|
// 判断是否为分享吗
|
|
|
|
@ -800,8 +800,7 @@ func ActivityLuckyCodeDraw(c *gin.Context) { |
|
|
|
UID: a.UID, |
|
|
|
UID: a.UID, |
|
|
|
Type: common.CurrencyINR, |
|
|
|
Type: common.CurrencyINR, |
|
|
|
Value: reward, |
|
|
|
Value: reward, |
|
|
|
Event: common.CurrencyEventTask, |
|
|
|
Event: common.CurrencyEventActivityShareBind, |
|
|
|
Exi1: code, |
|
|
|
|
|
|
|
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), |
|
|
|
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
@ -813,13 +812,19 @@ func ActivityLuckyCodeDraw(c *gin.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
now := time.Now() |
|
|
|
now := time.Now() |
|
|
|
|
|
|
|
code, err := strconv.Atoi(req.LuckyCode) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
a.Code = values.CodeParam |
|
|
|
|
|
|
|
a.Msg = "The code you entered is incorrect" |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")} |
|
|
|
luckyCode := &common.ActivityLuckyCode{Code: code, Date: now.Format("20060102")} |
|
|
|
if !a.MGet(luckyCode) { |
|
|
|
err = db.Mysql().Get(&luckyCode) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
a.Code = values.CodeParam |
|
|
|
a.Code = values.CodeParam |
|
|
|
a.Msg = "The code you entered is incorrect" |
|
|
|
a.Msg = "The code you entered is incorrect" |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
codeType := luckyCode.Type |
|
|
|
codeType := luckyCode.Type |
|
|
|
data := &common.ActivityLuckyCodeData{UID: a.UID} |
|
|
|
data := &common.ActivityLuckyCodeData{UID: a.UID} |
|
|
|
db.Mysql().Get(data) |
|
|
|
db.Mysql().Get(data) |
|
|
|
@ -873,12 +878,12 @@ func ActivityLuckyCodeDraw(c *gin.Context) { |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
_, err := call.UpdateCurrencyPro(&common.UpdateCurrency{ |
|
|
|
_, err = call.UpdateCurrencyPro(&common.UpdateCurrency{ |
|
|
|
CurrencyBalance: &common.CurrencyBalance{ |
|
|
|
CurrencyBalance: &common.CurrencyBalance{ |
|
|
|
UID: a.UID, |
|
|
|
UID: a.UID, |
|
|
|
Type: common.CurrencyINR, |
|
|
|
Type: common.CurrencyINR, |
|
|
|
Value: reward, |
|
|
|
Value: reward, |
|
|
|
Event: common.CurrencyEventTask, |
|
|
|
Event: common.CurrencyEventActivityLuckyCode, |
|
|
|
Exs1: fmt.Sprintf("%d", codeType), |
|
|
|
Exs1: fmt.Sprintf("%d", codeType), |
|
|
|
Exi1: code, |
|
|
|
Exi1: code, |
|
|
|
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), |
|
|
|
NeedBet: call.GetConfigCurrencyResourceNeedBet(common.CurrencyResourceBonus, reward), |
|
|
|
@ -1465,7 +1470,7 @@ func ActivityWeekCardDraw(c *gin.Context) { |
|
|
|
log.Info("maxAmount:%v", maxAmount) |
|
|
|
log.Info("maxAmount:%v", maxAmount) |
|
|
|
ticket := call.GetConfigDiscountTicketByAmount(maxAmount) |
|
|
|
ticket := call.GetConfigDiscountTicketByAmount(maxAmount) |
|
|
|
log.Info("ticket:%v", ticket) |
|
|
|
log.Info("ticket:%v", ticket) |
|
|
|
if ticket.Id > 0 { |
|
|
|
if ticket.ID > 0 { |
|
|
|
// 赠送优惠券
|
|
|
|
// 赠送优惠券
|
|
|
|
tickets := call.GetConfigDiscountTicket() |
|
|
|
tickets := call.GetConfigDiscountTicket() |
|
|
|
sort.Slice(tickets, func(i, j int) bool { |
|
|
|
sort.Slice(tickets, func(i, j int) bool { |
|
|
|
@ -1492,7 +1497,7 @@ func ActivityWeekCardDraw(c *gin.Context) { |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) |
|
|
|
resp.DiscountTicket = ticket.DiscountAmount |
|
|
|
resp.DiscountTicket = ticket.DiscountAmount |
|
|
|
resp.Amount = ticket.RechargeAmount |
|
|
|
resp.Amount = ticket.RechargeAmount |
|
|
|
} else if nextTicket.Id > 0 { |
|
|
|
} else if nextTicket.ID > 0 { |
|
|
|
call.AddUserDiscountTicket(a.UID, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, false) |
|
|
|
call.AddUserDiscountTicket(a.UID, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, false) |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.DiscountAmount/common.DecimalDigits, ticket.RechargeAmount/common.DecimalDigits)) |
|
|
|
resp.DiscountTicket = nextTicket.DiscountAmount |
|
|
|
resp.DiscountTicket = nextTicket.DiscountAmount |
|
|
|
|