Documentation
¶
Index ¶
- Constants
- Variables
- func BSAuth(ctx *context.Context)
- func GetLogsPath() (path string)
- func GetPath(l []string) (path string)
- func GetRootPath() (rootpath string)
- func GetTplPath() (path string)
- func GetUploadPath() (path string)
- func TokenDealFilter(ctx *context.Context)
- type BaseController
- func (b *BaseController) GetStandRestResult() StandRestResultInf
- func (c *BaseController) JSONResponse(err error, data ...interface{})
- func (c *BaseController) SaveToFileCustomName(fromfile string, fc func(*multipart.FileHeader) string) error
- func (c *BaseController) ServeDecryptJSON()
- func (c *BaseController) ValidateParameters(obj interface{}) customerror.CustomError
- type QueryConditon
- type RestResult
- type StandRestResult
- type StandRestResultInf
Constants ¶
View Source
const ( ENCRYPT_TYPE = "EncryptType" // 加密类型KEY ENCRYPT_TYPE_AES_PRIV_REQ = "AES_PRIV_REQ" // 请求加密 ENCRYPT_TYPE_AES_PRIV_RESP = "AES_PRIV_RESP" // 响应加密 ENCRYPT_TYPE_AES_PRIV_REQ_RESP = "AES_PRIV_REQ_RESP" // 请求和响应都加密 ERR_CODE_ENCRYPT_FAILED = 9001 // 加密响应body失败 )
View Source
const ( MultiSelect = "multi-select" // 多选 MultiText = "multi-text" // 模糊多选 NumRange = "num-range" // 数字范围或者数字查询 NotIn = "not-in" // 不在范围内 Range = "range" // 日期区间的查询 CommaMultiSelect = "comma-multi-select" //数据库中存放是逗号分隔的值 )
查询条件常量
View Source
const ( TokenKey = "Authorization" UserNameSessionKey = "X-UserName" CodeKey = "X-Code" AppTag = "APPID" )
Variables ¶
View Source
var ( //NotFound not found NotFound = customerror.New(404, "NOT_FOUND") //ErrServer 服务器错误 ErrServer = customerror.New(500, "服务器错误") //SignError sign error SignError = customerror.New(1103, "Sign签名错误") //ParamsError json error ParamsError = customerror.New(1101, "参数格式错误") // Validate error ParamsValidateError = customerror.New(1102, "参数校验错误") //InternalServerError 500 InternalServerError = customerror.New(500, "INTERNAL_SERVER_ERROR") //ParamsFormatError 参数格式错误 ParamsFormatError = customerror.New(1102, "PARAMS_FORMAT_ERROR") //LoginTokenInvalid 登录token失效 LoginTokenInvalid = customerror.New(1104, "LOGIN_TOKEN_INVALID") //AppIDError AppIDError AppIDError = customerror.New(1105, "AppID Error") //TimestampError TimestampError TimestampError = customerror.New(1106, "Timestamp Error") //AccountError 账号或密码错误 AccountError = customerror.New(2102, "ACCOUNT_ERROR") // TOKEN 不存在 TokenNotFound = customerror.New(3000, "Token信息不存在") //AccessTokenExpire 帐号app的token过期 AccessTokenExpire = customerror.New(3001, "AccessToken Error or Expire") //RefreshTokenExpire 帐号app的刷新令牌过期 RefreshTokenExpire = customerror.New(3002, "RefreshToken Error or Expire") TokenInvalid = customerror.New(3003, "非法的token") // 用户认证信息不存在 UnameNotFound = customerror.New(3005, "用户认证信息不存在") //OauthCodeExpire accesstoken过期 OauthCodeExpire = customerror.New(3006, "Oauth Code Expire") // AuthStateInvalid = customerror.New(3007, "Auth state 不正确") // AuthCodeInvalid = customerror.New(3008, "Auth code 不正确") // UserNameOrPasswordInvalid = customerror.New(5009, "用户名或者密码错误") // LdapErr 域账号登陆异常 LdapErr = customerror.New(5005, "域账号登陆异常") // DisabledUser 禁用的用户 DisabledUser = customerror.New(5006, "禁用的用户") AnotherClientLogin = customerror.New(50008, "其他客户端登录了") //GetCodeFrequently 请求验证码次数过多 GetCodeFrequently = customerror.New(3009, "请求验证码次数过多") //VerificationCodeeError 验证码错误 VerificationCodeeError = customerror.New(3010, "验证码错误") //ImageError 图片格式不支持 ImageError = customerror.New(4001, "该图片格式不支持") //NicknameError 昵称错误 NicknameError = customerror.New(4002, "昵称包含禁用词") // UserAlreadyExist 创建的用户已经存在 UserAlreadyExist = customerror.New(5001, "用户已存在") // UserDoesNotExist 用户不存在 UserDoesNotExist = customerror.New(5002, "用户不存在") // WrongPassword 密码错误 WrongPassword = customerror.New(5003, "密码错误") )
View Source
var ( ServerErr = customerror.New(500, "服务器错误") QueryCondErr = customerror.New(1001, "查询条件不正确") StepTypeNotFound = customerror.New(1002, "Flow Step 不存在") ServiceIdNotInt = customerror.New(1003, "Service Id格式不正确") ParamsErr = customerror.New(1004, "参数错误") UploadErr = customerror.New(1005, "上传文件失败") UpdateActionNotFound = customerror.New(1006, "Update Acton 不存在") ActionNotFound = customerror.New(1007, "Action 不存在") )
Functions ¶
func GetRootPath ¶
func GetRootPath() (rootpath string)
Types ¶
type BaseController ¶
type BaseController struct { REST StandRestResultInf beego.Controller // beego 基础控制器 }
BaseController ... 所有控制controller的基础struct
func (*BaseController) GetStandRestResult ¶
func (b *BaseController) GetStandRestResult() StandRestResultInf
func (*BaseController) JSONResponse ¶
func (c *BaseController) JSONResponse(err error, data ...interface{})
JSONResponse 返回JSON格式结果
func (*BaseController) SaveToFileCustomName ¶
func (c *BaseController) SaveToFileCustomName(fromfile string, fc func(*multipart.FileHeader) string) error
SaveToFileCustomName saves uploaded file to new path with custom name. it only operates the first one of mutil-upload form file field.
func (*BaseController) ServeDecryptJSON ¶
func (c *BaseController) ServeDecryptJSON()
ServeSelfJSON ... Controller 自定义方法,用来处理加密返回
func (*BaseController) ValidateParameters ¶
func (c *BaseController) ValidateParameters(obj interface{}) customerror.CustomError
ValidateParameters obj must pointer, json Unmarshal object and require parameter validate
type QueryConditon ¶
type QueryConditon struct { QueryKey string QueryType string // multi-select multi-text num-range comma-multi-select QueryValues []string }
QueryConditon 表格查询条件对象
func QueryKeyReplace ¶
func QueryKeyReplace(query []*QueryConditon, repMap map[string]string) (ret []*QueryConditon)
type RestResult ¶
RestResult Rest接口返回值(兼容特性使用)
type StandRestResult ¶
type StandRestResult struct { Code int `json:"code"` // 0 表示成功,其他失败 Message string `json:"message"` // 错误信息 Data interface{} `json:"data"` // 数据体 }
标准的 rest 返回接口,字符小写化
func (StandRestResult) GetStandRestResult ¶
func (rest StandRestResult) GetStandRestResult(code int, msg string, data interface{}) interface{}
type StandRestResultInf ¶
type StandRestResultInf interface {
GetStandRestResult(code int, msg string, data interface{}) interface{}
}
返回接口
Click to show internal directories.
Click to hide internal directories.