60 lines
1.7 KiB
Go
60 lines
1.7 KiB
Go
package consts
|
||
|
||
import "quyun/v2/app/requests"
|
||
|
||
// swagger:enum TenantInviteStatus
|
||
// ENUM( active, disabled, expired )
|
||
type TenantInviteStatus string
|
||
|
||
// Description 返回枚举值的中文含义,用于前端展示与审计日志输出。
|
||
func (t TenantInviteStatus) Description() string {
|
||
switch t {
|
||
case TenantInviteStatusActive:
|
||
return "可用"
|
||
case TenantInviteStatusDisabled:
|
||
return "已禁用"
|
||
case TenantInviteStatusExpired:
|
||
return "已过期"
|
||
default:
|
||
return "未知状态"
|
||
}
|
||
}
|
||
|
||
// TenantInviteStatusItems 返回前端下拉选项(Key=枚举字符串,Value=中文描述)。
|
||
func TenantInviteStatusItems() []requests.KV {
|
||
values := TenantInviteStatusValues()
|
||
items := make([]requests.KV, 0, len(values))
|
||
for _, v := range values {
|
||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||
}
|
||
return items
|
||
}
|
||
|
||
// swagger:enum TenantJoinRequestStatus
|
||
// ENUM( pending, approved, rejected )
|
||
type TenantJoinRequestStatus string
|
||
|
||
// Description 返回枚举值的中文含义,用于前端展示与审计日志输出。
|
||
func (t TenantJoinRequestStatus) Description() string {
|
||
switch t {
|
||
case TenantJoinRequestStatusPending:
|
||
return "待审核"
|
||
case TenantJoinRequestStatusApproved:
|
||
return "已通过"
|
||
case TenantJoinRequestStatusRejected:
|
||
return "已拒绝"
|
||
default:
|
||
return "未知状态"
|
||
}
|
||
}
|
||
|
||
// TenantJoinRequestStatusItems 返回前端下拉选项(Key=枚举字符串,Value=中文描述)。
|
||
func TenantJoinRequestStatusItems() []requests.KV {
|
||
values := TenantJoinRequestStatusValues()
|
||
items := make([]requests.KV, 0, len(values))
|
||
for _, v := range values {
|
||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||
}
|
||
return items
|
||
}
|