提交 cc78ef25 authored 作者: 赵雪如's avatar 赵雪如

修改请求id RequestId 返回接收逻辑

上级 ff97c1b4
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
var ( var (
codeNil = BizCode{0, "", ""} codeNil = BizCode{0, "", ""}
CodeSuccess = BizCode{1, "success", ""} // It is success. CodeSuccess = BizCode{1, "操作成功", ""} // It is success.
CodeInternalError = BizCode{50, "Internal Error", ""} CodeInternalError = BizCode{50, "Internal Error", ""}
CodeUnknown = BizCode{500, "An internal server error occurred", ""} CodeUnknown = BizCode{500, "An internal server error occurred", ""}
) )
......
...@@ -3,6 +3,7 @@ package response ...@@ -3,6 +3,7 @@ package response
import ( import (
"github.com/gogf/gf/net/ghttp" "github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/util/gconv" "github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/grand"
"gitlab.jxhh.com/zhaoxueru/common-base.git/pkg/errors" "gitlab.jxhh.com/zhaoxueru/common-base.git/pkg/errors"
) )
...@@ -26,6 +27,7 @@ func Json(r *ghttp.Request, code int, message string, data ...interface{}) { ...@@ -26,6 +27,7 @@ func Json(r *ghttp.Request, code int, message string, data ...interface{}) {
jsonResponse.Code = code jsonResponse.Code = code
jsonResponse.Message = message jsonResponse.Message = message
jsonResponse.Data = responseData jsonResponse.Data = responseData
jsonResponse.Id = grand.S(20)
if !r.GetCtxVar("RequestId").IsNil(){ if !r.GetCtxVar("RequestId").IsNil(){
jsonResponse.Id = gconv.String(r.GetCtxVar("RequestId")) jsonResponse.Id = gconv.String(r.GetCtxVar("RequestId"))
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论