update
This commit is contained in:
@ -20,15 +20,6 @@ const (
|
||||
ContextTier = "tier"
|
||||
)
|
||||
|
||||
// TierFree / TierVIP 用户等级枚举值。
|
||||
const (
|
||||
TierFree = "free"
|
||||
TierVIP = "vip"
|
||||
)
|
||||
|
||||
// IsVIP 判断等级是否为 VIP。
|
||||
func IsVIP(tier string) bool { return tier == TierVIP }
|
||||
|
||||
// bearerPrefix Authorization 头的令牌前缀。
|
||||
const bearerPrefix = "Bearer "
|
||||
|
||||
@ -105,13 +96,3 @@ func UserIDFrom(c *gin.Context) (uint32, bool) {
|
||||
}
|
||||
return id, true
|
||||
}
|
||||
|
||||
// TierFrom 从 Context 取出当前用户等级;未登录(无 tier)回落 free。
|
||||
func TierFrom(c *gin.Context) string {
|
||||
if v, exists := c.Get(ContextTier); exists {
|
||||
if t, ok := v.(string); ok && t != "" {
|
||||
return t
|
||||
}
|
||||
}
|
||||
return TierFree
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user