add is_superfanship_give_wechat

This commit is contained in:
lwl0608 2024-10-22 14:40:15 +08:00
parent a1a414d6da
commit 7afa5f69fe
2 changed files with 46 additions and 5 deletions

View File

@ -540,9 +540,49 @@ func (v *Vas) UnlockZoneSuperfanship(ctx *gin.Context, tx *sqlx.Tx, order *dbstr
// 超粉赠送微信
zv, _ := v.store.GetZoneVasById(ctx, zid)
if len(zv.SuperfanPriceList) <= 0 {
if zv.IsSuperfanshipGiveWechat != 1 {
return nil
}
} else {
isSuperfanshipGiveWechat := 0
switch order.GetProductId() {
case dbstruct.ProductIdH5ZoneSuperfanshipEternal:
for _, v := range zv.SuperfanPriceList {
if v.Period == dbstruct.SuperfanshipValidPeriodEternal {
isSuperfanshipGiveWechat = v.IsSuperfanshipGiveWechat
}
}
case dbstruct.ProductIdH5ZoneSuperfanshipMonth:
for _, v := range zv.SuperfanPriceList {
if v.Period == dbstruct.SuperfanshipValidPeriodMonth {
isSuperfanshipGiveWechat = v.IsSuperfanshipGiveWechat
}
}
case dbstruct.ProductIdH5ZoneSuperfanshipSeason:
for _, v := range zv.SuperfanPriceList {
if v.Period == dbstruct.SuperfanshipValidPeriodSeason {
isSuperfanshipGiveWechat = v.IsSuperfanshipGiveWechat
}
}
case dbstruct.ProductIdH5ZoneSuperfanshipHalfYear:
for _, v := range zv.SuperfanPriceList {
if v.Period == dbstruct.SuperfanshipValidPeriodHalfYear {
isSuperfanshipGiveWechat = v.IsSuperfanshipGiveWechat
}
}
case dbstruct.ProductIdH5ZoneSuperfanshipYear:
for _, v := range zv.SuperfanPriceList {
if v.Period == dbstruct.SuperfanshipValidPeriodYear {
isSuperfanshipGiveWechat = v.IsSuperfanshipGiveWechat
}
}
}
if isSuperfanshipGiveWechat != 1 {
logger.Warn("isSuperfanshipGiveWechat, orderId: %v", order.GetID())
return nil
}
}
_err = v.SuperfanUnlockContact(ctx, tx, mid, zv.Mid, orderId)
if _err != nil {
logger.Error("SuperfanUnlockContact fail, mid: %v, zid: %v, uid: %v, orderId: %v, err: %v", mid, zid, zv.Mid, orderId, _err)

View File

@ -97,6 +97,7 @@ type SuperfanPriceItem struct {
Period int `json:"period" bson:"period"`
Price int64 `json:"price" bson:"price"`
Enable int `json:"enable" bson:"enable"`
IsSuperfanshipGiveWechat int `json:"is_superfanship_give_wechat" bson:"is_superfanship_give_wechat"` // 是否开启超粉空间赠送微信 0: 不赠送, 1: 赠送
}
func (p ZoneVas) GetSuperfanshipDurationSecond() int64 {