Update api template (#2172)

master
anqiansong 2 years ago committed by GitHub
parent bc85eaa9b1
commit 9c448c64ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,7 +12,6 @@ import (
"github.com/zeromicro/go-zero/tools/goctl/util" "github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/format" "github.com/zeromicro/go-zero/tools/goctl/util/format"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx" "github.com/zeromicro/go-zero/tools/goctl/util/pathx"
"github.com/zeromicro/go-zero/tools/goctl/vars"
) )
const defaultLogicPackage = "logic" const defaultLogicPackage = "logic"
@ -50,7 +49,6 @@ func genHandler(dir, rootPkg string, cfg *config.Config, group spec.Group, route
return doGenToFile(dir, handler, cfg, group, route, handlerInfo{ return doGenToFile(dir, handler, cfg, group, route, handlerInfo{
PkgName: pkgName, PkgName: pkgName,
ImportPackages: genHandlerImports(group, route, parentPkg), ImportPackages: genHandlerImports(group, route, parentPkg),
ImportHttpxPackage: fmt.Sprintf("\"%s/rest/httpx\"", vars.ProjectOpenSourceURL),
HandlerName: handler, HandlerName: handler,
RequestType: util.Title(route.RequestTypeName()), RequestType: util.Title(route.RequestTypeName()),
LogicName: logicName, LogicName: logicName,

@ -3,8 +3,8 @@ package {{.PkgName}}
import ( import (
"net/http" "net/http"
"github.com/zeromicro/go-zero/rest/httpx"
{{.ImportPackages}} {{.ImportPackages}}
{{.ImportHttpxPackage}}
) )
func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc { func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {

Loading…
Cancel
Save