ctl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(container *dig.Container) error

Inject 注入ctl 使用方式:

container := dig.New()
Inject(container)
container.Invoke(func(foo *ctl.Demo) {
})

Types

type Demo

type Demo struct {
	DemoBll bll.IDemo
}

Demo 示例程序

func NewDemo

func NewDemo(bDemo bll.IDemo) *Demo

NewDemo 创建demo控制器

func (*Demo) Create

func (a *Demo) Create(c *gin.Context)

Create 创建数据 @Tags Demo @Summary 创建数据 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.Demo true "创建数据" @Success 200 {object} schema.Demo @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos [post]

func (*Demo) Delete

func (a *Demo) Delete(c *gin.Context)

Delete 删除数据 @Tags Demo @Summary 删除数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [delete]

func (*Demo) Disable

func (a *Demo) Disable(c *gin.Context)

Disable 禁用数据 @Tags Demo @Summary 禁用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id}/disable [patch]

func (*Demo) Enable

func (a *Demo) Enable(c *gin.Context)

Enable 启用数据 @Tags Demo @Summary 启用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id}/enable [patch]

func (*Demo) Get

func (a *Demo) Get(c *gin.Context)

Get 查询指定数据 @Tags Demo @Summary 查询指定数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.Demo @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 404 {object} schema.HTTPError "{error:{code:0,message:资源不存在}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [get]

func (*Demo) Query

func (a *Demo) Query(c *gin.Context)

Query 查询数据 @Tags Demo @Summary 查询数据 @Param Authorization header string false "Bearer 用户令牌" @Param current query int true "分页索引" default(1) @Param pageSize query int true "分页大小" default(10) @Param code query string false "编号" @Param name query string false "名称" @Param status query int false "状态(1:启用 2:停用)" @Success 200 {array} schema.Demo "查询结果:{list:列表数据,pagination:{current:页索引,pageSize:页大小,total:总数量}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos [get]

func (*Demo) Update

func (a *Demo) Update(c *gin.Context)

Update 更新数据 @Tags Demo @Summary 更新数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Param body body schema.Demo true "更新数据" @Success 200 {object} schema.Demo @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [put]

type Login

type Login struct {
	LoginBll bll.ILogin
}

Login 登录管理

func NewLogin

func NewLogin(bLogin bll.ILogin) *Login

NewLogin 创建登录管理控制器

func (*Login) GetCaptcha

func (a *Login) GetCaptcha(c *gin.Context)

GetCaptcha 获取验证码信息 @Tags 登录管理 @Summary 获取验证码信息 @Success 200 {object} schema.LoginCaptcha @Router /api/v1/pub/login/captchaid [get]

func (*Login) GetUserInfo

func (a *Login) GetUserInfo(c *gin.Context)

GetUserInfo 获取当前用户信息 @Tags 登录管理 @Summary 获取当前用户信息 @Param Authorization header string false "Bearer 用户令牌" @Success 200 {object} schema.UserLoginInfo @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/current/user [get]

func (*Login) Login

func (a *Login) Login(c *gin.Context)

Login 用户登录 @Tags 登录管理 @Summary 用户登录 @Param body body schema.LoginParam true "请求参数" @Success 200 {object} schema.LoginTokenInfo @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/login [post]

func (*Login) Logout

func (a *Login) Logout(c *gin.Context)

Logout 用户登出 @Tags 登录管理 @Summary 用户登出 @Success 200 {object} schema.HTTPStatus "{status:OK}" @Router /api/v1/pub/login/exit [post]

func (*Login) QueryUserMenuTree

func (a *Login) QueryUserMenuTree(c *gin.Context)

QueryUserMenuTree 查询当前用户菜单树 @Tags 登录管理 @Summary 查询当前用户菜单树 @Param Authorization header string false "Bearer 用户令牌" @Success 200 {object} schema.Menu "查询结果:{list:菜单树}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/current/menutree [get]

func (*Login) RefreshToken

func (a *Login) RefreshToken(c *gin.Context)

RefreshToken 刷新令牌 @Tags 登录管理 @Summary 刷新令牌 @Param Authorization header string false "Bearer 用户令牌" @Success 200 {object} schema.LoginTokenInfo @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/refresh-token [post]

func (*Login) ResCaptcha

func (a *Login) ResCaptcha(c *gin.Context)

ResCaptcha 响应图形验证码 @Tags 登录管理 @Summary 响应图形验证码 @Param id query string true "验证码ID" @Param reload query string false "重新加载" @Produce image/png @Success 200 "图形验证码" @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/login/captcha [get]

func (*Login) UpdatePassword

func (a *Login) UpdatePassword(c *gin.Context)

UpdatePassword 更新个人密码 @Tags 登录管理 @Summary 更新个人密码 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.UpdatePasswordParam true "请求参数" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/pub/current/password [put]

type Menu struct {
	MenuBll bll.IMenu
}

Menu 菜单管理

func NewMenu

func NewMenu(bMenu bll.IMenu) *Menu

NewMenu 创建菜单管理控制器

func (a *Menu) Create(c *gin.Context)

Create 创建数据 @Tags 菜单管理 @Summary 创建数据 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.Menu true "创建数据" @Success 200 {object} schema.Menu @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus [post]

func (a *Menu) Delete(c *gin.Context)

Delete 删除数据 @Tags 菜单管理 @Summary 删除数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus/{id} [delete]

func (a *Menu) Get(c *gin.Context)

Get 查询指定数据 @Tags 菜单管理 @Summary 查询指定数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.Menu @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 404 {object} schema.HTTPError "{error:{code:0,message:资源不存在}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus/{id} [get]

func (a *Menu) Query(c *gin.Context)

Query 查询数据 @Tags 菜单管理 @Summary 查询数据 @Param Authorization header string false "Bearer 用户令牌" @Param current query int true "分页索引" default(1) @Param pageSize query int true "分页大小" default(10) @Param name query string false "名称" @Param hidden query int false "隐藏菜单(0:不隐藏 1:隐藏)" @Param parentID query string false "父级ID" @Success 200 {array} schema.Menu "查询结果:{list:列表数据,pagination:{current:页索引,pageSize:页大小,total:总数量}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus [get]

func (a *Menu) QueryTree(c *gin.Context)

QueryTree 查询菜单树 @Tags 菜单管理 @Summary 查询菜单树 @Param Authorization header string false "Bearer 用户令牌" @Param includeActions query int false "是否包含动作数据(1是)" @Param includeResources query int false "是否包含资源数据(1是)" @Success 200 {array} schema.MenuTree "查询结果:{list:列表数据}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus.tree [get]

func (a *Menu) Update(c *gin.Context)

Update 更新数据 @Tags 菜单管理 @Summary 更新数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Param body body schema.Menu true "更新数据" @Success 200 {object} schema.Menu @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/menus/{id} [put]

type Role

type Role struct {
	RoleBll bll.IRole
}

Role 角色管理

func NewRole

func NewRole(bRole bll.IRole) *Role

NewRole 创建角色管理控制器

func (*Role) Create

func (a *Role) Create(c *gin.Context)

Create 创建数据 @Tags 角色管理 @Summary 创建数据 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.Role true "创建数据" @Success 200 {object} schema.Role @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles [post]

func (*Role) Delete

func (a *Role) Delete(c *gin.Context)

Delete 删除数据 @Tags 角色管理 @Summary 删除数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles/{id} [delete]

func (*Role) Get

func (a *Role) Get(c *gin.Context)

Get 查询指定数据 @Tags 角色管理 @Summary 查询指定数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.Role @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 404 {object} schema.HTTPError "{error:{code:0,message:资源不存在}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles/{id} [get]

func (*Role) Query

func (a *Role) Query(c *gin.Context)

Query 查询数据 @Tags 角色管理 @Summary 查询数据 @Param Authorization header string false "Bearer 用户令牌" @Param current query int true "分页索引" default(1) @Param pageSize query int true "分页大小" default(10) @Param name query string false "角色名称(模糊查询)" @Success 200 {array} schema.Role "查询结果:{list:列表数据,pagination:{current:页索引,pageSize:页大小,total:总数量}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles [get]

func (*Role) QuerySelect

func (a *Role) QuerySelect(c *gin.Context)

QuerySelect 查询选择数据 @Tags 角色管理 @Summary 查询选择数据 @Param Authorization header string false "Bearer 用户令牌" @Success 200 {array} schema.Role "查询结果:{list:角色列表}" @Failure 400 {object} schema.HTTPError "{error:{code:0,message:未知的查询类型}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles.select [get]

func (*Role) Update

func (a *Role) Update(c *gin.Context)

Update 更新数据 @Tags 角色管理 @Summary 更新数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Param body body schema.Role true "更新数据" @Success 200 {object} schema.Role @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/roles/{id} [put]

type User

type User struct {
	UserBll bll.IUser
}

User 用户管理

func NewUser

func NewUser(bUser bll.IUser) *User

NewUser 创建用户管理控制器

func (*User) Create

func (a *User) Create(c *gin.Context)

Create 创建数据 @Tags 用户管理 @Summary 创建数据 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.User true "创建数据" @Success 200 {object} schema.User @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users [post]

func (*User) Delete

func (a *User) Delete(c *gin.Context)

Delete 删除数据 @Tags 用户管理 @Summary 删除数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users/{id} [delete]

func (*User) Disable

func (a *User) Disable(c *gin.Context)

Disable 禁用数据 @Tags 用户管理 @Summary 禁用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users/{id}/disable [patch]

func (*User) Enable

func (a *User) Enable(c *gin.Context)

Enable 启用数据 @Tags 用户管理 @Summary 启用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users/{id}/enable [patch]

func (*User) Get

func (a *User) Get(c *gin.Context)

Get 查询指定数据 Get 查询指定数据 @Tags 用户管理 @Summary 查询指定数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.User @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 404 {object} schema.HTTPError "{error:{code:0,message:资源不存在}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users/{id} [get]

func (*User) Query

func (a *User) Query(c *gin.Context)

Query 查询数据 @Tags 用户管理 @Summary 查询数据 @Param Authorization header string false "Bearer 用户令牌" @Param current query int true "分页索引" default(1) @Param pageSize query int true "分页大小" default(10) @Param userName query string false "用户名(模糊查询)" @Param realName query string false "真实姓名(模糊查询)" @Param roleIDs query string false "角色ID(多个以英文逗号分隔)" @Param status query int false "状态(1:启用 2:停用)" @Success 200 {array} schema.UserShow "查询结果:{list:列表数据,pagination:{current:页索引,pageSize:页大小,total:总数量}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users [get]

func (*User) Update

func (a *User) Update(c *gin.Context)

Update 更新数据 @Tags 用户管理 @Summary 更新数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Param body body schema.User true "更新数据" @Success 200 {object} schema.User @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/users/{id} [put]

Jump to

Keyboard shortcuts

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