Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CSuccess = New(0, "SUCCESS", nil) //成功 CError = New(1, "ERROR", nil) //通用error CSysBusy = New(2, "SYSTEM_BUSY", nil) //系统繁忙 CAccessTooMuch = New(3, "REQUEST_LIMITED", nil) //请求受限 CParamsInvalid = New(4, "PARAMS_INVALID", nil) //无效参数 CVtCodeInvalid = New(5, "CODE_INVALID", nil) //无效验证码 CNotSupport = New(6, "NOT_SUPPORT", nil) //不支持此操作 CTryAgain = New(7, "TRY_AGAIN", nil) //请重试 CFail = New(8, "OPERATE_FAIL", nil) //操作失败 CPermissionDeny = New(9, "PERMISSION_DENY", nil) //权限受限 CNotFound = New(10, "NOT_FOUND", nil) //未查询到数据 CAuthDenied = New(99, "AUTH_DENY", nil) //授权过期 )
常用的返回response
Functions ¶
This section is empty.
Types ¶
type AdminDetailResp ¶ added in v1.0.1
type AdminDetailResp struct { Id int64 `json:"id"` Account string `json:"account" ` Nickname string `json:"nickname"` Avatar string `json:"avatar"` Email string `json:"email"` Phone string `json:"phone"` //手机号 LastLogin *time.Time `json:"last_login,omitempty"` //上次登录时间 LastIp string `json:"last_ip,omitempty"` //上次登录ip IsRoot int `json:"is_root"` //1:是root,0:非root ExpiredAt int64 `json:"expired_at,omitempty"` //过期时间 Remark string `json:"remark,omitempty"` //备注 Status int `json:"status,omitempty"` //0:无,1:可用,2:禁用 CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type AdminListItemResp ¶ added in v1.0.1
type AdminListItemResp struct { Id int64 `json:"id"` Account string `json:"account" ` Nickname string `json:"nickname"` Avatar string `json:"avatar"` Email string `json:"email"` Phone string `json:"phone"` //手机号 LastLogin *time.Time `json:"last_login,omitempty"` //上次登录时间 LastIp string `json:"last_ip,omitempty"` //上次登录ip IsRoot int `json:"is_root"` //1:是root,0:非root ExpiredAt int64 `json:"expired_at,omitempty"` //过期时间 Status int `json:"status,omitempty"` //0:无,1:可用,2:禁用 CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type AuthResp ¶
type AuthResp struct { Auth struct { Id int64 `json:"id,omitempty"` Nickname string `json:"nickname,omitempty"` Avatar string `json:"avatar,omitempty"` Status int `json:"status"` SaasId int64 `json:"saas_id,omitempty"` // saas模式下用到的归属租户id SaasName string `json:"saas_name,omitempty"` // saas模式下用到的归属租户的名称 Extends map[string]string `json:"extends,omitempty"` //额外信息 } `json:"auth"` //授权信息 ExpiredAt int64 `json:"expired_at"` //过期时间戳,秒级 Token string `json:"token,omitempty"` //授权凭证 }
type CaptchaResponse ¶
type QueryUserResp ¶
type QueryUserResp struct { Id int64 `json:"id,omitempty"` Account string `json:"account"` Nickname string `json:"nickname"` //昵称 Sex int `json:"sex"` //性别,0:未知,1:男,2:女 Avatar string `json:"avatar"` //头像 Email string `json:"email"` //email Phone string `json:"phone"` //手机号 LastLogin *time.Time `json:"last_login,omitempty"` //上次登录时间 LastIp string `json:"last_ip,omitempty"` //上次登录ip Status int `json:"status,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Thirds []*UserThirdInfo `json:"third_binds"` //第三方绑定列表 }
QueryUserResp 查询用户返回结果
type RegisterResp ¶
type RegisterResp struct { Account string `json:"account" gorm:"type:varchar(64);uniqueIndex"` Nickname string `json:"nickname" gorm:"type:varchar(64)"` Sex int `json:"sex"` Avatar string `json:"avatar" gorm:"type:varchar(256)"` Email string `json:"email" gorm:"type:varchar(128)"` Phone string `json:"phone" gorm:"type:varchar(32)"` }
RegisterResp 注册resp
type ResponseData ¶
type ResponseData struct { Code int64 `json:"code"` //返回码,0:成功,>0为对应错误码 Msg string `json:"msg"` Data interface{} `json:"data"` }
func ErrToResponseData ¶
func ErrToResponseData(err error) ResponseData
func New ¶
func New(code int64, msg string, data interface{}) ResponseData
New godoc @Summary 响应 @Description 响应返回的数据中包含以下字段:Code,Msg,Data @Description Code=错误码 @Description Msg=错误信息 @Description Data=具体数据,一般成功情况下会返回对应数据 @Tags 通用 @Router /-common/response [post] @x-code-samples [{"lang":"js","label":"成功","source":"{\n\"code\":0,\n\"msg\":\"success\",\n\"data\":{}\n}"},{"lang":"js","label":"失败","source":"{\n\"code\":1,\n\"msg\":\"error\",\n\"data\":{}\n}"}]
func (ResponseData) Error ¶
func (data ResponseData) Error() string
func (ResponseData) MCode ¶
func (data ResponseData) MCode(code int64) ResponseData
func (ResponseData) MData ¶
func (data ResponseData) MData(d interface{}) ResponseData
func (ResponseData) MMsg ¶
func (data ResponseData) MMsg(msg string) ResponseData
type SearchListResponse ¶
type SmsCodeSendResp ¶
type SmsCodeVerifyResp ¶
type UserThirdInfo ¶
type UserThirdInfo struct { Id int64 `json:"id" gorm:"primaryKey"` ThirdId string `json:"third_id" gorm:"type:varchar(64);uniqueIndex"` //第三方id ThirdUnionId string `json:"third_union_id" gorm:"type:varchar(64);uniqueIndex"` //第三方union id ThirdType string `json:"third_type" gorm:"type:varchar(16)"` //第三方类型 UId int64 `json:"uid" gorm:"index"` Nickname string `json:"nickname" gorm:"type:varchar(64)"` Avatar string `json:"avatar" gorm:"type:varchar(256)"` ExtendInfo string `json:"extend_info,omitempty" gorm:"type:varchar(512)"` //拓展信息,可以存json //额外可获取的用户信息 Phone string `json:"phone" gorm:"-"` Email string `json:"email" gorm:"-"` }
Click to show internal directories.
Click to hide internal directories.