From 7825f3bbf4a6bf461b7e436037e3c7f165317ba6 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Mon, 6 May 2024 14:20:43 +0800 Subject: [PATCH] isvip logic --- dbstruct/vas_mysql.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/dbstruct/vas_mysql.go b/dbstruct/vas_mysql.go index bfabfa98..e7bfac35 100644 --- a/dbstruct/vas_mysql.go +++ b/dbstruct/vas_mysql.go @@ -23,6 +23,14 @@ var OrderStatusDescMap = map[int32]string{ VasOrderStatusRefund: "已退款", } +var ZoneVIPMidMap = map[int64]bool{ + 161: true, +} + +func IsVIP(mid int64) bool { + return ZoneVIPMidMap[mid] +} + // 现金订单 type Order struct { ID *string `json:"id" db:"id"` // 订单id @@ -979,7 +987,7 @@ type ZoneUnlock struct { } func (p *ZoneUnlock) IsUnlockAdmission() bool { - if p.IsVIP() { + if IsVIP(p.GetMid()) { return true } if ValidZoneUnlockType[p.GetAdmissionUnlockType()] && @@ -990,7 +998,7 @@ func (p *ZoneUnlock) IsUnlockAdmission() bool { } func (p *ZoneUnlock) IsUnlockIronfanship() bool { - if p.IsVIP() { + if IsVIP(p.GetMid()) { return true } if ValidZoneUnlockType[p.GetIronfanshipUnlockType()] && p.IsUnlockAdmission() && @@ -1001,7 +1009,7 @@ func (p *ZoneUnlock) IsUnlockIronfanship() bool { } func (p *ZoneUnlock) IsUnlockSuperfanship() bool { - if p.IsVIP() { + if IsVIP(p.GetMid()) { return true } if ValidZoneUnlockType[p.GetSuperfanshipUnlockType()] && p.IsUnlockAdmission() && @@ -1011,13 +1019,6 @@ func (p *ZoneUnlock) IsUnlockSuperfanship() bool { return false } -func (p *ZoneUnlock) IsVIP() bool { - if p.GetOid5() == "vip" { - return true - } - return false -} - func (p *ZoneUnlock) GetId() int64 { if p != nil && p.AdmissionCt != nil { return *p.AdmissionCt @@ -1265,6 +1266,9 @@ type ZoneMomentUnlock struct { } func (p *ZoneMomentUnlock) IsUnlock() bool { + if IsVIP(p.GetMid()) { + return true + } if p.GetStatus() == ZoneMomentUnlockStatusUnlock { return true }