package response import "github.com/gogf/gf/v2/net/ghttp" // Body is the only JSON envelope exposed by both API surfaces. type Body struct { Code int `json:"code"` Message string `json:"message"` Data any `json:"data,omitempty"` } func JSON(r *ghttp.Request, code int, message string, data any) { r.Response.WriteJsonExit(Body{Code: code, Message: message, Data: data}) } func OK(r *ghttp.Request, data any) { JSON(r, 0, "ok", data) }