response

package
v1.1.30 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Json

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

Json 返回标准JSON数据。

func JsonExit

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

JsonExit 返回标准JSON数据并退出当前HTTP执行函数。

func JsonRedirect

func JsonRedirect(r *ghttp.Request, code int, message, redirect string, data ...interface{})

JsonRedirect 返回标准JSON数据引导客户端跳转。

func JsonRedirectExit

func JsonRedirectExit(r *ghttp.Request, code int, message, redirect string, data ...interface{})

JsonRedirectExit 返回标准JSON数据引导客户端跳转,并退出当前HTTP执行函数。

Types

type JsonRes

type JsonRes struct {
	Code      int         `json:"code"`               // 错误码((0:成功, 1:失败, >1:错误码))
	Message   string      `json:"message"`            // 提示信息
	Data      interface{} `json:"data"`               // 返回数据(业务接口定义具体数据结构)
	Redirect  string      `json:"redirect,omitempty"` // 引导客户端跳转到指定路由
	RequestId string      `json:"request_id,omitempty"`
}

JsonRes 数据返回通用JSON数据结构

Jump to

Keyboard shortcuts

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