Documentation ¶
Index ¶
- Constants
- Variables
- type CommonController
- func (controller *CommonController) CheckError(err error, msg string)
- func (controller *CommonController) CheckParams(params interface{})
- func (controller *CommonController) CheckValidation(requestData interface{})
- func (controller *CommonController) ClearAuth(clearMap *map[string]interface{})
- func (controller *CommonController) Fail(msg string)
- func (controller *CommonController) GetJsonStruct(paramsStruct interface{})
- func (controller *CommonController) GetPageNo() uint
- func (controller *CommonController) GetParamStruct(paramsStruct interface{})
- func (controller *CommonController) SetToken(token string)
- func (controller *CommonController) String2Int64(str string) int64
- func (controller *CommonController) String2Uint(str string) uint
- func (controller *CommonController) String2Uint8(str string) uint8
- func (controller *CommonController) Success(data interface{}, msg string)
- func (controller *CommonController) UnitCheckError(data interface{}, err error)
- type Output
- func (output *Output) ErrorOutput(msg string) *Output
- func (output *Output) NoPermOutput(msg string) *Output
- func (output *Output) OptionsOutput(msg string) *Output
- func (output *Output) SetDefaultErrorMsg(errMsg string) string
- func (output *Output) SetToken(token string) *Output
- func (output *Output) SuccessOutput(data interface{}, msg string) *Output
Constants ¶
View Source
const ( SuccessCode = 1 ErrorCode = 0 NoPermCode = 0 OptionsCode = 1 )
View Source
const ( SuccessMsg = "操作成功" ErrorMsg = "系统异常" NoPermMsg = "没有权限" )
Variables ¶
View Source
var DefaultErrorMsgList = map[string]string{
"<QuerySeter> no row found": "未知数据",
}
Functions ¶
This section is empty.
Types ¶
type CommonController ¶
type CommonController struct { beego.Controller // contains filtered or unexported fields }
func (*CommonController) CheckError ¶
func (controller *CommonController) CheckError(err error, msg string)
错误信息验证
func (*CommonController) CheckParams ¶
func (controller *CommonController) CheckParams(params interface{})
通过注解的valid来校验,传入是结构体的地址
func (*CommonController) CheckValidation ¶
func (controller *CommonController) CheckValidation(requestData interface{})
validation验证,error直接返回
func (*CommonController) ClearAuth ¶
func (controller *CommonController) ClearAuth(clearMap *map[string]interface{})
把校验的内容删掉
func (*CommonController) GetJsonStruct ¶
func (controller *CommonController) GetJsonStruct(paramsStruct interface{})
json接收数据转换的公用方法
func (*CommonController) GetParamStruct ¶
func (controller *CommonController) GetParamStruct(paramsStruct interface{})
通过结构体获取数据
func (*CommonController) SetToken ¶
func (controller *CommonController) SetToken(token string)
动态设置token
func (*CommonController) String2Int64 ¶
func (controller *CommonController) String2Int64(str string) int64
string to int64
func (*CommonController) String2Uint ¶
func (controller *CommonController) String2Uint(str string) uint
string to uint
func (*CommonController) String2Uint8 ¶
func (controller *CommonController) String2Uint8(str string) uint8
string to uint8
func (*CommonController) Success ¶
func (controller *CommonController) Success(data interface{}, msg string)
成功的json
func (*CommonController) UnitCheckError ¶
func (controller *CommonController) UnitCheckError(data interface{}, err error)
专为修改单位验证接口使用的返回错误
type Output ¶
type Output struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` Custom interface{} `json:"custom"` Token string `json:"token"` }
func (*Output) ErrorOutput ¶
func (*Output) NoPermOutput ¶
func (*Output) OptionsOutput ¶
func (*Output) SetDefaultErrorMsg ¶
获取error默认提示信息
func (*Output) SuccessOutput ¶
Click to show internal directories.
Click to hide internal directories.