supports

package
v0.0.11-grpc-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// key定义
	CODE string = "code"
	MSG  string = "msg"
	DATA string = "data"

	// msg define
	Success                  = "恭喜, 成功"
	OptionSuccess     string = "恭喜, 操作成功"
	OptionFailur      string = "抱歉, 操作失败"
	ParseParamsFailur string = "解析参数失败"

	RegisteSuccess     string = "恭喜, 注册用户成功"
	RegisteFailur      string = "注册失败"
	LoginSuccess       string = "恭喜, 登录成功"
	LoginFailur        string = "登录失败"
	DeleteUsersSuccess string = "删除用户成功"
	DeleteUsersFailur  string = "删除用户错误"

	DepCreateFailur string = "部门创建失败"

	DeleteRolesSuccess string = "删除角色成功"
	DeleteRolesFailur  string = "删除角色错误"

	UsernameFailur             string = "用户名错误"
	PasswordFailur             string = "密码错误"
	TokenCreateFailur          string = "生成token错误"
	TokenExactFailur           string = "token不存在或header设置不正确"
	TokenExpire                string = "回话已过期"
	TokenParseFailur           string = "token解析错误"
	TokenParseFailurAndEmpty   string = "解析错误,token为空"
	TokenParseFailurAndInvalid string = "解析错误,token无效"
	NotFound                   string = "您请求的url不存在"
	PermissionsLess            string = "权限不足"
	StatusInternalServerError  string = "服务器内部错误"

	RoleCreateFailur  string = "创建角色失败"
	RoleCreateSuccess string = "创建角色成功"
)

Variables

This section is empty.

Functions

func Error

func Error(ctx iris.Context, status int, msg string, data interface{})

common error define

func NewRequestLogger

func NewRequestLogger(app *iris.Application) (h iris.Handler)

记录请求的 logger

func Ok

func Ok(ctx iris.Context, msg string, data interface{})

func Ok_

func Ok_(ctx iris.Context, msg string)

200 define

func OtherClose

func OtherClose() func() error

func RequestClose

func RequestClose() func() error

func Unauthorized

func Unauthorized(ctx iris.Context, msg string, data interface{})

401 error define

Types

type GroupDefine

type GroupDefine struct {
	Uid int64    `json:"uid"`
	Sub []string `json:"sub"`
}

用户所属角色组

type Pagination

type Pagination struct {
	PageNumber int //当前看的是第几页
	PageSize   int //每页显示多少条数据

	// 用于分页设置的参数
	Start int
	Limit int

	// 时间范围
	StartDate string
	EndDate   string

	Uid int64 // 公用的特殊参数
}

bootstraptable 分页参数

func NewPaginationByForm

func NewPaginationByForm(ctx iris.Context) (*Pagination, error)

func NewPaginationByParam

func NewPaginationByParam(ctx iris.Context) (*Pagination, error)

func (*Pagination) PageSetting

func (p *Pagination) PageSetting()

设置分页参数

type RoleDefine

type RoleDefine struct {
	// 角色的标识等于casbin的sub,但角色需要加role_前缀
	Sub string `json:"sub"`
	// 对应casbin model的定义
	Obj      string `json:"obj"`
	Act      string `json:"act"`
	Suf      string `json:"suf"`
	RoleName string `json:"roleName"`
}

前端请求的结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL