Merge branch 'dev-lwl/unlock_opt' into test

This commit is contained in:
lwl0608 2024-10-22 14:40:31 +08:00
commit c5bceacb14
2 changed files with 46 additions and 5 deletions

View File

@ -540,8 +540,48 @@ func (v *Vas) UnlockZoneSuperfanship(ctx *gin.Context, tx *sqlx.Tx, order *dbstr
// 超粉赠送微信
zv, _ := v.store.GetZoneVasById(ctx, zid)
if zv.IsSuperfanshipGiveWechat != 1 {
return nil
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 {

View File

@ -94,9 +94,10 @@ type ZoneVas struct {
}
type SuperfanPriceItem struct {
Period int `json:"period" bson:"period"`
Price int64 `json:"price" bson:"price"`
Enable int `json:"enable" bson:"enable"`
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 {