cnst

package
v0.2.55 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionZan 点赞
	ActionZan = iota + 1
	// ActionPingLun 评论
	ActionPingLun = iota
	// ActionZhuanFa 转发
	ActionZhuanFa = iota
	// ActionShouCang 收藏
	ActionShouCang = iota
	// ActionXiHuan 喜欢
	ActionXiHuan = iota
	// ActionDaShang 打赏
	ActionDaShang = iota
	// ActionBiaoJi 标记
	ActionBiaoJi = iota
	// ActionDingYue 订阅
	ActionDingYue = iota
	// ActionJuBao 举报
	ActionJuBao = iota
	// ActionFenXiang 分享
	ActionFenXiang = iota
)
View Source
const (
	MIMEApplicationJSON                  = "application/json"
	MIMEApplicationJSONCharsetUTF8       = MIMEApplicationJSON + "; " + charsetUTF8
	MIMEApplicationJavaScript            = "application/javascript"
	MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8
	MIMEApplicationXML                   = "application/xml"
	MIMEApplicationXMLCharsetUTF8        = MIMEApplicationXML + "; " + charsetUTF8
	MIMETextXML                          = "text/xml"
	MIMETextXMLCharsetUTF8               = MIMETextXML + "; " + charsetUTF8
	MIMEApplicationForm                  = "application/x-www-form-urlencoded"
	MIMEApplicationProtobuf              = "application/protobuf"
	MIMEApplicationMsgpack               = "application/msgpack"
	MIMETextHTML                         = "text/html"
	MIMETextHTMLCharsetUTF8              = MIMETextHTML + "; " + charsetUTF8
	MIMETextPlain                        = "text/plain"
	MIMETextPlainCharsetUTF8             = MIMETextPlain + "; " + charsetUTF8
	MIMEMultipartForm                    = "multipart/form-data"
	MIMEOctetStream                      = "application/octet-stream"
)

MIME types

View Source
const (
	// DateFormat 日期格式
	DateFormat = "2006-01-02"

	// DateTimeFormat 时间格式
	DateTimeFormat = "2006-01-02 15:04:05"
	FMT_DATE_TIME  = "2006-01-02 15:04:05"

	FMT_DATE = "2006-01-02"

	FMT_TIME = "15:04:05"

	FMT_DATE_TIME_CN = "2006年01月02日 15时04分05秒"

	FMT_DATE_CN = "2006年01月02日"

	FMT_TIME_CN = "15时04分05秒"
)
View Source
const (
	NormalMessageId   = 0 ////默认的返回值,为0,自增
	ServerMaintenance = 1 //服务器维护中 请稍后再试,服务器出错会回这个信息,暂时不用
	AccountDisabled   = 2 //帐号被禁用
	AppidOverdue      = 3 //appid过期

	UnknownError  = 101 //未知错误
	TokenFailure  = 102 //token失效
	HTMLSuccess   = 200 //成功
	BlockingAcess = 405 //禁止访问( 禁用请求中所指定的方法)

	NewReport = 2001 //新消息
	NewHeart  = 2002 //心跳

	ParameterInvalid         = 1001 //参数无效
	AppidParameterInvalid    = 1002 //appid参数无效
	EncryptCheckError        = 1003 //密文校验失败
	UserNameDoNotExist       = 1004 //用户名不存在或密码错误
	DuplicateKeyError        = 1005 //键值对重复
	InValidOp                = 1007 //无效操作
	NotFindError             = 1006 //未找到
	InValidAuthorize         = 1008 //授权码错误
	HasusedError             = 1009 //已被使用
	HasActvError             = 1010 //已被激活
	ActvFailure              = 1011 //|激活码被禁止使用
	UserExisted              = 1012 //用户已存在
	VerifyTimeError          = 1013 //验证码请求过于平凡
	MailSendFaild            = 1014 //邮箱发送失败
	SMSSendFaild             = 1015 //手机发送失败
	PhoneParameterError      = 1016 //手机号格式有问题
	VerifyError              = 1017 //验证码错误
	UserNotExisted           = 1018 //用户不存在
	TopicExisted             = 1019 //topic已经存在
	TopicNotExisted          = 1020 //topic不存在
	BundleIdNotExisted       = 1021 //bundle_id不存在
	TopicStartFail           = 1022 //topic开启处理失败
	TopicTypeNotExisted      = 1023 //topic处理类型不存在
	TopicIsNotNull           = 1024 //topic不能为空
	DeviceNotExisted         = 1025 //设备不存在
	StateExisted             = 1027 //状态已存在
	LastMenuNotExisted       = 1028 //上级菜单不存在
	MenuNotExisted           = 1029 //菜单不存在
	UserMenuNotExisted       = 1030 //用户权限不存在
	DeviceIdNotExisted       = 1031 //设备ID不存在
	GoodsDealTypeNotExisted  = 1032 //商品处理类型不存在
	GoodsIdNotExisted        = 1033 //商品不存在
	GoodsBeInDiscount        = 1034 //商品正在打折
	GoodsPayTypeNotExisted   = 1035 //商品可支付类型不存在
	GoodsIdExisted           = 1036 //商品已存在
	OrderIdNotExisted        = 1043 //订单不存在
	GoodsBeNotInDiscount     = 1044 //商品未打折
	NotifyIsNotMatch         = 1045 //会话不匹配
	GoodsIsDiscountRecovery  = 1046 //商品已恢复原价
	InvitationUserNotExisted = 1047 //邀请用户不存在
	//	InvitationUserLevelIsFull = 1048 //邀请用户级数已满
	UserNotAuthorize      = 1049 //用户未授权
	ApplicantIsExisted    = 1050 //申请人已存在
	ApplicantNotExisted   = 1051 //申请人不存在
	CreditOrderNotVaild   = 1052 //订单无效
	RepeatWxWithdraw      = 1053 //微信零钱重复提现
	WxWithdrawAmountError = 1054 //提现金额错误
	WxWithdrawError       = 1055 //微信提现失败
	RepeatSubmission      = 1056 //重复提交
	BundleExisted         = 1057 //bundle已存在
	AuthExisted           = 1058 //权限已存在
	AuthNotExisted        = 1059 //权限不存在
	RoomTypeNotExisted    = 1060 //房型不存在
	RoomTypeExisted       = 1061 //房型已存在
	RoomNoNotExisted      = 1062 //房间不存在
	RoomNoExisted         = 1063 //房间已存在
	RateTypeExisted       = 1064 //房价代码或房价名称已存在
	RateTypeNotExisted    = 1065 //房价代码不存在
	FileNotExisted        = 1066 //文件不存在
	RoomNoInvaild         = 1067 //房间未启用
	ClassExisted          = 1068 //班次已存在
	ClassNotExisted       = 1069 //班次不存在
	CheckTimeError        = 1070 //系统时间与营业时间不匹配
	CurrentClassIsShift   = 1071 //当前班次已交班
	PayPriceError         = 1072 //支付金额错误
	StockNotEnough        = 1073 //存量不足
	DBSaveError           = 1074 //数据存储错误
	DBAddError            = 1075 //数据添加错误
	DBUpdateError         = 1076 //数据更新错误
	DBDeleteError         = 1077 //数据删除错误
	TimeError             = 1078 //时间错误
	OrderInfoError        = 1079 //预定信息错误
	NotVaildError         = 1080 //不允许
	Overdue               = 1081 //已过期
	MaxOverError          = 1082 //超过最大值
	MinOverError          = 1083 //低于最小值
	ExistedError          = 1084 //已存在
	NotBindError          = 1085 //未绑定
	BindError             = 1086 //绑定失败
	CalError              = 1087 //计算错误
)
View Source
const (
	HeaderAccept              = "Accept"
	HeaderAcceptEncoding      = "Accept-Encoding"
	HeaderAllow               = "Allow"
	HeaderAuthorization       = "Authorization"
	HeaderContentDisposition  = "Content-Disposition"
	HeaderContentEncoding     = "Content-Encoding"
	HeaderContentLength       = "Content-Length"
	HeaderContentType         = "Content-Type"
	HeaderCookie              = "Cookie"
	HeaderSetCookie           = "Set-Cookie"
	HeaderIfModifiedSince     = "If-Modified-Since"
	HeaderLastModified        = "Last-Modified"
	HeaderLocation            = "Location"
	HeaderUpgrade             = "Upgrade"
	HeaderVary                = "Vary"
	HeaderWWWAuthenticate     = "WWW-Authenticate"
	HeaderXForwardedFor       = "X-Forwarded-For"
	HeaderXForwardedProto     = "X-Forwarded-Proto"
	HeaderXForwardedProtocol  = "X-Forwarded-Protocol"
	HeaderXForwardedSsl       = "X-Forwarded-Ssl"
	HeaderXUrlScheme          = "X-Url-Scheme"
	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
	HeaderXRealIP             = "X-Real-IP"
	HeaderXRequestID          = "X-Request-ID"
	HeaderXRequestedWith      = "X-Requested-With"
	HeaderServer              = "Server"
	HeaderOrigin              = "Origin"

	// Access control
	HeaderAccessControlRequestMethod    = "Access-Control-Request-Method"
	HeaderAccessControlRequestHeaders   = "Access-Control-Request-Headers"
	HeaderAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	HeaderAccessControlAllowMethods     = "Access-Control-Allow-Methods"
	HeaderAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
	HeaderAccessControlExposeHeaders    = "Access-Control-Expose-Headers"
	HeaderAccessControlMaxAge           = "Access-Control-Max-Age"

	// Security
	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
	HeaderXContentTypeOptions             = "X-Content-Type-Options"
	HeaderXXSSProtection                  = "X-XSS-Protection"
	HeaderXFrameOptions                   = "X-Frame-Options"
	HeaderContentSecurityPolicy           = "Content-Security-Policy"
	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
	HeaderXCSRFToken                      = "X-CSRF-Token"
	HeaderReferrerPolicy                  = "Referrer-Policy"
)

Headers

View Source
const (
	CONNECT = http.MethodConnect
	DELETE  = http.MethodDelete
	GET     = http.MethodGet
	HEAD    = http.MethodHead
	OPTIONS = http.MethodOptions
	PATCH   = http.MethodPatch
	POST    = http.MethodPost
	// PROPFIND = "PROPFIND"
	PUT   = http.MethodPut
	TRACE = http.MethodTrace
)

HTTP methods

View Source
const (
	// LangNone none
	LangNone = "none"
	// LangZh zh
	LangZh = "zh"
	// LangEn en
	LangEn = "en"
	// LangJa ja
	LangJa = "ja"
	// LangKo ko
	LangKo = "ko"
)

Variables

View Source
var ErrHTTPTag = struct {
	ErrUnsupportedMediaType        string
	ErrNotFound                    string
	ErrUnauthorized                string
	ErrForbidden                   string
	ErrMethodNotAllowed            string
	ErrStatusRequestEntityTooLarge string
	ErrTooManyRequests             string
	ErrBadRequest                  string
	ErrBadGateway                  string
	ErrInternalServerError         string
	ErrRequestTimeout              string
	ErrServiceUnavailable          string
	ErrValidatorNotRegistered      string
	ErrRendererNotRegistered       string
	ErrInvalidRedirectCode         string
	ErrCookieNotFound              string
	ErrInvalidCertOrKeyType        string
}{
	ErrUnsupportedMediaType:        fmt.Sprintf("http.code.%d", http.StatusUnsupportedMediaType),
	ErrNotFound:                    fmt.Sprintf("http.code.%d", http.StatusNotFound),
	ErrUnauthorized:                fmt.Sprintf("http.code.%d", http.StatusUnauthorized),
	ErrForbidden:                   fmt.Sprintf("http.code.%d", http.StatusForbidden),
	ErrMethodNotAllowed:            fmt.Sprintf("http.code.%d", http.StatusMethodNotAllowed),
	ErrStatusRequestEntityTooLarge: fmt.Sprintf("http.code.%d", http.StatusRequestEntityTooLarge),
	ErrTooManyRequests:             fmt.Sprintf("http.code.%d", http.StatusTooManyRequests),
	ErrBadRequest:                  fmt.Sprintf("http.code.%d", http.StatusBadRequest),
	ErrBadGateway:                  fmt.Sprintf("http.code.%d", http.StatusBadGateway),
	ErrInternalServerError:         fmt.Sprintf("http.code.%d", http.StatusInternalServerError),
	ErrRequestTimeout:              fmt.Sprintf("http.code.%d", http.StatusRequestTimeout),
	ErrServiceUnavailable:          fmt.Sprintf("http.code.%d", http.StatusServiceUnavailable),
	ErrValidatorNotRegistered:      "validator not registered",
	ErrRendererNotRegistered:       "renderer not registered",
	ErrInvalidRedirectCode:         "invalid redirect status code",
	ErrCookieNotFound:              "cookie not found",
	ErrInvalidCertOrKeyType:        "invalid cert or key type, must be string or []byte",
}

ErrHTTPTag err tags

View Source
var MessageMap = map[int]string{
	NormalMessageId:   "",
	ServerMaintenance: "服务器维护中 请稍后再试",
	AccountDisabled:   "帐号被禁用",
	AppidOverdue:      "appid过期",

	UnknownError:  "未知错误",
	TokenFailure:  "Token失效",
	HTMLSuccess:   "成功",
	BlockingAcess: "禁止访问",

	NewReport: "新消息返回",
	NewHeart:  "心跳消息",

	ParameterInvalid:         "参数无效",
	AppidParameterInvalid:    "授权参数无效",
	EncryptCheckError:        "密文校验失败",
	UserNameDoNotExist:       "用户名不存在或密码错误",
	DuplicateKeyError:        "键值对重复",
	NotFindError:             "未找到",
	InValidOp:                "无效操作",
	InValidAuthorize:         "授权码错误或未找到",
	HasusedError:             "已被使用",
	HasActvError:             "已被激活",
	ActvFailure:              "激活码被禁止使用",
	UserExisted:              "用户已存在",
	VerifyTimeError:          "验证码请求过于平凡",
	MailSendFaild:            "邮箱发送失败",
	SMSSendFaild:             "手机发送失败",
	PhoneParameterError:      "手机号格式有问题",
	VerifyError:              "验证码错误",
	UserNotExisted:           "用户不存在",
	TopicExisted:             "Topic已存在",
	TopicNotExisted:          "Topic不存在",
	BundleIdNotExisted:       "Bundle_id不存在",
	TopicStartFail:           "Topic开启处理失败",
	TopicTypeNotExisted:      "Topic处理类型不存在",
	TopicIsNotNull:           "Topic不能为空",
	DeviceNotExisted:         "设备不存在",
	StateExisted:             "状态已存在",
	LastMenuNotExisted:       "父菜单或根菜单不存在",
	MenuNotExisted:           "菜单不存在",
	UserMenuNotExisted:       "用户权限不存在",
	DeviceIdNotExisted:       "设备ID不存在",
	GoodsDealTypeNotExisted:  "商品处理类型不存在",
	GoodsIdNotExisted:        "商品不存在",
	GoodsBeInDiscount:        "商品正在折扣期",
	GoodsPayTypeNotExisted:   "商品可支付类型不存在",
	GoodsIdExisted:           "商品已存在",
	OrderIdNotExisted:        "订单不存在",
	GoodsBeNotInDiscount:     "商品未打折",
	NotifyIsNotMatch:         "会话不匹配",
	GoodsIsDiscountRecovery:  "商品已恢复原价",
	InvitationUserNotExisted: "邀请用户不存在",

	UserNotAuthorize:      "用户未授权",
	ApplicantIsExisted:    "申请人已存在",
	ApplicantNotExisted:   "申请人不存在",
	CreditOrderNotVaild:   "订单无效",
	RepeatWxWithdraw:      "微信零钱一天内多次提现",
	WxWithdrawAmountError: "微信零钱提现金额错误",
	WxWithdrawError:       "微信零钱提现失败",
	RepeatSubmission:      "重复提交",
	BundleExisted:         "bundle已存在",
	AuthExisted:           "权限已存在",
	AuthNotExisted:        "权限不存在",
	RoomTypeNotExisted:    "房型不存在",
	RoomTypeExisted:       "房型已存在",
	RoomNoNotExisted:      "房间不存在",
	RoomNoExisted:         "房间已存在",
	RateTypeExisted:       "房价代码或房价名称已存在",
	RateTypeNotExisted:    "房价代码不存在",
	FileNotExisted:        "文件不存在",
	RoomNoInvaild:         "房间未启用",
	ClassExisted:          "班次已存在",
	ClassNotExisted:       "班次不存在",
	CheckTimeError:        "系统时间与营业时间不匹配",
	CurrentClassIsShift:   "当前班次已完成交班",
	PayPriceError:         "支付金额错误",
	StockNotEnough:        "存量不足",
	DBSaveError:           "数据存储错误",
	DBAddError:            "数据添加错误",
	DBUpdateError:         "数据更新错误",
	DBDeleteError:         "数据删除错误",
	TimeError:             "时间错误",
	OrderInfoError:        "预定信息有误",
	NotVaildError:         "不允许",
	Overdue:               "已过期",
	MaxOverError:          "超过最大值",
	MinOverError:          "低于最小值",
	ExistedError:          "已存在",
	NotBindError:          "未绑定",
	BindError:             "绑定失败",
	CalError:              "计算错误",
}

消息翻译

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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