✨ 完成基础model部分
This commit is contained in:
6
common/constant/rds_key.go
Normal file
6
common/constant/rds_key.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
OAuth2RedisKey = "oauth:token:" // Token缓存前缀
|
||||
OAuth2UserCacheKey = "oauth:user:" // 用户缓存前缀
|
||||
)
|
38
common/constant/user.go
Normal file
38
common/constant/user.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package constant
|
||||
|
||||
// UserStatus 用户状态
|
||||
type UserStatus string
|
||||
|
||||
const (
|
||||
UserStatusActive UserStatus = "NORMAL" // 用户状态正常
|
||||
UserStatusDisabled UserStatus = "DISABLE" // 已禁用用户
|
||||
)
|
||||
|
||||
// 状态对应的描述
|
||||
var userStatusMap = map[UserStatus]string{
|
||||
UserStatusActive: "正常",
|
||||
UserStatusDisabled: "已禁用",
|
||||
}
|
||||
|
||||
// 处理为看得懂的状态
|
||||
func (s UserStatus) String() string {
|
||||
if str, ok := userStatusMap[s]; ok {
|
||||
return str
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// =====================================================================================================================
|
||||
|
||||
// UserIdentity 用户身份
|
||||
type UserIdentity string
|
||||
|
||||
const (
|
||||
UserIdentityAdmin UserIdentity = "admin" // 管理员
|
||||
UserIdentityUser UserIdentity = "user" // 普通用户
|
||||
)
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (t UserIdentity) String() string {
|
||||
return string(t)
|
||||
}
|
Reference in New Issue
Block a user