feat: implement new structure
This commit is contained in:
127
backend/pkg/consts/api_enums.go
Normal file
127
backend/pkg/consts/api_enums.go
Normal file
@@ -0,0 +1,127 @@
|
||||
package consts
|
||||
|
||||
import "quyun/v2/app/requests"
|
||||
|
||||
// swagger:enum Gender
|
||||
// ENUM( male, female, secret )
|
||||
type Gender string
|
||||
|
||||
func (t Gender) Description() string {
|
||||
switch t {
|
||||
case GenderMale:
|
||||
return "男"
|
||||
case GenderFemale:
|
||||
return "女"
|
||||
case GenderSecret:
|
||||
return "保密"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
func GenderItems() []requests.KV {
|
||||
values := GenderValues()
|
||||
items := make([]requests.KV, 0, len(values))
|
||||
for _, v := range values {
|
||||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// swagger:enum UserContentActionType
|
||||
// ENUM( like, favorite )
|
||||
type UserContentActionType string
|
||||
|
||||
func (t UserContentActionType) Description() string {
|
||||
switch t {
|
||||
case UserContentActionTypeLike:
|
||||
return "点赞"
|
||||
case UserContentActionTypeFavorite:
|
||||
return "收藏"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
func UserContentActionTypeItems() []requests.KV {
|
||||
values := UserContentActionTypeValues()
|
||||
items := make([]requests.KV, 0, len(values))
|
||||
for _, v := range values {
|
||||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// swagger:enum UserCommentActionType
|
||||
// ENUM( like )
|
||||
type UserCommentActionType string
|
||||
|
||||
func (t UserCommentActionType) Description() string {
|
||||
switch t {
|
||||
case UserCommentActionTypeLike:
|
||||
return "点赞"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
func UserCommentActionTypeItems() []requests.KV {
|
||||
values := UserCommentActionTypeValues()
|
||||
items := make([]requests.KV, 0, len(values))
|
||||
for _, v := range values {
|
||||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// swagger:enum PayoutAccountType
|
||||
// ENUM( bank, alipay )
|
||||
type PayoutAccountType string
|
||||
|
||||
func (t PayoutAccountType) Description() string {
|
||||
switch t {
|
||||
case PayoutAccountTypeBank:
|
||||
return "银行卡"
|
||||
case PayoutAccountTypeAlipay:
|
||||
return "支付宝"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
func PayoutAccountTypeItems() []requests.KV {
|
||||
values := PayoutAccountTypeValues()
|
||||
items := make([]requests.KV, 0, len(values))
|
||||
for _, v := range values {
|
||||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// swagger:enum NotificationType
|
||||
// ENUM( system, order, audit, interaction )
|
||||
type NotificationType string
|
||||
|
||||
func (t NotificationType) Description() string {
|
||||
switch t {
|
||||
case NotificationTypeSystem:
|
||||
return "系统通知"
|
||||
case NotificationTypeOrder:
|
||||
return "订单通知"
|
||||
case NotificationTypeAudit:
|
||||
return "审核通知"
|
||||
case NotificationTypeInteraction:
|
||||
return "互动通知"
|
||||
default:
|
||||
return "未知"
|
||||
}
|
||||
}
|
||||
|
||||
func NotificationTypeItems() []requests.KV {
|
||||
values := NotificationTypeValues()
|
||||
items := make([]requests.KV, 0, len(values))
|
||||
for _, v := range values {
|
||||
items = append(items, requests.NewKV(string(v), v.Description()))
|
||||
}
|
||||
return items
|
||||
}
|
||||
Reference in New Issue
Block a user