重新调整w,r的入口

This commit is contained in:
eson
2023-07-24 13:17:02 +08:00
parent 4c2f823178
commit 7ec78d1c35
82 changed files with 89 additions and 88 deletions

View File

@@ -25,7 +25,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
{{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo)
if !basic.AfterLogic(w, r, rl) {
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}

View File

@@ -25,10 +25,12 @@ func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}}
// func (l *{{.logic}}) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
// 处理逻辑后 w,r 如:重定向
// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request) {
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }
func (l *{{.logic}}) {{.function}}({{.request}}, userinfo *auth.UserInfo) (resp *basic.Response) {
// Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo , null