This commit is contained in:
lwl0608 2024-04-22 21:58:05 +08:00
parent ca924bf81a
commit 27ef585eb0
1 changed files with 35 additions and 3 deletions

View File

@ -941,6 +941,14 @@ const (
ZoneUnlockTypeCollaborator = 5 // 协作者直接解锁
)
var ValidZoneUnlockType = map[int32]bool{
ZoneUnlockTypeFree: true,
ZoneUnlockTypePay: true,
ZoneUnlockTypeReachConsume: true,
ZoneUnlockTypeThirdPartner: true,
ZoneUnlockTypeCollaborator: true,
}
type ZoneUnlock struct {
Id *int64 `json:"id" db:"id"`
Mid *int64 `json:"mid" db:"mid"` // 用户mid
@ -966,21 +974,24 @@ type ZoneUnlock struct {
}
func (p *ZoneUnlock) IsUnlockAdmission() bool {
if p.GetAdmissionUntil() == -1 || p.GetAdmissionUntil() >= time.Now().Unix() {
if ValidZoneUnlockType[p.GetAdmissionUnlockType()] &&
(p.GetAdmissionUntil() == -1 || p.GetAdmissionUntil() >= time.Now().Unix()) {
return true
}
return false
}
func (p *ZoneUnlock) IsUnlockIronfanship() bool {
if p.IsUnlockAdmission() && (p.GetIronfanshipUntil() == -1 || p.GetIronfanshipUntil() >= time.Now().Unix()) {
if ValidZoneUnlockType[p.GetIronfanshipUnlockType()] && p.IsUnlockAdmission() &&
(p.GetIronfanshipUntil() == -1 || p.GetIronfanshipUntil() >= time.Now().Unix()) {
return true
}
return false
}
func (p *ZoneUnlock) IsUnlockSuperfanship() bool {
if p.IsUnlockAdmission() && (p.GetSuperfanshipUntil() == -1 || p.GetSuperfanshipUntil() >= time.Now().Unix()) {
if ValidZoneUnlockType[p.GetSuperfanshipUnlockType()] && p.IsUnlockAdmission() &&
(p.GetSuperfanshipUntil() == -1 || p.GetSuperfanshipUntil() >= time.Now().Unix()) {
return true
}
return false
@ -1035,6 +1046,13 @@ func (p *ZoneUnlock) GetAdmissionOrderId() string {
return ""
}
func (p *ZoneUnlock) GetAdmissionUnlockType() int32 {
if p != nil && p.AdmissionUnlockType != nil {
return *p.AdmissionUnlockType
}
return 0
}
func (p *ZoneUnlock) GetIronfanshipCt() int64 {
if p != nil && p.IronfanshipCt != nil {
return *p.IronfanshipCt
@ -1056,6 +1074,13 @@ func (p *ZoneUnlock) GetIronfanshipOrderId() string {
return ""
}
func (p *ZoneUnlock) GetIronfanshipUnlockType() int32 {
if p != nil && p.IronfanshipUnlockType != nil {
return *p.IronfanshipUnlockType
}
return 0
}
func (p *ZoneUnlock) GetSuperfanshipCt() int64 {
if p != nil && p.SuperfanshipCt != nil {
return *p.SuperfanshipCt
@ -1077,6 +1102,13 @@ func (p *ZoneUnlock) GetSuperfanshipOrderId() string {
return ""
}
func (p *ZoneUnlock) GetSuperfanshipUnlockType() int32 {
if p != nil && p.SuperfanshipUnlockType != nil {
return *p.SuperfanshipUnlockType
}
return 0
}
// 空间消费详情
type ZoneConsumeHis struct {
Id *int64 `json:"id" db:"id"`