You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.3 KiB
52 lines
2.3 KiB
package values |
|
|
|
// User 后台用户 |
|
type User struct { |
|
Name string `gorm:"column:name;type:varchar(32);uniqueIndex:name;not null;comment:名字" json:"Name"` |
|
Account string `gorm:"column:account;type:varchar(32);uniqueIndex:account;not null;comment:账号" json:"Account"` |
|
Password string `gorm:"column:password;type:varchar(32);not null;comment:密码" json:"Password"` |
|
ID uint `gorm:"primarykey"` |
|
Role int `gorm:"column:role;type:tinyint(4);not null;comment:角色" json:"Role"` |
|
Power string `gorm:"column:power;type:varchar(512);not null;comment:权限" json:"Power"` |
|
PowerMap map[int][]int `gorm:"-" json:"PowerMap"` |
|
Phone string `gorm:"column:phone;type:varchar(32);uniqueIndex:phone;comment:手机号" json:"Phone"` |
|
Channels string `gorm:"column:channels;type:varchar(512);not null;comment:拥有权限的包,为空时代表所有包都有权限" json:"Channels"` |
|
SChannels []int `gorm:"-"` |
|
} |
|
|
|
func (u *User) TableName() string { |
|
return "users" |
|
} |
|
|
|
// EditHistory 后台修改操作历史 |
|
// Operator 操作人 |
|
// Detail 修改内容 |
|
// Time 时间 |
|
// Model 操作模块,与权限列表对应 |
|
type EditHistory struct { |
|
Operator string `gorm:"column:operator;type:varchar(32);not null;comment:操作人" json:"Operator"` |
|
Detail string `gorm:"column:detail;type:varchar(256);not null;comment:修改明细" json:"Detail"` |
|
ID uint `gorm:"primarykey" json:"-"` |
|
Time int64 `gorm:"column:time;type:bigint(20);default:0;comment:操作时间" json:"Time"` |
|
UID int `gorm:"column:uid;type:int(11);comment:操作人id" json:"UID"` |
|
Model int `gorm:"column:model;type:int(11);comment:操作功能模块" json:"Model"` |
|
} |
|
|
|
func (e *EditHistory) TableName() string { |
|
return "edit_history" |
|
} |
|
|
|
// Role 后台角色 |
|
// Role 角色等级 1是超管 |
|
// Power 权限 |
|
// Name 角色名 |
|
type Role struct { |
|
ID uint `gorm:"primarykey"` |
|
Role int `gorm:"column:role;type:tinyint(4);uniqueIndex:role;not null;comment:角色等级" json:"Role"` |
|
Power string `gorm:"column:power;type:varchar(512);not null;comment:权限" json:"Power"` |
|
Name string `gorm:"column:name;type:varchar(32);uniqueIndex:name;not null;comment:角色名" json:"Name"` |
|
} |
|
|
|
func (u *Role) TableName() string { |
|
return "role" |
|
}
|
|
|