response

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 0 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ERROR   string = "500000"
	SUCCESS string = "200000"
	MSG     string = "消息处理成功"
)

Variables

View Source
var ACCESS_PERM_DENIED = Msginfo{Code: "400001", Message: "对不起,您没有访问权限"}
View Source
var CAPTCHA_EXPIRE = Msginfo{Code: "400003", Message: "图片验证码已失效"}
View Source
var CAPTCHA_VALIDATE_FAIL = Msginfo{Code: "400002", Message: "图片验证码验证失败"}
View Source
var COMMON_EXCEPTION = Msginfo{Code: "500001", Message: "消息处理异常"}
View Source
var DB_INSERT_EXCEPTION = Msginfo{Code: "500002", Message: "数据插入异常"}
View Source
var DB_KEY_DUPLICATE = Msginfo{Code: "500011", Message: "主键或唯一性约束冲突"}
View Source
var DB_SELECT_EXCEPTION = Msginfo{Code: "500004", Message: "数据查询异常"}
View Source
var DB_UPDATE_EXCEPTION = Msginfo{Code: "500003", Message: "数据更新异常"}
View Source
var EXCEPTION = Msginfo{Code: ERROR, Message: "系统繁忙,请稍后重试"}
View Source
var PHARMACY_NOT_BIND = Msginfo{Code: "400004", Message: "药店信息未绑定"}
View Source
var PHARMACY_NOT_EXIST = Msginfo{Code: "400005", Message: "药店信息不存在"}
View Source
var PHONE_ERROR_FORMAT = Msginfo{Code: "400008", Message: "手机号格式不正确"}
View Source
var PHONE_OR_PASSWORD_EMPTY = Msginfo{Code: "400006", Message: "手机号或密码不能为空"}
View Source
var PHONE_OR_PASSWORD_ERROR = Msginfo{Code: "400007", Message: "手机号或密码不正确"}
View Source
var REQUEST_FREQUENTLY_ERROR = Msginfo{Code: "400011", Message: "请求过于频繁"}
View Source
var SMS_TEMPLATE_ERROR = Msginfo{Code: "4B2001", Message: "无效的短信模板"}
View Source
var SUCCESS_MSG = Msginfo{Code: SUCCESS, Message: MSG}
View Source
var VALIDATE_API_ERROR = Msginfo{Code: "400010", Message: "数据校验不合法"}
View Source
var VALIDATE_ERROR = Msginfo{Code: "400000", Message: "数据校验不合法"}

Functions

This section is empty.

Types

type Msginfo

type Msginfo struct {
	Code    string
	Message string
}

func NewMsgInfo

func NewMsgInfo(code string, msg string) *Msginfo

func (Msginfo) String

func (mi Msginfo) String() string

type Response

type Response struct {
	Code       string      `json:"code"`
	Message    string      `json:"message"`
	SubMessage interface{} `json:"subMessage"`
	Result     interface{} `json:"result"`
	Success    bool        `json:"success"`
}

func Create

func Create(code string, msg string, subMsg string, data interface{}) Response

func CreateMsgInfo

func CreateMsgInfo(msgInfo Msginfo, subMsg string) Response

func CreateMsgInfoResult

func CreateMsgInfoResult(msgInfo Msginfo, result interface{}) Response

func DefaultFailSubMsg

func DefaultFailSubMsg(subMsg string) Response

func Fail

func Fail(msg string) Response

func FailSubMsg

func FailSubMsg(subMsg string) Response

func FailSubMsgResult

func FailSubMsgResult(msg string, subMsg string, result interface{}) Response

func Success

func Success(data interface{}) Response

func ValidateError

func ValidateError(subMsg string) Response

func (*Response) IsSuccess

func (resp *Response) IsSuccess() bool

Jump to

Keyboard shortcuts

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