优惠券接口

dev
mofangmin 1 year ago
parent 38f930ad38
commit 452911d4a9
  1. 1
      call/pay.go
  2. 43
      modules/web/handler/activity.go
  3. 2
      modules/web/handler/mail.go
  4. 7
      modules/web/values/activity.go

@ -214,6 +214,7 @@ func RechargeCallback(r *common.RechargeOrder, success bool, payAccount, extra s
} }
if r.ProductID == 0 { if r.ProductID == 0 {
ticket := GetConfigDiscountTicketByAmount(r.Amount) ticket := GetConfigDiscountTicketByAmount(r.Amount)
log.Info("ticket:%v", ticket)
if ticket.Id > 0 { if ticket.Id > 0 {
// 赠送优惠券 // 赠送优惠券
products := GetConfigPayProductByActivityID(0) products := GetConfigPayProductByActivityID(0)

@ -1306,7 +1306,6 @@ func ActivityWeekCardInfo(c *gin.Context) {
} }
rewardList = append([]int64{cons.DayOneReward}, rewardList...) rewardList = append([]int64{cons.DayOneReward}, rewardList...)
rewardList = append(rewardList, 0) rewardList = append(rewardList, 0)
if cardInfo.ID <= 0 || len(cardInfo.Rewards) == 0 { if cardInfo.ID <= 0 || len(cardInfo.Rewards) == 0 {
cardInfo.Day = 0 cardInfo.Day = 0
rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5) rewardList, err = util.GenerateRandomSequence(cons.RewardAmount, cons.MiniLimit, 5)
@ -1373,7 +1372,7 @@ func ActivityWeekCardDraw(c *gin.Context) {
} }
resp := &values.ActivityWeekCardDrawResp{} resp := &values.ActivityWeekCardDrawResp{}
a.Data = resp a.Data = resp
conf := call.GetConfigActivityWeekCard() // conf := call.GetConfigActivityWeekCard()
card := call.GetUserWeekCard(a.UID) card := call.GetUserWeekCard(a.UID)
if card.ID == 0 { if card.ID == 0 {
a.Code = values.CodeRetry a.Code = values.CodeRetry
@ -1419,19 +1418,34 @@ func ActivityWeekCardDraw(c *gin.Context) {
if count >= 3 { if count >= 3 {
up = true up = true
} }
exi2 := int64(300) * common.DecimalDigits ticket := call.GetConfigDiscountTicketByAmount(int64(300) * common.DecimalDigits)
// 判断充值的金额 log.Info("ticket:%v", ticket)
productList := call.GetConfigPayProduct() if ticket.Id > 0 {
for _, product := range productList { // 赠送优惠券
if product.Amount > card.RechargeAmount && up && exi2 < product.Amount { products := call.GetConfigPayProductByActivityID(0)
exi2 = product.Amount nextProduct := &common.ConfigPayProduct{}
} else if product.Amount < card.RechargeAmount && up && exi2 > product.Amount { for _, product := range products {
exi2 = product.Amount if product.Amount > card.RechargeAmount && nextProduct.Amount < product.Amount {
nextProduct = product
} else if product.Amount < card.RechargeAmount && nextProduct.Amount > product.Amount {
nextProduct = product
}
}
var nextTicket common.ConfigDiscountTicket
if nextProduct != nil {
nextTicket = call.GetConfigDiscountTicketByAmount(nextProduct.Amount)
}
if up {
call.AddUserDiscountTicket(a.UID, ticket.RechargeAmount, ticket.DiscountAmount, -1)
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.RechargeAmount/common.DecimalDigits, ticket.DiscountAmount/common.DecimalDigits))
} else if nextTicket.Id > 0 {
call.AddUserDiscountTicket(a.UID, nextTicket.RechargeAmount, nextTicket.DiscountAmount, -1)
call.SendMailWithContent(a.UID, call.SystemTitle, fmt.Sprintf(call.EmailDiscount, ticket.RechargeAmount/common.DecimalDigits, ticket.DiscountAmount/common.DecimalDigits))
} }
resp.DiscountTicket = ticket.DiscountAmount
resp.Amount = ticket.RechargeAmount
} }
call.AddUserDiscountTicket(a.UID, exi2-exi2*conf.Discount/100, exi2, -1)
resp.DiscountTicket = conf.Discount
resp.Amount = exi2
} }
resource := common.CurrencyResourceWeekCard resource := common.CurrencyResourceWeekCard
if card.Day > 0 { if card.Day > 0 {
@ -1935,6 +1949,7 @@ func ActivityBetDrawInfo(c *gin.Context) {
drawInfo.SpinInfo.SpinNum < drawInfo.SpinInfo.SpinCount && drawInfo.SpinInfo.SpinNum < drawInfo.SpinInfo.SpinCount &&
now.Unix() >= drawInfo.SpinInfo.NextSpinTIme { now.Unix() >= drawInfo.SpinInfo.NextSpinTIme {
call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(1)) call.PushRed(a.UID, pb.RedPointModule_RedPointFreeSpin, uint32(1))
break
} }
} }
} }
@ -2119,6 +2134,8 @@ func DiscountTicketInfo(c *gin.Context) {
resp.Ticket = &values.DiscountTicketInfo{ resp.Ticket = &values.DiscountTicketInfo{
Amount: list[0].Exi1, Amount: list[0].Exi1,
Discount: list[0].Exi2, Discount: list[0].Exi2,
Id: int64(list[0].ID),
} }
} }
resp.ChannelList = call.GetConfigPayChannelsByID(common.CurrencyINR)
} }

@ -6,6 +6,7 @@ import (
"server/db" "server/db"
"server/modules/web/app" "server/modules/web/app"
"server/modules/web/values" "server/modules/web/values"
"server/pb"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/liangdas/mqant/log" "github.com/liangdas/mqant/log"
@ -41,6 +42,7 @@ func MailList(c *gin.Context) {
Count: int(count), Count: int(count),
} }
a.Data = resp a.Data = resp
call.PushRed(a.UID, pb.RedPointModule_RedPointMail, 0)
} }
func ReadMail(c *gin.Context) { func ReadMail(c *gin.Context) {

@ -316,9 +316,12 @@ type ActivityFirstRechargeInfoResp struct {
} }
type DiscountTicketInfo struct { type DiscountTicketInfo struct {
Amount int64 Id int64
Amount int64
Discount int64 Discount int64
} }
type DiscountTicketResp struct { type DiscountTicketResp struct {
Ticket *DiscountTicketInfo Ticket *DiscountTicketInfo
ChannelList []*common.ConfigPayChannels
} }

Loading…
Cancel
Save