code

package
v0.0.0-...-a01a698 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK                       int32 = 0   // is ok
	Error                    int32 = 1   // error
	PIDError                 int32 = 100 // pid错误
	LoginError               int32 = 201 // 登录异常
	AccountAuthFail          int32 = 202 // 帐号授权失败
	AccountBindFail          int32 = 203 // 帐号绑定失败
	AccountTokenValidateFail int32 = 204 // token验证失败
	AccountNameIsExist       int32 = 205 // 帐号已存在
	AccountRegisterError     int32 = 206 //
	AccountGetFail           int32 = 207 //
	PlayerDenyLogin          int32 = 301 // 玩家禁止登录
	PlayerDuplicateLogin     int32 = 302 // 玩家重复登录
	PlayerNameExist          int32 = 303 // 玩家角色名已存在
	PlayerCreateFail         int32 = 304 // 玩家创建角色失败
	PlayerNotLogin           int32 = 305 // 玩家未登录
	PlayerIdError            int32 = 306 // 玩家id错误
)

Functions

func Add

func Add(code int32, message string)

func AddAll

func AddAll(maps map[int32]string)

func GetMessage

func GetMessage(code int32) string

func IsFail

func IsFail(code int32) bool

func IsOK

func IsOK(code int32) bool

func RenderResult

func RenderResult(c *cherryGin.Context, statusCode int32, data ...interface{})

Types

type Result

type Result struct {
	Code    int32       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func NewDataResult

func NewDataResult(code int32) *Result

func (*Result) SetCode

func (p *Result) SetCode(code int32)

Jump to

Keyboard shortcuts

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