controller

package
v0.0.0-...-c622313 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPage

func GetPage(c *gin.Context) (page, pagesize int)

GetPage 获取每页数量

func RespData

func RespData(c *gin.Context, httpCode, code int, data interface{})

RespData 数据返回

func RespFail

func RespFail(c *gin.Context, httpCode, code int, detail string)

RespFail 返回操作失败

func RespJSON

func RespJSON(c *gin.Context, httpCode int, resp interface{})

RespJSON 返回JSON数据

func RespOk

func RespOk(c *gin.Context, httpCode, code int)

RespOk 返回操作成功

Types

type Article

type Article struct {
	Log     logger.ILogger          `inject:""`
	Service service.IArticleService `inject:""`
}

Article 注入IArticleService

func (*Article) AddArticle

func (a *Article) AddArticle(c *gin.Context)

AddArticle 新增文章

func (*Article) GetArticle

func (a *Article) GetArticle(c *gin.Context)

GetArticle 获取单个文章

func (*Article) GetArticles

func (a *Article) GetArticles(c *gin.Context)

GetArticles 获取文章信息

func (*Article) GetTables

func (a *Article) GetTables(c *gin.Context)

GetTables 获取多个文章

type ResponseData

type ResponseData struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

ResponseData 数据返回结构体

type ResponseFail

type ResponseFail struct {
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	Detail string `json:"detail"`
}

ResponseFail 返回成功结构体

type ResponseSuccess

type ResponseSuccess struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

ResponseSuccess 返回成功结构体

type User

type User struct {
	Log     logger.ILogger       `inject:""`
	Service service.IUserService `inject:""`
}

User 注入IUserService

func (*User) AddUser

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

AddUser 新建用户

func (*User) DeleteUser

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

DeleteUser 删除用户

func (*User) GetUserInfo

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

GetUserInfo 根据token获取用户信息

func (*User) GetUsers

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

GetUsers 获取用户信息

func (*User) Logout

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

Logout 退出登录

func (*User) UpdateUser

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

UpdateUser 修改用户

Jump to

Keyboard shortcuts

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