优惠券信息

dev_aagame_provider
zhora 3 weeks ago
parent a61dde85f5
commit d17c81ceb5
  1. 6
      call/item.go
  2. 12
      modules/web/handler/user.go
  3. 12
      modules/web/values/protocol.go

@ -26,6 +26,12 @@ func GetUserValidItems(uid, itemID int) []*common.PlayerItems {
return list
}
func GetUserValidItemsMax(uid, itemID int) common.PlayerItems {
var result common.PlayerItems
_ = db.Mysql().C().Model(&common.PlayerItems{}).Where("uid = ? and item_id = ? and `status` = ?", uid, itemID, common.ItemStatusNormal).Order("Exi1 desc").Limit(1).Find(&result).Error
return result
}
func GetUserItemByExi1(uid, itemID, exi1 int) []*common.PlayerItems {
list := []*common.PlayerItems{}
db.Mysql().QueryAll(fmt.Sprintf("uid = %d and item_id = %d and exi1 = %d and status = %d", uid, itemID, exi1, common.ItemStatusNormal), "", &common.PlayerItems{}, &list)

@ -43,6 +43,12 @@ func getUserInfo(uid int, isNew bool) (resp values.UserInfoResp, err error) {
resp.Activitys.DaySign = call.ShouldShowActivitySign(uid)
resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid)
resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct {
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
}
vip := call.GetVipCon(uid)
var nextVip *common.ConfigVIP
if vip != nil {
@ -133,6 +139,12 @@ func GetUserInfo(c *gin.Context) {
resp.Activitys.DaySign = call.ShouldShowActivitySign(uid)
resp.Activitys.WeekCard = call.ShouldShowActivityWeekCard(uid)
resp.Activitys.LuckyShop = call.ShouldShowActivityLuckShop(uid)
if ticker := call.GetUserValidItemsMax(uid, common.ItemDiscountTicket); ticker.ID > 0 {
resp.Activitys.DiscountTicket = struct {
Amount int64
DiscountAmount int64
}{Amount: ticker.Exi2, DiscountAmount: ticker.Exi1}
}
vip := call.GetVipCon(a.UID)
nextVip := call.GetConfigVIPByLevel(vip.Level + 1)
resp.CurrentVip.Bonus = vip.Bonus

@ -64,10 +64,14 @@ type UserInfoResp struct {
CurrentVip *OneUserInfoVip
NextVip *OneUserInfoVip
Activitys struct {
RechargeBack bool
DaySign bool
WeekCard bool // 是否弹出周卡
LuckyShop bool // 是否弹出幸运商店
RechargeBack bool
DaySign bool
WeekCard bool // 是否弹出周卡
LuckyShop bool // 是否弹出幸运商店
DiscountTicket struct {
Amount int64 // 优惠券额度
DiscountAmount int64 // 优惠金额
} // 优惠金额最大优惠券
}
}

Loading…
Cancel
Save