Documentation
¶
Index ¶
- Constants
- func Find(tx *gorm.DB) (data []map[string]interface{}, err error)
- func LoadEnforce() *casbin.SyncedEnforcer
- func RewriteWelcome(title, scPath string)
- type AuthDetail
- type ExaFile
- type JWT
- type LocalTime
- func (t LocalTime) Day() int
- func (t LocalTime) Format(layout ...string) string
- func (lt *LocalTime) GobDecode(data []byte) error
- func (lt LocalTime) GobEncode() ([]byte, error)
- func (t LocalTime) MarshalJSON() ([]byte, error)
- func (t LocalTime) Month() time.Month
- func (t LocalTime) Now() *LocalTime
- func (t *LocalTime) Scan(v interface{}) error
- func (t *LocalTime) UnmarshalJSON(data []byte) (err error)
- func (t LocalTime) Value() (driver.Value, error)
- func (t LocalTime) Year() int
- type M
- type Meta
- type Model
- type ModelWithoutID
- type SysApi
- type SysAuth
- func (s SysAuth) LoadApiDetailByUserId(id int) (list [][]string, err error)
- func (s SysAuth) LoadDetail(id int, module string) (curSet, resultSet AuthDetail, otherSetList []AuthDetail, err error)
- func (s SysAuth) LoadMenuIdListByUserId(id int) (list []int, err error)
- func (SysAuth) SplitStr() string
- func (SysAuth) TableName() string
- type SysCasbinRole
- type SysDepartment
- type SysFile
- func (s SysFile) DeleteFile(file SysFile) (err error)
- func (s SysFile) EditFileName(file SysFile) (err error)
- func (s SysFile) FindFile(id int) (SysFile, error)
- func (s SysFile) FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (file ExaFile, err error)
- func (SysFile) TableName() string
- func (s SysFile) Upload(file *SysFile) error
- type SysFileGroup
- type SysMenu
- func (s SysMenu) All(loadSystem bool) []SysMenu
- func (s *SysMenu) BeforeSave(tx *gorm.DB) error
- func (s SysMenu) SystemMenu() []SysMenu
- func (s SysMenu) TableName() string
- func (s SysMenu) TranMap() map[int]string
- func (s SysMenu) Tree(loadSystem, withApi, buildTree, loadHidden, sort bool, userid ...int) ([]SysMenu, error)
- type SysRole
- type SysUser
- func (s *SysUser) Create() error
- func (s SysUser) Detail(id int) (user SysUser, err error)
- func (s SysUser) Login(username, password string) (user SysUser, err error)
- func (s SysUser) PasswordConfound(p string) string
- func (s SysUser) TableName() string
- func (u *SysUser) UnmarshalJSON(data []byte) error
- func (s SysUser) Update(data SysUser) error
- type SysUserDepartment
- type SysUserRole
- type UserConfig
Constants ¶
View Source
const ( TimeZone = "Asia/Shanghai" TimeFormat = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func LoadEnforce ¶
func LoadEnforce() *casbin.SyncedEnforcer
func RewriteWelcome ¶
func RewriteWelcome(title, scPath string)
Types ¶
type AuthDetail ¶
type ExaFile ¶
type ExaFile struct {
Model
FileName string
FileMd5 string
FilePath string
ChunkTotal int
IsFinish bool
}
file struct, 文件结构体
type Meta ¶
type Meta struct {
Title string `json:"title" gorm:"size:50;comment:菜单名"`
KeepAlive bool `json:"keep_alive" gorm:"comment:是否缓存"`
DefaultMenu bool `json:"default_menu" gorm:"comment:是否是基础路由"`
Icon string `json:"icon" gorm:"size:255;comment:菜单图标"`
AutoClose bool `json:"auto_close" gorm:"comment:自动关闭tab"`
SCPath string `json:"sc_path" gorm:"size:255;comment:服务端模版地址"`
ActionList map[string]interface{} `json:"action_list" gorm:"serializer:json;comment:动作列表"` // 列举了当前模块下所有按钮是否展示,对应前端应该从当前路由的 meta 数据中读取当前用户权限下的列表,并在页面的按钮上使用 v-if="$router.currenRouter.actionList['edit'] != false"
ApiList []SysApi `json:"api_list" gorm:"-"` // Api 列表
}
type Model ¶
type Model struct {
ID int `json:"id" gorm:"type:int(11);primaryKey;comment:主键" uri:"id"`
Cb int `json:"cb,omitempty" gorm:"type:int(11);comment:创建者"`
Ub int `json:"ub,omitempty" gorm:"type:int(11);comment:更新者"`
Db int `json:"-" gorm:"type:int(11);comment:删除者"`
Ct *LocalTime `json:"ct,omitempty" gorm:"type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间"`
Ut *LocalTime `json:"ut,omitempty" gorm:"type:datetime;default:NULL ON UPDATE CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间"`
Dt gorm.DeletedAt `json:"-" gorm:"type:datetime;index;comment:删除时间"`
CbName string `json:"cb_name,omitempty" gorm:"-:all"` // 创建者
UbName string `json:"ub_name,omitempty" gorm:"-:all"` // 更新者
DbName string `json:"db_name,omitempty" gorm:"-:all"` // 删除者
}
type ModelWithoutID ¶
type ModelWithoutID struct {
ID int `json:"-" gorm:"type:int(11);primaryKey;comment:主键" uri:"id"`
Cb int `json:"cb,omitempty" gorm:"type:int(11);comment:创建者"`
Ub int `json:"ub,omitempty" gorm:"type:int(11);comment:更新者"`
Db int `json:"-" gorm:"type:int(11);comment:删除者"`
Ct *LocalTime `json:"ct,omitempty" gorm:"type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间"`
Ut *LocalTime `json:"ut,omitempty" gorm:"type:datetime;default:NULL ON UPDATE CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间"`
Dt gorm.DeletedAt `json:"-" gorm:"type:datetime;index;comment:删除时间"`
CbName string `json:"cb_name,omitempty" gorm:"-:all"` // 创建者
UbName string `json:"ub_name,omitempty" gorm:"-:all"` // 更新者
DbName string `json:"db_name,omitempty" gorm:"-:all"` // 删除者
}
func (ModelWithoutID) GetId ¶
func (m ModelWithoutID) GetId() int
type SysApi ¶
type SysApi struct {
Model
MenuId int `json:"menu_id" gorm:"type:int(11);comment:菜单Id"`
MenuName string `json:"menu_name" gorm:"-"`
Name string `json:"name" gorm:"size:50;comment:api名称"`
Description string `json:"description" gorm:"size:255;comment:api简介"`
Path string `json:"path" gorm:"size:255;comment:api路径"`
Method string `json:"method" gorm:"default:POST;comment:方法:创建POST(默认)|查看GET|更新PUT|删除DELETE"`
Premiss int `json:"premiss,omitempty" gorm:"-"` // 权限列表展示使用
}
type SysAuth ¶
type SysAuth struct {
Model
TableId int `json:"table_id" gorm:"type:int(11);comment:表ID"`
TableModule string `json:"table_module" gorm:"size:100;comment:表模块"`
Type string `json:"type" gorm:"size:100;comment:类型: menu,api,action"`
Key string `json:"key" gorm:"size:50;comment:数据标记: menu: id, api: id, action: mapKey"`
SetValue int `json:"set_value" gorm:"type:int(11);comment:设置值"`
}
func (SysAuth) LoadApiDetailByUserId ¶
func (SysAuth) LoadDetail ¶
func (s SysAuth) LoadDetail(id int, module string) (curSet, resultSet AuthDetail, otherSetList []AuthDetail, err error)
func (SysAuth) LoadMenuIdListByUserId ¶
type SysCasbinRole ¶
type SysCasbinRole struct{}
func (SysCasbinRole) ClearCasbin ¶
func (s SysCasbinRole) ClearCasbin(v int, p ...string) bool
func (SysCasbinRole) UpdateCasbin ¶
func (s SysCasbinRole) UpdateCasbin(authorityId int) error
type SysDepartment ¶
type SysDepartment struct {
Model
Pid int `json:"pid" gorm:"type:int(11);comment:父级Id"`
Name string `json:"name" gorm:"size:50;comment:角色名称"`
Description string `json:"description" gorm:"size:255;comment:角色简介"`
Children []SysDepartment `json:"children" gorm:"-"`
UserList []*SysUser `json:"user_list,omitempty" gorm:"many2many:sys_user_department"`
}
func (SysDepartment) All ¶
func (s SysDepartment) All() ([]SysDepartment, error)
func (SysDepartment) TableName ¶
func (SysDepartment) TableName() string
type SysFile ¶
type SysFile struct {
Model
GroupId int `json:"group_id" gorm:"comment:路径id"` // 路径id
GroupInfo SysFileGroup `json:"group_info" gorm:"foreignKey:GroupId;references:ID"`
Name string `json:"name" gorm:"comment:文件名"` // 文件名
Url string `json:"url" gorm:"comment:文件地址"` // 文件地址
Tag string `json:"tag" gorm:"comment:文件标签"` // 文件标签
Key string `json:"key" gorm:"comment:编号"` // 编号
UUID string `json:"uuid" gorm:"comment:回调uuid"` // 回调uuid
Size int64 `json:"size" gorm:"comment:文件大小"` // 文件大小
}
func (SysFile) DeleteFile ¶
func (SysFile) EditFileName ¶
func (SysFile) FindOrCreateFile ¶
type SysFileGroup ¶
type SysFileGroup struct {
Model
ParentId int `json:"parent_id" gorm:"comment:父级id"` // 父级id
Name string `json:"name" gorm:"comment:路径"` // 路径
Desc string `json:"desc" gorm:"comment:描述"` // 描述
Files []SysFile `json:"files" gorm:"foreignKey:GroupId;references:ID"`
Children []SysFileGroup `json:"children,omitempty" gorm:"-"`
}
func (SysFileGroup) TableName ¶
func (SysFileGroup) TableName() string
func (SysFileGroup) Tree ¶
func (s SysFileGroup) Tree(userId int) ([]SysFileGroup, error)
type SysMenu ¶
type SysMenu struct {
Model
Pid int `json:"pid" gorm:"type:int(11);comment:父级Id"`
Name string `json:"name" gorm:"unique;size:50;comment:菜单名称"`
Path string `json:"path" gorm:"size:50;comment:路由地址"`
Hidden bool `json:"hidden" gorm:"comment:是否隐藏"`
Component string `json:"component" gorm:"size:255;comment:模版地址"`
Sort int `json:"sort" gorm:"type:int(11);comment:排序"`
Children []SysMenu `json:"children" gorm:"-"`
Meta `json:"meta" gorm:"embedded;comment:附加属性"`
Premiss int `json:"premiss,omitempty" gorm:"-"` // 权限列表展示使用
}
func (SysMenu) SystemMenu ¶
type SysRole ¶
type SysUser ¶
type SysUser struct {
Model
UUID uuid.UUID `json:"uuid" gorm:"index;size:60;comment:用户UUID"`
Username string `json:"username" gorm:"index;size:30;uniqueIndex:idx_username;comment:用户登录名"`
Phone string `json:"phone" gorm:"size:30;comment:用户手机号"`
Email string `json:"email" gorm:"size:60;comment:用户邮箱"`
Salt string `json:"-" gorm:"size:16;comment:密码混淆"`
Password string `json:"-" gorm:"size:255;comment:用户登录密码"`
NickName string `json:"nick_name" gorm:"size:30;default:系统用户;comment:用户昵称"`
Avatar string `json:"avatar" gorm:"size:255;comment:用户头像"`
Enable bool `json:"enable" gorm:"default:true;comment:用户是否有效"`
UserConfig UserConfig `json:"user_config" gorm:"serializer:json;comment:用户配置文件"`
ExtendConfig string `json:"extend_config" gorm:"comment:扩展配置,保存自定义使用的配置"`
LastLoginAt *LocalTime `json:"last_login_at" gorm:"type:datetime;comment:最后登录时间"`
DepartmentList []*SysDepartment `json:"department_list" gorm:"many2many:sys_user_department;"` // 用户部门
DepartmentIds []int `json:"department_ids" gorm:"-"` // 用户部门 Id 集合
RoleList []*SysRole `json:"role_list" gorm:"many2many:sys_user_role;"` // 用户角色
RoleIds []int `json:"role_ids" gorm:"-"` // 用户角色 Id 集合
JwtToken string `json:"jwt_token,omitempty" gorm:"-"`
}
func (SysUser) PasswordConfound ¶
func (*SysUser) UnmarshalJSON ¶
type SysUserDepartment ¶
type SysUserDepartment struct {
SysUserId int `json:"user_id" gorm:"type:int(11)"`
SysDepartmentId int `json:"department_id" gorm:"type:int(11)"`
}
func (SysUserDepartment) TableName ¶
func (SysUserDepartment) TableName() string
type SysUserRole ¶
type SysUserRole struct {
SysUserId int `json:"user_id" gorm:"type:int(11)"`
SysRoleId int `json:"role_id" gorm:"type:int(11)"`
}
func (SysUserRole) TableName ¶
func (SysUserRole) TableName() string
Click to show internal directories.
Click to hide internal directories.