代码拉取完成,页面将自动刷新
/*
* @Author: i@rysa.cn
* @Date: 2021-04-16 15:25:14
* @LastEditTime: 2021-10-12 12:03:38
* @LastEditors: i@rysa.cn
* @Description:
* @FilePath: \go-utils\jsonData.go
*/
package go_utils
type JsonData struct {
Code int `json:"code"`
Data interface{} `json:"data"`
Msg string `json:"msg"`
}
func Json(code int, data interface{}, msg string) *JsonData {
return &JsonData{
Code: code,
Data: data,
Msg: msg,
}
}
func JsonNoData(code int, msg string) *JsonData {
return &JsonData{
Code: code,
Msg: msg,
}
}
func JsonErr(code int, err error) *JsonData {
return &JsonData{
Code: code,
Msg: err.Error(),
}
}
func Response(code int, err error, msg string, data interface{}) *JsonData {
if err != nil {
return JsonErr(code, err)
}
return Json(200, data, msg)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。