60 lines
2.8 KiB
Go
60 lines
2.8 KiB
Go
package models
|
||
|
||
import "time"
|
||
|
||
// UserLevelConfig 用户等级配置表
|
||
type UserLevelConfig struct {
|
||
ID uint `json:"id" gorm:"primaryKey;autoIncrement;comment:主键ID"`
|
||
LevelName string `json:"level_name" gorm:"not null;uniqueIndex:uk_level_name;type:varchar(50);comment:等级名称"`
|
||
LevelCode string `json:"level_code" gorm:"not null;uniqueIndex:uk_level_code;type:varchar(50);comment:等级代码"`
|
||
ProjectLimit int `json:"project_limit" gorm:"not null;default:0;comment:项目数限制,0表示不限"`
|
||
CoderVMLimit int `json:"coder_vm_limit" gorm:"not null;default:0;comment:Coder VM上限,0表示不限"`
|
||
BrowserVMLimit int `json:"browser_vm_limit" gorm:"not null;default:0;comment:Browser VM上限,0表示不限"`
|
||
ProcessLimit int `json:"process_limit" gorm:"not null;default:0;comment:进程上限,0表示不限"`
|
||
Description string `json:"description" gorm:"type:varchar(255);comment:等级描述"`
|
||
SortOrder int `json:"sort_order" gorm:"not null;default:0;comment:排序顺序"`
|
||
Status int `json:"status" gorm:"not null;default:1;comment:状态 1-启用 0-禁用"`
|
||
CreatedAt time.Time `json:"created_at"`
|
||
UpdatedAt time.Time `json:"updated_at"`
|
||
}
|
||
|
||
func (UserLevelConfig) TableName() string {
|
||
return "admin_user_level_configs"
|
||
}
|
||
|
||
// UserLevelConfigListRequest 列表请求
|
||
type UserLevelConfigListRequest struct {
|
||
LevelName string `form:"level_name"`
|
||
Status *int `form:"status"`
|
||
Page int `form:"page,default=1"`
|
||
Size int `form:"size,default=20"`
|
||
}
|
||
|
||
// UserLevelConfigCreateRequest 创建请求
|
||
type UserLevelConfigCreateRequest struct {
|
||
LevelName string `json:"level_name" binding:"required,min=1,max=50"`
|
||
LevelCode string `json:"level_code" binding:"required,min=1,max=50"`
|
||
ProjectLimit int `json:"project_limit" binding:"min=0"`
|
||
CoderVMLimit int `json:"coder_vm_limit" binding:"min=0"`
|
||
BrowserVMLimit int `json:"browser_vm_limit" binding:"min=0"`
|
||
ProcessLimit int `json:"process_limit" binding:"min=0"`
|
||
Description string `json:"description" binding:"max=255"`
|
||
SortOrder int `json:"sort_order"`
|
||
}
|
||
|
||
// UserLevelConfigUpdateRequest 更新请求
|
||
type UserLevelConfigUpdateRequest struct {
|
||
LevelName string `json:"level_name" binding:"required,min=1,max=50"`
|
||
ProjectLimit int `json:"project_limit" binding:"min=0"`
|
||
CoderVMLimit int `json:"coder_vm_limit" binding:"min=0"`
|
||
BrowserVMLimit int `json:"browser_vm_limit" binding:"min=0"`
|
||
ProcessLimit int `json:"process_limit" binding:"min=0"`
|
||
Description string `json:"description" binding:"max=255"`
|
||
SortOrder int `json:"sort_order"`
|
||
}
|
||
|
||
// UserLevelConfigUpdateStatusRequest 更新状态请求
|
||
type UserLevelConfigUpdateStatusRequest struct {
|
||
Status int `json:"status" binding:"required,oneof=0 1"`
|
||
}
|