controllers

package
v0.0.0-...-0158979 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2018 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS_CODE      = 0
	PARAM_ERROR_CODE  = 1000
	SERVER_ERROR_CODE = 1001

	AUTH_FAILED_CODE        = 2001
	NOT_AUTH_CODE           = 2002
	USERNAME_EXIST_CODE     = 2003
	USERNAME_NOT_EXIST_CODE = 2004
	KICKED_CODE             = 2005

	IMAGE_AUTH_CODE = 3001
)

Variables

View Source
var (
	CodeMap = map[int]string{
		SUCCESS_CODE:            "success",
		PARAM_ERROR_CODE:        "参数错误",
		SERVER_ERROR_CODE:       "系统繁忙,请稍后再试",
		AUTH_FAILED_CODE:        "登录失败",
		NOT_AUTH_CODE:           "没有登录",
		USERNAME_EXIST_CODE:     "用户名已经存在",
		USERNAME_NOT_EXIST_CODE: "用户名不存在",
		KICKED_CODE:             "账户在另一个地方登录",
	}
)

Functions

func GetBase

func GetBase(c *gin.Context)

func NewResponse

func NewResponse(data interface{}, options ...interface{}) interface{}

func PostChangePassword

func PostChangePassword(c *gin.Context)

func PostCurrentUser

func PostCurrentUser(c *gin.Context)

func PostGetSignURL

func PostGetSignURL(c *gin.Context)

func PostImageAuth

func PostImageAuth(c *gin.Context)

func PostUploadImage

func PostUploadImage(c *gin.Context)

func PostUserLogin

func PostUserLogin(c *gin.Context)

func PostUserLogout

func PostUserLogout(c *gin.Context)

func PostUserName

func PostUserName(c *gin.Context)

func PostUserSignIn

func PostUserSignIn(c *gin.Context)

Types

type BaseController

type BaseController struct {
	GetBase func(*gin.Context) `path:""`
}

func NewBaseController

func NewBaseController() BaseController

func (BaseController) Name

func (BaseController) Name() string

type CheckController

type CheckController struct {
	PostImageAuth func(*gin.Context) `path:"/check/image-auth"`
	PostUserName  func(*gin.Context) `path:"/check/username"`
}

func NewCheckController

func NewCheckController() CheckController

func (CheckController) Name

func (CheckController) Name() string

type ImageAuthRequest

type ImageAuthRequest struct {
	Type int `form:"type" binding:"required"` //1:代表主界面
}

type PostChangePasswordRequest

type PostChangePasswordRequest struct {
	Password    string `form:"password" binding:"required"`
	NewPassword string `form:"newPassword" binding:"required"`
}

type PostGetSignURLRequest

type PostGetSignURLRequest struct {
	ObjectName string `form:"objectName"`
}

type PostGetSignURLResponse

type PostGetSignURLResponse struct {
	SignURL string `json:"signURL"`
}

type PostUserLoginRequest

type PostUserLoginRequest struct {
	Username string `form:"username" binding:"required"`
	Password string `form:"password" binding:"required"`
}

type PostUserLoginResponse

type PostUserLoginResponse struct {
	UserID int `json:"userID"`
}

type PostUserSignInRequest

type PostUserSignInRequest struct {
	Username string `form:"username" binding:"required"`
	Password string `form:"password" binding:"required"`
	AuthCode string `form:"authCode" binding:"required"`
}

type PostUsernameRequest

type PostUsernameRequest struct {
	Username string `form:"username" binding:"required"`
}

type Response

type Response struct {
	Data    interface{} `json:"data"`
	ErrMsg  string      `json:"errmsg"`
	ErrCode int         `json:"errcode"` //0:正确
}

type UploadController

type UploadController struct {
	PostGetSignURL  func(*gin.Context) `path:"/upload/sign-url"`
	PostUploadImage func(*gin.Context) `path:"/upload/image"`
}

func NewUploadController

func NewUploadController() UploadController

func (UploadController) Name

func (UploadController) Name() string

type UserController

type UserController struct {
	PostUserSignIn     func(*gin.Context) `path:"/user/sign-in"`
	PostUserLogin      func(*gin.Context) `path:"/user/login"`
	PostUserLogout     func(*gin.Context) `path:"/user/logout"`
	PostCurrentUser    func(*gin.Context) `path:"/user/current-user"`
	PostChangePassword func(*gin.Context) `path:"/user/change-password"`
}

func NewUserController

func NewUserController() UserController

func (UserController) Name

func (UserController) Name() string

Jump to

Keyboard shortcuts

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