Documentation
¶
Index ¶
- Constants
- type AdminDB
- func (db *AdminDB) Delete(adminID int) error
- func (db *AdminDB) Exists(mobileNumber string) (bool, error)
- func (db *AdminDB) GetByID(adminID int) (*AdminUser, error)
- func (db *AdminDB) GetByMobile(mobileNumber string) (*AdminUser, error)
- func (db *AdminDB) GetByToken(token string) (*AdminUser, error)
- func (db *AdminDB) GetRoleByID(roleID int) (*Role, error)
- func (db *AdminDB) Insert(a *InsertAdminUserParam) (int, error)
- func (db *AdminDB) InsertLog(adminID int, logType, targetID, content string) error
- func (db *AdminDB) List() ([]AdminUser, error)
- func (db *AdminDB) ListFuncByIDArr(funcsIDs []int) ([]Func, error)
- func (db *AdminDB) ListLog(logType, targetID string) ([]AdminLog, error)
- func (db *AdminDB) Update(a *UpdateAdminUserParam) error
- func (db *AdminDB) UpdateToken(adminID int, ip string) (string, time.Time, time.Time, string, error)
- func (db *AdminDB) UpdateTokenExpireAt(adminID int) (time.Time, error)
- type AdminLog
- type AdminTx
- type AdminUser
- type Func
- type InsertAdminUserParam
- type Role
- type UpdateAdminUserParam
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminDB ¶
func (*AdminDB) Exists ¶
Exists 管理员是否存在,通过Mobile
func (*AdminDB) GetByMobile ¶
GetByMobile 获取管理员,通过Mobile
func (*AdminDB) GetByToken ¶
GetByToken 获取管理员,通过Token
func (*AdminDB) GetRoleByID ¶
GetRoleByID 获取角色
func (*AdminDB) Insert ¶
func (db *AdminDB) Insert(a *InsertAdminUserParam) (int, error)
Insert 添加管理员管理员
func (*AdminDB) InsertLog ¶
InsertLog 插入管理员操作记录
func (*AdminDB) ListFuncByIDArr ¶
ListFuncByIDArr 列出指定功能
func (*AdminDB) ListLog ¶
ListLog 列出指定日志
type AdminLog ¶
type AdminLog struct {
AdminID int `json:"adminID" db:"admin_id"` // 管理员ID
LogType string `json:"logType" db:"log_type"` // 日志类型
TargetID string `json:"targetID" db:"target_id"` // 日志目标ID
Content string `json:"content" db:"content"` // 日志内容
CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
AdminUser *AdminUser `json:"adminUser"` // 操作管理员
}
AdminLog 管理员操作记录
type AdminTx ¶
type AdminUser ¶
type AdminUser struct {
AdminID int `json:"adminID" db:"admin_id"` // 管理员ID
Active bool `json:"active" db:"active"` // 是否可用
Nickname string `json:"nickname" db:"nickname"` // 昵称
MobileNumber string `json:"mobileNumber" db:"mobile_number"` // 手机号
Password string `json:"password" db:"password"` // 密码
LastIP string `json:"lastIP" db:"last_ip"` // 最后登录ip
Token string `json:"token" db:"token"` // token
RoleID int `json:"roleID" db:"role_id"` // 角色ID
ExpireAt time.Time `json:"expireAt" db:"expire_at"` // token过期时间
CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间
LoginTime time.Time `json:"loginTime" db:"login_time"` // 最后登录时间
Role Role `json:"role"` // 角色
FuncList []Func `json:"funcList"` // 功能
}
AdminUser 管理员结构体
type Func ¶
type Func struct {
FuncID int `json:"funcID" db:"func_id"` // 功能id
Active bool `json:"active" db:"active"` // 是否可用
Label string `json:"label" db:"label"` // 功能名称
ParentID int `json:"parentID" db:"parent_id"` // 父功能id,根结父功能id为0
Children int `json:"children" db:"children"` // 子功能数量
Level int `json:"level" db:"level"` // 功能层级0、1
URL string `json:"url" db:"url"` // 功能地址
CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间
Feature string `json:"feature" db:"feature"` // Feature
Focus string `json:"focus" db:"focus"` // Focus
}
Func 功能结构体
type InsertAdminUserParam ¶
type InsertAdminUserParam struct {
Nickname string `json:"nickname" form:"nickname"` // 昵称
MobileNumber string `json:"mobileNumber" form:"mobileNumber"` // 手机号
Password string `json:"password" form:"password"` // 密码
RoleID int `json:"roleID" form:"roleID"` // 角色ID
}
InsertAdminUserParam 插入AdminUser参数
type Role ¶
type Role struct {
RoleID int `json:"roleID" db:"role_id"` // 角色ID
Active bool `json:"active" db:"active"` // 是否可用
Label string `json:"label" db:"label"` // 角色名称
Description string `json:"description" db:"description"` // 描述
FuncList string `json:"funcList" db:"func_list"` // 功能列表,下划线分割
CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
UpdateTime time.Time `json:"updateTime" db:"update_time"` // 更新时间
}
Role 角色结构体
Source Files
¶
- admin_get.go
- admin_insert.go
- admin_list.go
- admin_update.go
- func_get.go
- func_insert.go
- func_list.go
- func_update.go
- log_insert.go
- log_list.go
- role_get.go
- role_insert.go
- role_list.go
- role_update.go
- struct.go
Click to show internal directories.
Click to hide internal directories.