|
- package {{.PkgName}}
-
- import (
- "github.com/zeromicro/go-zero/rest/httpx"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/repository/result"
- "net/http"
- {{.ImportPackages}}
- )
-
- func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- {{if .HasRequest}}var req types.{{.RequestType}}
- if err := httpx.Parse(r, &req); err != nil {
- result.ParamErrorResult(r,w,err)
- return
- }
-
- {{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
- {{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}&req{{end}})
- result.HttpResult(r, w, {{if .HasResp}}resp{{else}}nil{{end}}, err)
- }
- }
|