controller

package
v0.0.0-...-a93d61e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserInfoKey = "user_id"
)

Variables

View Source
var ErrUserNotLogin = errors.New("用户未登录")

Functions

func CommunityHandler

func CommunityHandler(c *gin.Context)

CommunityHandler 获取社区列表

func CreatePostHandler

func CreatePostHandler(c *gin.Context)

CreatePostHandler 创建帖子

func GetCommunityDetail

func GetCommunityDetail(c *gin.Context)

GetCommunityDetail 获取社区详情

func GetPostDetailHandler

func GetPostDetailHandler(c *gin.Context)

GetPostDetailHandler 获取帖子详情

func GetPosts2Handler

func GetPosts2Handler(c *gin.Context)

GetPosts2Handler 帖子列表2

func GetPostsHandler

func GetPostsHandler(c *gin.Context)

GetPostsHandler 帖子列表

func GetUserInfo

func GetUserInfo(c *gin.Context) (int64, error)

GetUserInfo 获取用户登录信息

func InitTrans

func InitTrans(locale string) (err error)

InitTrans 初始化翻译器

func LoginHandler

func LoginHandler(c *gin.Context)

LoginHandler 用户登录

func PingHandler

func PingHandler(c *gin.Context)

PingHandler

func RefreshTokenHandler

func RefreshTokenHandler(c *gin.Context)

RefreshTokenHandler 刷新token

func ResponseError

func ResponseError(c *gin.Context, code ResCode)

func ResponseErrorWithMsg

func ResponseErrorWithMsg(c *gin.Context, code ResCode, msg interface{})

func ResponseSuccess

func ResponseSuccess(c *gin.Context, data interface{})

func SignUpHandler

func SignUpHandler(c *gin.Context)

@Summary 用户注册 @Description 用户注册 @Tags 用户注册 @Accept application/json @Produce application/json @Param Authorization header string false "Bearer 用户令牌" @Param object query models.ParamPostList false "查询参数" @Security ApiKeyAuth @Success 200 {object} _ResponsePostList @Router /api/v1/signup [post] SignUpHandler 用户注册

func SignUpParamStructLevelValidation

func SignUpParamStructLevelValidation(sl validator.StructLevel)

SignUpParamStructLevelValidation 自定义SignUpParam结构体校验函数

func VoteHandler

func VoteHandler(c *gin.Context)

VoteHandler 投票

Types

type ResCode

type ResCode int64
const (
	CodeSuccess ResCode = 1000 + iota
	CodeInvalidParam
	CodeUserExist
	CodeUserNotExist
	CodeInvalidPassword
	CodeServerBusy

	CodeTokenInvalid
	CodeRefreshTokenFail

	CodeVoteExpire
	CodeNotRepeatVote
)

func (ResCode) Msg

func (c ResCode) Msg() string

type ResponseData

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

Jump to

Keyboard shortcuts

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