Documentation
¶
Overview ¶
Code generated for package main by go-bindata DO NOT EDIT. (@generated) sources: simple_admin_templates/simple_admin.template simple_admin_templates/umi.css simple_admin_templates/umi.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 GetRouterCustomAction(ctx iris.Context)
- 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 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 Config
- type ConfigResp
- type CustomAction
- type CustomActionResp
- type DeleteReq
- type GetCurrentUserResp
- type GlobalResp
- 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 ( NowSpAdmin *SpAdmin SvKey = sv.GlobalContextKey DefaultPrefix = "/SP_PREFIX" )
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 GetRouterCustomAction ¶ added in v1.0.8
获取单个表的自定义操作
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 Config ¶
type Config struct {
Name string // 后台显示名称
Engine *xorm.Engine // xorm engine实例
App *iris.Application // iris实例
ModelList []interface{} // 模型列表
UserModel interface{} // 用户模型
RunSync bool // 是否进行sync
PageSize int
AbridgeName string
Prefix string
InitAdminUserName string
InitAdminPassword string
UserModelSpecialUniqueName string
CustomAction []CustomAction
}
type ConfigResp ¶ added in v1.0.2
type CustomAction ¶ added in v1.0.8
type CustomAction struct {
Name string `json:"name"` // action display name
Methods string `json:"methods"` // request run methods
Valid interface{} `json:"valid"` // request valid struct
Path string `json:"path"` // request path
Scope []interface{} `json:"scope"` // show where
Func func(ctx context.Context)
}
自定义action
type CustomActionResp ¶ added in v1.0.8
type DeleteReq ¶ added in v1.0.2
type DeleteReq struct {
Ids string `json:"ids" form:"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 SpAdmin ¶
type SpAdmin struct {
// contains filtered or unexported fields
}
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"`
}
用户登录
type UserLoginResp ¶ added in v1.0.2
type UserLoginResp struct {
Token string `json:"token"`
UserInfo GetCurrentUserResp `json:"user_info"`
}