Documentation
¶
Overview ¶
Code generated for package main by go-bindata DO NOT EDIT. (@generated) sources: simple_admin_templates/CNAME simple_admin_templates/asset-manifest.json simple_admin_templates/favicon.png simple_admin_templates/home_bg.png simple_admin_templates/icons/icon-128x128.png simple_admin_templates/icons/icon-192x192.png simple_admin_templates/icons/icon-512x512.png simple_admin_templates/layouts__BasicLayout.5d6a0276.chunk.css simple_admin_templates/layouts__BasicLayout.70fefa2c.async.js simple_admin_templates/layouts__SecurityLayout.8802f42e.async.js simple_admin_templates/layouts__UserLayout.b53fe6b6.chunk.css simple_admin_templates/layouts__UserLayout.f746a429.async.js simple_admin_templates/p__404.ee09bdf9.async.js simple_admin_templates/p__Welcome.72864ae1.chunk.css simple_admin_templates/p__Welcome.d03bc865.async.js simple_admin_templates/p__account__changePassword.dc7ad4da.async.js simple_admin_templates/p__dataShow.c05bf159.async.js simple_admin_templates/p__userManage.432db247.chunk.css simple_admin_templates/p__userManage.9e1b5f7d.async.js simple_admin_templates/p__user__login.49d4f094.chunk.css simple_admin_templates/p__user__login.7b9d3ff8.async.js simple_admin_templates/p__user__reg.7089f7db.chunk.css simple_admin_templates/p__user__reg.94d4cb32.async.js simple_admin_templates/pro_icon.svg simple_admin_templates/simple_admin.template simple_admin_templates/static/logo.f0355d39.svg simple_admin_templates/umi.137ab2fd.js simple_admin_templates/umi.d10f205a.css simple_admin_templates/vendors~layouts__BasicLayout.7b0d2ca9.async.js simple_admin_templates/vendors~layouts__BasicLayout.8a8bd272.chunk.css simple_admin_templates/vendors~layouts__BasicLayout~p__Welcome~p__account__changePassword~p__dataShow~p__userManage~p__user~60880431.b89631fd.chunk.css simple_admin_templates/vendors~layouts__BasicLayout~p__Welcome~p__account__changePassword~p__dataShow~p__userManage~p__user~60880431.d73b0ff9.async.js simple_admin_templates/vendors~layouts__UserLayout.adb92b26.async.js simple_admin_templates/vendors~p__Welcome.9a3636d6.chunk.css simple_admin_templates/vendors~p__Welcome.d4bdb317.async.js simple_admin_templates/vendors~p__account__changePassword~p__dataShow~p__userManage.7116cd40.async.js simple_admin_templates/vendors~p__account__changePassword~p__dataShow~p__userManage.85bb279b.chunk.css simple_admin_templates/vendors~p__account__changePassword~p__dataShow~p__userManage~p__user__login~p__user__reg.2b50ec8e.async.js simple_admin_templates/vendors~p__account__changePassword~p__dataShow~p__userManage~p__user__login~p__user__reg.fd04645f.chunk.css simple_admin_templates/vendors~p__dataShow~p__userManage.7fe1b3ca.chunk.css simple_admin_templates/vendors~p__dataShow~p__userManage.eab0f32e.async.js
Index ¶
- Variables
- func AddRouterData(ctx iris.Context)
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func ChangeUserPassword(ctx iris.Context)
- func ChangeUserRoles(ctx iris.Context)
- func Configuration(ctx iris.Context)
- func EditRouterData(ctx iris.Context)
- func GenJwtToken(userUid, userName string) string
- func GetCurrentUser(ctx iris.Context)
- func GetMapValues(a map[string]string) []string
- func GetRouterData(ctx iris.Context)
- func GetRouterFields(ctx iris.Context)
- func GetRouterSingleData(ctx iris.Context)
- func GetRouters(ctx iris.Context)
- func Index(ctx iris.Context)
- func InitValidator()
- func IsNum(s string) bool
- func Login(ctx iris.Context)
- func MsgLog(msg string) error
- func MustAsset(name string) []byte
- func PolicyRequireAdminMiddleware(ctx iris.Context)
- func PolicyValidMiddleware(ctx iris.Context)
- func RandStringBytes(n int) string
- func Reg(ctx iris.Context)
- func RemoveRouterData(ctx iris.Context)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func StringsContains(a []string, x string) bool
- func TokenToUserUidMiddleware(ctx iris.Context)
- type CanCheck
- type Config
- type ConfigResp
- type DeleteReq
- type GetCurrentUserResp
- type GlobalResp
- type MyValidator
- type PagResult
- type Policy
- type SpAdmin
- type TableFieldsResp
- type UserChangePasswordReq
- type UserChangeRolesReq
- type UserLoginReq
- type UserLoginResp
- type UserModel
Constants ¶
This section is empty.
Variables ¶
var CustomJwt = jwt.New(jwt.Config{ ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) { return MySecret, nil }, Expiration: true, SigningMethod: jwt.SigningMethodHS256, })
自定义JWT 使用办法 中间层 handler.CustomJwt.Serve, handler.TokenToUserUidMiddleware,user handler
var MySecret = []byte("8657684ae02840ead423e0d781a7a0c5")
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func GetMapValues ¶
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func PolicyRequireAdminMiddleware ¶
必须admin权限middleware
func RandStringBytes ¶
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func StringsContains ¶
Types ¶
type CanCheck ¶ added in v1.0.2
type CanCheck interface {
Check() error
}
CanCheck 如果需要特殊校验,可以实现验证接口,或者通过自定义tag标签实现
type Config ¶
type Config struct {
Name string // 后台显示名称
Engine *xorm.Engine // xorm engine实例
App *iris.Application // iris实例
ModelList []interface{} // 模型列表
UserModel interface{} // 用户模型
RunSync bool // 是否进行sync
PageSize int
Prefix string
InitAdminUserName string
InitAdminPassword string
UserModelSpecialUniqueName string
}
type ConfigResp ¶ added in v1.0.2
type DeleteReq ¶ added in v1.0.2
type DeleteReq struct {
Ids string `json:"ids" comment:"标识符列表" validate:"required,min=1"`
}
type GetCurrentUserResp ¶ added in v1.0.2
type GlobalResp ¶ added in v1.0.2
type GlobalResp struct {
Code uint16 `json:"code"` // 状态码
Message string `json:"message"` // 消息
Data interface{} `json:"data"`
}
所有返回必须包裹一层resp
type MyValidator ¶ added in v1.0.2
MyValidator 自定义验证器
var GlobalValidator MyValidator
GlobalValidator 全局验证器
func (*MyValidator) Check ¶ added in v1.0.2
func (m *MyValidator) Check(value interface{}) error
Check 验证器通用验证方法
type SpAdmin ¶
type SpAdmin struct {
// contains filtered or unexported fields
}
var (
NowSpAdmin *SpAdmin
)
func (*SpAdmin) Pagination ¶
分页
type TableFieldsResp ¶ added in v1.0.3
type UserChangePasswordReq ¶ added in v1.0.2
type UserChangePasswordReq struct {
Id uint64 `json:"id" comment:"id" validate:"required"`
UserName string `json:"user_name" comment:"用户名" validate:"required,max=20,min=3"`
Password string `json:"password" comment:"密码" validate:"required,min=3,max=20"`
}
用户变更密码
type UserChangeRolesReq ¶ added in v1.0.2
type UserChangeRolesReq struct {
Id uint64 `json:"id" comment:"id" validate:"required"`
Role string `json:"role" comment:"群组名" validate:"required"`
Add bool `json:"add" comment:"添加"`
}
admin 变更用户群组
type UserLoginReq ¶ added in v1.0.2
type UserLoginReq struct {
UserName string `json:"user_name" comment:"用户名" validate:"required,max=20,min=3"`
Password string `json:"password" comment:"密码" validate:"required,min=3,max=20"`
}
用户登录