11
This commit is contained in:
commit
718b8118bf
|
@ -50,7 +50,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
|
{{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
|
||||||
{{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, userinfo{{end}})
|
{{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo)
|
||||||
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
||||||
// 否则,发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
|
// 否则,发送500内部服务器错误的JSON响应并记录错误消息logx.Error。
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
|
|
|
@ -6,7 +6,9 @@ info (
|
||||||
author: ""
|
author: ""
|
||||||
email: ""
|
email: ""
|
||||||
)
|
)
|
||||||
|
type request {
|
||||||
|
|
||||||
|
}
|
||||||
// response 统一返回码
|
// response 统一返回码
|
||||||
type response {
|
type response {
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user