This commit is contained in:
laodaming 2023-06-12 17:29:32 +08:00
commit 718b8118bf
2 changed files with 3 additions and 1 deletions

View File

@ -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 {

View File

@ -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"`