code

package
v2.2.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 1 Imported by: 156

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodeDict = CodeMap{

	SystemUnauthorized: {"SystemUnauthorized", http.StatusOK},
	SystemNotInstalled: {"SystemNotInstalled", http.StatusOK},

	OperationProcessing: {"OperationProcessing", http.StatusOK},
	FrequencyTooFast:    {"FrequencyTooFast", http.StatusOK},
	RequestFailure:      {"RequestFailure", http.StatusOK},
	RequestTimeout:      {"RequestTimeout", http.StatusOK},
	AbnormalResponse:    {"AbnormalResponse", http.StatusOK},
	OperationTimeout:    {"OperationTimeout", http.StatusOK},
	Unsupported:         {"Unsupported", http.StatusOK},
	RepeatOperation:     {"RepeatOperation", http.StatusOK},

	InvalidAppID:     {"InvalidAppID", http.StatusOK},
	InvalidSecretKey: {"InvalidSecretKey", http.StatusOK},

	DataAlreadyExists:   {"DataAlreadyExists", http.StatusOK},
	DataFormatIncorrect: {"DataFormatIncorrect", http.StatusOK},
	DataStatusIncorrect: {"DataStatusIncorrect", http.StatusOK},
	DataHasExpired:      {"DataHasExpired", http.StatusOK},
	DataProcessing:      {"DataProcessing", http.StatusOK},
	DataUnavailable:     {"DataUnavailable", http.StatusOK},
	InvalidType:         {"InvalidType", http.StatusOK},
	InvalidSignature:    {"InvalidSignature", http.StatusOK},
	InvalidParameter:    {"InvalidParameter", http.StatusOK},
	DataNotFound:        {"DataNotFound", http.StatusOK},

	CaptchaError:    {"CaptchaError", http.StatusOK},
	BalanceNoEnough: {"BalanceNoEnough", http.StatusOK},
	UserDisabled:    {"UserDisabled", http.StatusOK},
	UserNotFound:    {"UserNotFound", http.StatusOK},
	NonPrivileged:   {"NonPrivileged", http.StatusOK},
	Unauthenticated: {"Unauthenticated", http.StatusOK},

	Failure: {"Failure", http.StatusOK},
	Success: {"Success", http.StatusOK},
}

CodeDict 状态码字典

Functions

This section is empty.

Types

type Code

type Code int
const (
	SystemUnauthorized Code = -301 // 系统未获得授权
	SystemNotInstalled Code = -300 // 系统未安装

	FrequencyTooFast    Code = -207 //操作频率太快
	OperationProcessing Code = -206 //操作处理中
	RequestFailure      Code = -205 //提交失败
	RequestTimeout      Code = -204 //提交超时
	AbnormalResponse    Code = -203 //响应异常
	OperationTimeout    Code = -202 //操作超时
	Unsupported         Code = -201 //不支持的操作
	RepeatOperation     Code = -200 //重复操作

	InvalidSecretKey Code = -151 //密钥不正确
	InvalidAppID     Code = -150 //AppID不正确

	DataAlreadyExists   Code = -109 //数据已经存在
	DataFormatIncorrect Code = -108 //数据格式不正确
	DataStatusIncorrect Code = -107 //数据状态不正确
	DataProcessing      Code = -106 //数据未处理中状态
	DataUnavailable     Code = -105 //尚未启用
	DataHasExpired      Code = -104 //数据已经过期
	InvalidType         Code = -103 //类型不正确
	InvalidSignature    Code = -102 //无效的签名
	InvalidParameter    Code = -101 //无效的参数
	DataNotFound        Code = -100 //数据未找到

	CaptchaError    Code = -9 //验证码错误
	BalanceNoEnough Code = -5 //余额不足
	UserDisabled    Code = -4 //用户被禁用
	UserNotFound    Code = -3 //用户未找到
	NonPrivileged   Code = -2 //无权限
	Unauthenticated Code = -1 //未登录

	Failure Code = 0 //操作失败
	Success Code = 1 //操作成功
)

func (Code) HTTPCode

func (c Code) HTTPCode() int

HTTPCode 返回HTTP状态码

func (Code) Int

func (c Code) Int() int

Int 返回int类型的自定义状态码

func (Code) String

func (c Code) String() string

type CodeMap

type CodeMap map[Code]TextHTTPCode

func (CodeMap) Get

func (s CodeMap) Get(code Code) TextHTTPCode

func (CodeMap) GetByInt

func (s CodeMap) GetByInt(code int) TextHTTPCode

type TextHTTPCode

type TextHTTPCode struct {
	Text     string
	HTTPCode int
}

Jump to

Keyboard shortcuts

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