修复handler.tpl没有return, 添加单元测试例子

This commit is contained in:
eson
2023-06-12 17:10:27 +08:00
parent ff05e127bd
commit f4873d1720
10 changed files with 66 additions and 212 deletions

View File

@@ -23,6 +23,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized",
})
logx.Info("unauthorized:", err.Error())
return
}
// Token里获取对应的信息
@@ -34,6 +35,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
Message: "unauthorized",
})
logx.Info("unauthorized:", err.Error())
return
}
{{if .HasRequest}}var req types.{{.RequestType}}
@@ -58,5 +60,6 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
}
return
}
}