resp

package
v0.0.0-...-a18df83 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// resp 状态码
	SUCCESS      = 0   // 请求成功
	FAIL         = 1   // 请求失败
	ERROR        = 99  // 请求错误
	NOTLOGIN     = 401 // 未登录
	UNAUTHORIZED = 403 // 没权限
)

Variables

This section is empty.

Functions

func JsonError

func JsonError(r *ghttp.Request, err error)

func JsonExit

func JsonExit(r *ghttp.Request, code int, msg string, data ...interface{})

func JsonFail

func JsonFail(r *ghttp.Request, err error)

func JsonSuccess

func JsonSuccess(r *ghttp.Request, data ...interface{})

Types

type JsonResponse

type JsonResponse struct {
	Code int         `json:"code"` // 错误码((0:成功, 1:失败, 99:错误, 401:认证失败))
	Msg  string      `json:"msg"`  // 提示信息
	Data interface{} `json:"data"` // 返回数据(业务接口定义具体数据结构)
}

数据返回通用JSON数据结构

Jump to

Keyboard shortcuts

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