service

package
v0.0.0-...-eaabf50 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess = 1000 + iota
	CodeInvalidParams
	CodeUserExist
	CodeCategoryExist
	CodeUserNotExist
	CodeErrUserPsw
	CodeServerBusy
	CodeAuthNull
	CodeAuthErrFormat
	CodeAuthInvalidToken
	CodeParamTypeErr
	CodeUserNotLogin
	CodeUserErrLogin
)

Variables

View Source
var CodeMsgText = map[int]string{
	CodeSuccess:          "success",
	CodeInvalidParams:    "请求参数错误 ",
	CodeUserExist:        "用户已经存在",
	CodeUserNotExist:     "用户不存在",
	CodeErrUserPsw:       "密码或者用户名输入有误",
	CodeServerBusy:       "服务器繁忙",
	CodeAuthNull:         "请求头中auth为空,需要登陆",
	CodeAuthErrFormat:    "请求头中auth格式有误,需要登陆",
	CodeAuthInvalidToken: "无效的Token",
	CodeParamTypeErr:     "参数类型错误",
	CodeUserNotLogin:     "用户没有登陆",
	CodeUserErrLogin:     "用户名或密码输入有误",
	CodeCategoryExist:    "分类已经存在",
}

Functions

func Insert

func Insert(ctx context.Context, c *app.RequestContext)

func ResponseErr

func ResponseErr(ctx *app.RequestContext, code int)

func ResponseErrWithMsg

func ResponseErrWithMsg(ctx *app.RequestContext, code int, msgErr string)

func ResponseSuccess

func ResponseSuccess(ctx *app.RequestContext, data interface{})

func SearchAll

func SearchAll(ctx context.Context, c *app.RequestContext)

func SearchAllWithPost

func SearchAllWithPost(ctx context.Context, c *app.RequestContext)

func SearchOne

func SearchOne(ctx context.Context, c *app.RequestContext)

func Update

func Update(ctx context.Context, c *app.RequestContext)

Types

type Response

type Response struct {
	Code int         `json:"code"`
	Msg  interface{} `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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