package models const ( BaseRespCodeAbnormalLogin = 4011 // 异常登录状态码 BaseRespCodeLoginErr = 4012 // 账号或密码输入错误 ) type BaseResponse struct { Ret int Msg string ErrMsg string ErrCode string Data interface{} Success bool `description:"true 执行成功,false 执行失败"` IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"` IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" ` } type BaseResponseRef struct { Ret int Msg string ErrMsg string ErrCode string Data string } type BaseResponseResult struct { Ret int `description:"状态:200 成功,408 重新登录,403:为失败, 406:已被删除"` Msg string `description:"提示信息,对用户展示"` ErrMsg string `description:"错误信息,供开发定位问题"` ErrCode string `description:"错误编码,预留"` Data string `description:"返回数据,json格式字符串"` } func (r *BaseResponse) Init() *BaseResponse { return &BaseResponse{Ret: 403, IsSendEmail: true} } type BaseRequest struct { } func (br *BaseRequest) Init() *BaseRequest { return &BaseRequest{} } type ResultData struct { Code int `json:"code" description:"状态码"` Msg string `json:"msg" description:"提示信息"` Data interface{} `json:"data" description:"返回数据"` ErrMsg string `json:"-" description:"错误信息,不用返回给前端,只是做日志记录"` }