Bläddra i källkod

代码生成自动注册模块路由,插件模块代码生成支持

yxh 4 år sedan
förälder
incheckning
4795ddcbfd
1 ändrade filer med 4 tillägg och 4 borttagningar
  1. 4 4
      app/system/service/tools_gen_table.go

+ 4 - 4
app/system/service/tools_gen_table.go

@@ -724,11 +724,11 @@ func (s *toolsGenTable) writeDb(path string, ctx context.Context) (err error) {
 
 // GenModuleRouter 生成模块路由
 func (s *toolsGenTable) genModuleRouter(curDir, moduleName, packageName string) (err error) {
-	routerFilePath := strings.Join([]string{curDir, "/router/", gstr.CaseSnake(moduleName), ".go"}, "")
-	if gstr.ContainsI(packageName, "plugins") {
-		routerFilePath = strings.Join([]string{curDir, "/plugins/router/", gstr.CaseSnake(moduleName), ".go"}, "")
-	}
 	if gstr.CaseSnake(moduleName) != "system" {
+		routerFilePath := strings.Join([]string{curDir, "/router/", gstr.CaseSnake(moduleName), ".go"}, "")
+		if gstr.ContainsI(packageName, "plugins") {
+			routerFilePath = strings.Join([]string{curDir, "/plugins/router/", gstr.CaseSnake(moduleName), ".go"}, "")
+		}
 		code := fmt.Sprintf(`package router%simport _ "%s/router"`, "\n", packageName)
 		s.createFile(routerFilePath, code, false)
 	}