utils

package
v0.0.0-...-f18df89 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS = 200
	ERROR   = 500
	// code = 1000... 用户模块的错误
	ERROR_USERNAME_USED  = 1001
	ERROR_PASSWORD_WRONG = 1002
	ERROR_USER_NOT_EXIST = 1003
	ERROR_TOKEN_EXIST    = 1004
	ERROR_TOKEN_RUNTIME  = 1005
	ERROR_TOKEN_WRONG    = 1006
	ERROR_TOKEN_TYPE     = 1007
	ERROR_USER_NO_RIGHT  = 1008
	// code = 2000... 分类模块的错误
	ERROR_CATEGORY_USED      = 2001
	ERROR_CATEGORY_NOT_EXIST = 2002

	// code = 3000... 文章模块的错误
	ERROR_ART_NOT_EXIST = 3001

	// code =4000... token模块的错误
	ERROR_AUTH_CHECK_TOKEN_FAIL = 4001
)

Variables

View Source
var (
	AppMode     string
	HttpPort    string
	Db          string
	DbHost      string
	DbPort      string
	DbUser      string
	DbPassWord  string
	Dbname      string
	JwtKey      string
	AccessKey   string
	SecretKey   string
	Bucket      string
	QiniuServer string
)
View Source
var CodeMsg = map[int]string{
	SUCCESS: "OK",
	ERROR:   "FAIL",

	ERROR_USERNAME_USED:  "用户名已存在!",
	ERROR_PASSWORD_WRONG: "密码错误!",
	ERROR_USER_NOT_EXIST: "用户不存在!",
	ERROR_TOKEN_EXIST:    "TOKEN不存在!",
	ERROR_TOKEN_RUNTIME:  "TOKEN已过期!",
	ERROR_TOKEN_WRONG:    "TOKEN不正确!",
	ERROR_TOKEN_TYPE:     "TOKEN格式错误!",
	ERROR_USER_NO_RIGHT:  "该用户无权限!",

	ERROR_CATEGORY_USED:      "分类已存在!",
	ERROR_CATEGORY_NOT_EXIST: "分类不存在!",

	ERROR_ART_NOT_EXIST: "文章不存在!",

	ERROR_AUTH_CHECK_TOKEN_FAIL: "TOKEN鉴权失败!",
}

Functions

func GetErrMsg

func GetErrMsg(code int) string

func LoadData

func LoadData(file *ini.File)

func LoadQiniu

func LoadQiniu(file *ini.File)

func LoadServer

func LoadServer(file *ini.File)

func ResponseWithMsg

func ResponseWithMsg(c *gin.Context, err int)

func Validate

func Validate(data interface{}) (string, int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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