controllers

package
v0.0.0-...-10721fb Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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) Fail

func (controller *CommonController) Fail(msg string)

失败的json

func (*CommonController) GetJsonStruct

func (controller *CommonController) GetJsonStruct(paramsStruct interface{})

json接收数据转换的公用方法

func (*CommonController) GetPageNo

func (controller *CommonController) GetPageNo() uint

方便获取页码

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 *Output) ErrorOutput(msg string) *Output

func (*Output) NoPermOutput

func (output *Output) NoPermOutput(msg string) *Output

func (*Output) OptionsOutput

func (output *Output) OptionsOutput(msg string) *Output

func (*Output) SetDefaultErrorMsg

func (output *Output) SetDefaultErrorMsg(errMsg string) string

获取error默认提示信息

func (*Output) SetToken

func (output *Output) SetToken(token string) *Output

func (*Output) SuccessOutput

func (output *Output) SuccessOutput(data interface{}, msg string) *Output

Jump to

Keyboard shortcuts

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