|
|
|
@ -1353,7 +1353,7 @@ func ActivityWeekCardInfo(c *gin.Context) { |
|
|
|
resp.RewardDay = cardInfo.Day |
|
|
|
resp.RewardDay = cardInfo.Day |
|
|
|
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR) |
|
|
|
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR) |
|
|
|
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDWeekCard) |
|
|
|
resp.ProductList = call.GetConfigPayProductByActivityID(common.ActivityIDWeekCard) |
|
|
|
if resp.Status { |
|
|
|
if resp.Status && resp.RechargeStatus { |
|
|
|
call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1) |
|
|
|
call.PushRed(a.UID, pb.RedPointModule_RedPointWeekCard, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1408,44 +1408,60 @@ func ActivityWeekCardDraw(c *gin.Context) { |
|
|
|
// 推送当前最高额度向上一档充值满减卷
|
|
|
|
// 推送当前最高额度向上一档充值满减卷
|
|
|
|
// 用户画像二:只解锁周卡,未充值的玩家
|
|
|
|
// 用户画像二:只解锁周卡,未充值的玩家
|
|
|
|
// 推送当前额度向下一档充值满减卷,最低300
|
|
|
|
// 推送当前额度向下一档充值满减卷,最低300
|
|
|
|
|
|
|
|
var list []common.CurrencyBalance |
|
|
|
q := elastic.NewBoolQuery() |
|
|
|
q := elastic.NewBoolQuery() |
|
|
|
q.Filter(elastic.NewRangeQuery("time").Gte(card.RechargeTime)) |
|
|
|
q.Filter(elastic.NewRangeQuery("time").Gte(card.RechargeTime)) |
|
|
|
q.Filter(elastic.NewRangeQuery("time").Lte(now)) |
|
|
|
q.Filter(elastic.NewRangeQuery("time").Lte(now)) |
|
|
|
q.Filter(elastic.NewRangeQuery("event").Gte(common.CurrencyEventReCharge)) |
|
|
|
q.Filter(elastic.NewRangeQuery("event").Gte(common.CurrencyEventReCharge)) |
|
|
|
q.Must(elastic.NewTermsQuery("uid", a.UID)) |
|
|
|
q.Must(elastic.NewTermsQuery("uid", a.UID)) |
|
|
|
count := db.ES().Count(common.ESIndexBalance, q) |
|
|
|
db.ES().QueryList(common.ESIndexBalance, 0, 100, q, &list, "time", true) |
|
|
|
up := false |
|
|
|
up := false |
|
|
|
if count >= 3 { |
|
|
|
maxAmount := card.RechargeAmount |
|
|
|
|
|
|
|
if len(list) >= 3 { |
|
|
|
up = true |
|
|
|
up = true |
|
|
|
|
|
|
|
for _, item := range list { |
|
|
|
|
|
|
|
if item.Value > maxAmount { |
|
|
|
|
|
|
|
maxAmount = item.Value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ticket := call.GetConfigDiscountTicketByAmount(int64(300) * common.DecimalDigits) |
|
|
|
log.Info("maxAmount:%v", maxAmount) |
|
|
|
|
|
|
|
ticket := call.GetConfigDiscountTicketByAmount(maxAmount) |
|
|
|
log.Info("ticket:%v", ticket) |
|
|
|
log.Info("ticket:%v", ticket) |
|
|
|
if ticket.Id > 0 { |
|
|
|
if ticket.Id > 0 { |
|
|
|
// 赠送优惠券
|
|
|
|
// 赠送优惠券
|
|
|
|
products := call.GetConfigPayProductByActivityID(0) |
|
|
|
tickets := call.GetConfigDiscountTicket() |
|
|
|
nextProduct := &common.ConfigPayProduct{} |
|
|
|
sort.Slice(tickets, func(i, j int) bool { |
|
|
|
for _, product := range products { |
|
|
|
return tickets[i].RechargeAmount < tickets[j].RechargeAmount |
|
|
|
if product.Amount > card.RechargeAmount && nextProduct.Amount < product.Amount { |
|
|
|
}) |
|
|
|
nextProduct = product |
|
|
|
// 获取下一档
|
|
|
|
} else if product.Amount < card.RechargeAmount && nextProduct.Amount > product.Amount { |
|
|
|
nextIdx := -1 |
|
|
|
nextProduct = product |
|
|
|
for idx, item := range tickets { |
|
|
|
|
|
|
|
if item.RechargeAmount == maxAmount { |
|
|
|
|
|
|
|
if up { |
|
|
|
|
|
|
|
nextIdx = idx + 1 |
|
|
|
|
|
|
|
} else if item.RechargeAmount >= 300*common.DecimalDigits { |
|
|
|
|
|
|
|
nextIdx = idx - 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
var nextTicket common.ConfigDiscountTicket |
|
|
|
var nextTicket = ticket |
|
|
|
if nextProduct != nil { |
|
|
|
if len(tickets) > nextIdx && nextIdx != -1 { |
|
|
|
nextTicket = call.GetConfigDiscountTicketByAmount(nextProduct.Amount) |
|
|
|
nextTicket = tickets[nextIdx] |
|
|
|
} |
|
|
|
} |
|
|
|
if up { |
|
|
|
if up { |
|
|
|
call.AddUserDiscountTicket(a.UID, ticket.DiscountAmount, ticket.RechargeAmount, -1) |
|
|
|
call.AddUserDiscountTicket(a.UID, ticket.DiscountAmount, ticket.RechargeAmount, -1, 0, false) |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.RechargeAmount/common.DecimalDigits, ticket.DiscountAmount/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.Amount = ticket.RechargeAmount |
|
|
|
} else if nextTicket.Id > 0 { |
|
|
|
} else if nextTicket.Id > 0 { |
|
|
|
call.AddUserDiscountTicket(a.UID, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1) |
|
|
|
call.AddUserDiscountTicket(a.UID, nextTicket.DiscountAmount, nextTicket.RechargeAmount, -1, 1, false) |
|
|
|
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.RechargeAmount/common.DecimalDigits, ticket.DiscountAmount/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.Amount = nextTicket.RechargeAmount |
|
|
|
} |
|
|
|
} |
|
|
|
resp.DiscountTicket = ticket.DiscountAmount |
|
|
|
|
|
|
|
resp.Amount = ticket.RechargeAmount |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
resource := common.CurrencyResourceWeekCard |
|
|
|
resource := common.CurrencyResourceWeekCard |
|
|
|
if card.Day > 0 { |
|
|
|
if card.Day > 0 { |
|
|
|
|