Procházet zdrojové kódy

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

evoxwht před 2 roky
rodič
revize
d5686962a9

+ 13 - 0
crmeb/app/adminapi/controller/v1/setting/SystemCrud.php

@@ -72,8 +72,13 @@ class SystemCrud extends AuthController
             ['fromField', []],
             ['fromField', []],
             ['columnField', []],
             ['columnField', []],
             ['filePath', []],
             ['filePath', []],
+            ['isTable', 0],
         ]);
         ]);
 
 
+        if (!$data['tableName']) {
+            return app('json')->fail('缺少表名');
+        }
+
         $this->services->createCrud($data);
         $this->services->createCrud($data);
 
 
         return app('json')->success('创建成功');
         return app('json')->success('创建成功');
@@ -96,6 +101,14 @@ class SystemCrud extends AuthController
             ['columnField', []],
             ['columnField', []],
         ], true);
         ], true);
 
 
+        if (!$tableName) {
+            return app('json')->fail('缺少表名');
+        }
+
+        if (in_array($tableName, SystemCrudServices::NOT_CRUD_TABANAME)) {
+            return app('json')->fail('不能生成系统自带数据表');
+        }
+
         $routeName = 'crud/' . Str::snake($tableName);
         $routeName = 'crud/' . Str::snake($tableName);
 
 
         $make = $this->services->makeFile($tableName, $routeName, false, [
         $make = $this->services->makeFile($tableName, $routeName, false, [

+ 121 - 89
crmeb/app/services/system/SystemCrudServices.php

@@ -42,6 +42,18 @@ use Phinx\Db\Adapter\MysqlAdapter;
 class SystemCrudServices extends BaseServices
 class SystemCrudServices extends BaseServices
 {
 {
 
 
+    //不能生成的系统自带表
+    const NOT_CRUD_TABANAME = [
+        'system_config', 'system_attachment', 'system_attachment_category', 'system_config_tab',
+        'system_admin', 'eb_system_city', 'system_log', 'system_menus', 'system_notice',
+        'system_notice_admin', 'system_notification', 'system_role', 'system_route',
+        'system_route_cate', 'system_storage', 'system_timer', 'system_user_level',
+        'system_crud', 'wechat_key', 'user_label_relation', 'user_brokerage_frozen',
+        'user_brokerage', 'store_product_cate', 'store_bargain_user_help', 'shipping_templates_region',
+        'shipping_templates_no_delivery', 'shipping_templates_free', 'other_order_status', 'lang_code',
+        'lang_country', 'app_version',
+    ];
+
     /**
     /**
      * SystemCrudServices constructor.
      * SystemCrudServices constructor.
      * @param SystemCrudDao $dao
      * @param SystemCrudDao $dao
@@ -151,10 +163,14 @@ class SystemCrudServices extends BaseServices
         $filePath = $data['filePath'];
         $filePath = $data['filePath'];
 
 
         //创建数据库
         //创建数据库
-        if ($tableField) {
+        if ($tableField && !$data['isTable']) {
             $this->makeDatebase($tableName, $tableComment, $tableField);
             $this->makeDatebase($tableName, $tableComment, $tableField);
         }
         }
 
 
+        if (in_array($tableName, self::NOT_CRUD_TABANAME)) {
+            throw new ValidateException('不能生成系统自带数据表');
+        }
+
         //读取表结构
         //读取表结构
         $column = $this->getColumnNamesList($tableName);
         $column = $this->getColumnNamesList($tableName);
         if (!$column) {
         if (!$column) {
@@ -164,16 +180,19 @@ class SystemCrudServices extends BaseServices
         $routeName = 'crud/' . Str::snake($tableName);
         $routeName = 'crud/' . Str::snake($tableName);
         $uniqueAuth = $routeName . '-index-list';
         $uniqueAuth = $routeName . '-index-list';
 
 
-        $make = $this->makeFile($tableName, $routeName, true, $data, $filePath);
-        $makePath = [];
-        foreach ($make as $key => $item) {
-            $makePath[$key] = $item['path'];
+        foreach ($filePath as $k => $i) {
+            if (in_array($k, ['pages', 'router', 'api'])) {
+                $filePath[$k] = Make::adminTemplatePath() . $i;
+            } else {
+                $filePath[$k] = app()->getRootPath() . $i;
+            }
         }
         }
+
         //创建菜单
         //创建菜单
         if (!$data['menuName']) {
         if (!$data['menuName']) {
             $data['menuName'] = $tableName;
             $data['menuName'] = $tableName;
         }
         }
-        $data = [
+        $dataMenu = [
             'pid' => $data['pid'],
             'pid' => $data['pid'],
             'menu_name' => $data['menuName'],
             'menu_name' => $data['menuName'],
             'menu_path' => '',
             'menu_path' => '',
@@ -183,81 +202,94 @@ class SystemCrudServices extends BaseServices
             'unique_auth' => $uniqueAuth,
             'unique_auth' => $uniqueAuth,
             'is_header' => $data['pid'] ? 0 : 1,
             'is_header' => $data['pid'] ? 0 : 1,
         ];
         ];
-        $menuInfo = app()->make(SystemMenusServices::class)->save($data);
-        //写入路由权限
-        $cateId = app()->make(SystemRouteServices::class)->topCateId('adminapi');
-        $ruleData = [
-            [
-                'path' => $routeName,
-                'method' => 'GET',
-                'name' => $data['menuName'] . '列表接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/create',
-                'method' => 'GET',
-                'name' => $data['menuName'] . '获取创建表单接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName,
-                'method' => 'POST',
-                'name' => $data['menuName'] . '保存数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>/edit',
-                'method' => 'GET',
-                'name' => $data['menuName'] . '获取修改表单接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>',
-                'method' => 'PUT',
-                'name' => $data['menuName'] . '修改数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>',
-                'method' => 'DELETE',
-                'name' => $data['menuName'] . '删除数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-        ];
-        app()->make(SystemRouteServices::class)->saveAll($ruleData);
-        //记录权限加入菜单表
-        $menuData = [];
-        foreach ($ruleData as $item) {
-            $menuData[] = [
-                'pid' => $menuInfo->id,
-                'method' => $item['method'],
-                'api_url' => $item['path'],
-                'name' => $item['name'],
-                'is_del' => 0,
+
+        $res = $this->transaction(function () use ($filePath, $tableName, $routeName, $data, $dataMenu) {
+            $menuInfo = app()->make(SystemMenusServices::class)->save($dataMenu);
+            //写入路由权限
+            $cateId = app()->make(SystemRouteServices::class)->topCateId('adminapi');
+            $ruleData = [
+                [
+                    'path' => $routeName,
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '列表接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/create',
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '获取创建表单接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName,
+                    'method' => 'POST',
+                    'name' => $data['menuName'] . '保存数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>/edit',
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '获取修改表单接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>',
+                    'method' => 'PUT',
+                    'name' => $data['menuName'] . '修改数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>',
+                    'method' => 'DELETE',
+                    'name' => $data['menuName'] . '删除数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
             ];
             ];
-        }
-        app()->make(SystemMenusServices::class)->saveAll($menuData);
-        //记录crud生成
-        $res = $this->dao->save([
-            'pid' => $data['pid'],
-            'name' => $data['menuName'],
-            'table_name' => $tableName,
-            'field' => json_encode($data),
-            'make_path' => json_encode($makePath),
-            'add_time' => time()
-        ]);
+            app()->make(SystemRouteServices::class)->saveAll($ruleData);
+            //记录权限加入菜单表
+            $menuData = [];
+            foreach ($ruleData as $item) {
+                $menuData[] = [
+                    'pid' => $menuInfo->id,
+                    'method' => $item['method'],
+                    'api_url' => $item['path'],
+                    'name' => $item['name'],
+                    'is_del' => 0,
+                ];
+            }
+            app()->make(SystemMenusServices::class)->saveAll($menuData);
+
+            $make = $this->makeFile($tableName, $routeName, true, $data, $filePath);
+            $makePath = [];
+            foreach ($make as $key => $item) {
+                $makePath[$key] = $item['path'];
+            }
+
+            //记录crud生成
+            $res = $this->dao->save([
+                'pid' => $data['pid'],
+                'name' => $data['menuName'],
+                'table_name' => $tableName,
+                'field' => json_encode($data),
+                'make_path' => json_encode($makePath),
+                'add_time' => time()
+            ]);
+
+            return $res;
+        });
+
         return $res->toArray();
         return $res->toArray();
     }
     }
 
 
@@ -323,41 +355,41 @@ class SystemCrudServices extends BaseServices
         $options['columnField'] = is_array($options['columnField']) ? $options['columnField'] : [];
         $options['columnField'] = is_array($options['columnField']) ? $options['columnField'] : [];
         //生成控制器
         //生成控制器
         $controller = app()->make(Controller::class);
         $controller = app()->make(Controller::class);
-        [$controllerContent, $controllerPath] = $controller->setFilePathName($filePath['controller'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$controllerContent, $controllerPath] = $controller->setFilePathName($filePath['controller'] ?? '')->isMake($isMake)->handle($tableName);
         //生成模型
         //生成模型
         $model = app()->make(Model::class);
         $model = app()->make(Model::class);
-        [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName);
         //生成dao
         //生成dao
         $dao = app()->make(Dao::class);
         $dao = app()->make(Dao::class);
-        [$daoContent, $daoPath] = $dao->setFilePathName($filePath['dao'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$daoContent, $daoPath] = $dao->setFilePathName($filePath['dao'] ?? '')->isMake($isMake)->handle($tableName);
         //生成路由
         //生成路由
         $route = app()->make(Route::class);
         $route = app()->make(Route::class);
-        [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, [
             'menus' => $options['menuName'],
             'menus' => $options['menuName'],
             'route' => $routeName
             'route' => $routeName
         ]);
         ]);
         //生成service
         //生成service
         $service = app()->make(Service::class);
         $service = app()->make(Service::class);
-        [$serviceContent, $servicePath] = $service->setFilePathName($filePath['service'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$serviceContent, $servicePath] = $service->setFilePathName($filePath['service'] ?? '')->isMake($isMake)->handle($tableName, [
             'field' => $options['fromField'],
             'field' => $options['fromField'],
         ]);
         ]);
         //生成验证器
         //生成验证器
         $validate = app()->make(Validate::class);
         $validate = app()->make(Validate::class);
-        [$validateContent, $validatePath] = $validate->setFilePathName($filePath['validate'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$validateContent, $validatePath] = $validate->setFilePathName($filePath['validate'] ?? '')->isMake($isMake)->handle($tableName);
         //生成前台路由
         //生成前台路由
         $viewRouter = app()->make(ViewRouter::class);
         $viewRouter = app()->make(ViewRouter::class);
-        [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, [
             'route' => $routeName,
             'route' => $routeName,
         ]);
         ]);
         //生成前台接口
         //生成前台接口
         $viewApi = app()->make(ViewApi::class);
         $viewApi = app()->make(ViewApi::class);
-        [$apiContent, $apiPath] = $viewApi->setFilePathName($filePath['api'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$apiContent, $apiPath] = $viewApi->setFilePathName($filePath['api'] ?? '')->isMake($isMake)->handle($tableName, [
             'route' => $routeName,
             'route' => $routeName,
         ]);
         ]);
 
 
         //生成前台页面
         //生成前台页面
         $viewPages = app()->make(ViewPages::class);
         $viewPages = app()->make(ViewPages::class);
-        [$pagesContent, $pagesPath] = $viewPages->setFilePathName($filePath['pages'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$pagesContent, $pagesPath] = $viewPages->setFilePathName($filePath['pages'] ?? '')->isMake($isMake)->handle($tableName, [
             'field' => $options['columnField']
             'field' => $options['columnField']
         ]);
         ]);
 
 

+ 3 - 2
crmeb/crmeb/services/crud/Controller.php

@@ -49,8 +49,9 @@ class Controller extends Make
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/3/13
      * @date 2023/3/13
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
+        $path = $options['path'] ?? '';
         $contentPhp = '';
         $contentPhp = '';
         $var = ["{%date%}"];
         $var = ["{%date%}"];
         $fieldPhp = [$this->value['date']];
         $fieldPhp = [$this->value['date']];
@@ -98,7 +99,7 @@ class Controller extends Make
 
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
     }
 
 
     /**
     /**

+ 9 - 8
crmeb/crmeb/services/crud/Make.php

@@ -219,9 +219,9 @@ abstract class Make
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/3/13
      * @date 2023/3/13
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
-
+        $path = $options['path'] ?? '';
         [$nameData, $content] = $this->getStubContent($name);
         [$nameData, $content] = $this->getStubContent($name);
 
 
         $this->value['name'] = $nameData;
         $this->value['name'] = $nameData;
@@ -236,7 +236,7 @@ abstract class Make
 
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
     }
 
 
     /**
     /**
@@ -343,14 +343,15 @@ abstract class Make
      */
      */
     protected function getfolderPath(string $path)
     protected function getfolderPath(string $path)
     {
     {
+        $path = $path ?: $this->filePathName;
+        $path = str_replace([$this->basePath, $this->baseDir], '', $path);
         $path = ltrim(str_replace('\\', '/', $path), '/');
         $path = ltrim(str_replace('\\', '/', $path), '/');
         $pathArr = explode('/', $path);
         $pathArr = explode('/', $path);
-        $count = count($pathArr);
-        $res = $pathArr[$count - 1] ?? null;
-        if ($pathArr && $res && $res == $this->name) {
-            return '';
+        array_pop($pathArr);
+        if ($pathArr) {
+            return '\\' . implode('\\', $pathArr);
         } else {
         } else {
-            return '\\' . $res;
+            return '';
         }
         }
     }
     }
 
 

+ 7 - 0
crmeb/crmeb/services/crud/Model.php

@@ -40,6 +40,13 @@ class Model extends Make
         return 'app' . DS . 'model' . DS . 'crud';
         return 'app' . DS . 'model' . DS . 'crud';
     }
     }
 
 
+    protected function getFilePathName(string $path, string $name): string
+    {
+        $path = ltrim(str_replace('\\', '/', $path), '/');
+
+        return $this->getBasePath($path) . $name . '.' . $this->fileMime;
+    }
+
     /**
     /**
      * 模板文件
      * 模板文件
      * @param string $type
      * @param string $type

+ 8 - 8
crmeb/crmeb/services/crud/Route.php

@@ -36,12 +36,12 @@ class Route extends Make
 
 
     /**
     /**
      * @param string $name
      * @param string $name
-     * @param string $path
      * @param array $options
      * @param array $options
      * @return mixed|void
      * @return mixed|void
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
+        $path = $options['path'] ?? '';
         $action = $options['action'] ?? [];
         $action = $options['action'] ?? [];
         $route = $options['route'] ?? '';
         $route = $options['route'] ?? '';
         $controller = $options['controller'] ?? '';
         $controller = $options['controller'] ?? '';
@@ -67,14 +67,14 @@ class Route extends Make
 
 
         $routeContent = "";
         $routeContent = "";
         foreach ($action as $item) {
         foreach ($action as $item) {
-            $routeContent .= $this->getStub($item) . "\r\n";
+            $routeContent .= file_get_contents($this->getStub($item)) . "\r\n";
         }
         }
 
 
         if ($var && $value) {
         if ($var && $value) {
             $routeContent = str_replace($var, $value, $routeContent);
             $routeContent = str_replace($var, $value, $routeContent);
         }
         }
 
 
-        $content = $this->getStub();
+        $content = file_get_contents($this->getStub());
 
 
         $this->value['content-php'] = $routeContent;
         $this->value['content-php'] = $routeContent;
 
 
@@ -82,16 +82,16 @@ class Route extends Make
 
 
         $filePath = $this->getFilePathName($path, strtolower($name));
         $filePath = $this->getFilePathName($path, strtolower($name));
 
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
     }
 
 
     /**
     /**
-     * @author 等风来
-     * @email 136327134@qq.com
-     * @date 2023/4/11
      * @param string $path
      * @param string $path
      * @param string $name
      * @param string $name
      * @return string
      * @return string
+     * @author 等风来
+     * @email 136327134@qq.com
+     * @date 2023/4/11
      */
      */
     protected function getFilePathName(string $path, string $name): string
     protected function getFilePathName(string $path, string $name): string
     {
     {

+ 3 - 3
crmeb/crmeb/services/crud/Service.php

@@ -36,15 +36,15 @@ class Service extends Make
 
 
     /**
     /**
      * @param string $name
      * @param string $name
-     * @param string $path
      * @param array $options
      * @param array $options
      * @return mixed|void
      * @return mixed|void
      * @author 等风来
      * @author 等风来
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/3/23
      * @date 2023/3/23
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
+        $path = $options['path'] ?? '';
 
 
         $this->value['use-php'] = $this->getDaoClassName($name, $path);
         $this->value['use-php'] = $this->getDaoClassName($name, $path);
 
 
@@ -92,7 +92,7 @@ class Service extends Make
 
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
     }
 
 
     /**
     /**

+ 3 - 4
crmeb/crmeb/services/crud/ViewApi.php

@@ -60,16 +60,15 @@ class ViewApi extends Make
 
 
     /**
     /**
      * @param string $name
      * @param string $name
-     * @param string $path
      * @param array $options
      * @param array $options
      * @return array
      * @return array
      * @author 等风来
      * @author 等风来
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/4/4
      * @date 2023/4/4
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
-
+        $path = $options['path'] ?? '';
         $action = $options['action'] ?? [];
         $action = $options['action'] ?? [];
         if (!$action) {
         if (!$action) {
             $action = ['index', 'create', 'save', 'edit', 'update'];
             $action = ['index', 'create', 'save', 'edit', 'update'];
@@ -103,7 +102,7 @@ class ViewApi extends Make
 
 
         $content = $this->makeFile($filePath, $contentStr);
         $content = $this->makeFile($filePath, $contentStr);
 
 
-        return [$content, $filePath];
+        return [$content, $this->filePathName ?: $filePath];
     }
     }
 
 
     /**
     /**

+ 3 - 3
crmeb/crmeb/services/crud/ViewPages.php

@@ -66,20 +66,20 @@ class ViewPages extends Make
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/4/3
      * @date 2023/4/3
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
         $field = $options['field'] ?? [];
         $field = $options['field'] ?? [];
 
 
         $columnStr = [];
         $columnStr = [];
         foreach ($field as $item) {
         foreach ($field as $item) {
-            $columnStr[] = "{\n\"title:\"{$item['name']},\n\"key:\"{$item['field']}\n}";
+            $columnStr[] = $this->tab() . "{\ntitle:\"{$item['name']}\",\nkey:\"{$item['field']}\"\n}";
         }
         }
         $this->value['auth'] = Str::snake($name);
         $this->value['auth'] = Str::snake($name);
         $this->value['content-vue'] = "\n" . implode(',', $columnStr);
         $this->value['content-vue'] = "\n" . implode(',', $columnStr);
         $this->value['pathApiJs'] = $options['pathApiJs'] ?? '';
         $this->value['pathApiJs'] = $options['pathApiJs'] ?? '';
         $this->value['nameCamel'] = Str::snake($name, '-');
         $this->value['nameCamel'] = Str::snake($name, '-');
 
 
-        return parent::handle($name, $path, $options);
+        return parent::handle($name, $options);
     }
     }
 
 
     /**
     /**

+ 2 - 1
crmeb/crmeb/services/crud/ViewRouter.php

@@ -66,8 +66,9 @@ class ViewRouter extends Make
      * @email 136327134@qq.com
      * @email 136327134@qq.com
      * @date 2023/4/4
      * @date 2023/4/4
      */
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
     {
+        $path = $options['path'] ?? '';
         [$nameData, $content] = $this->getStubContent($name);
         [$nameData, $content] = $this->getStubContent($name);
 
 
         $menus = $options['menus'] ?? $name;
         $menus = $options['menus'] ?? $name;

+ 2 - 2
crmeb/crmeb/services/crud/stubs/controller/CrudController.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  * @date {%time%}
  */
  */
 
 
-namespace app\adminapi\controller\v1{%path%};
+namespace app\adminapi\controller\crud{%path%};
 
 
 use app\adminapi\controller\AuthController;
 use app\adminapi\controller\AuthController;
 use think\facade\App;
 use think\facade\App;
@@ -24,7 +24,7 @@ use think\facade\App;
 /**
 /**
  * Class {%nameCamel%}
  * Class {%nameCamel%}
  * @date {%date%}
  * @date {%date%}
- * @package app\adminapi\controller\v1{%path%}
+ * @package app\adminapi\controller\crud{%path%}
  */
  */
 class {%nameCamel%} extends AuthController
 class {%nameCamel%} extends AuthController
 {
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  * @date {%time%}
  */
  */
 
 
-namespace app\dao{%path%};
+namespace app\dao\crub{%path%};
 
 
 
 
 use app\dao\BaseDao;
 use app\dao\BaseDao;
@@ -24,7 +24,7 @@ use app\dao\BaseDao;
 /**
 /**
  * Class {%nameCamel%}Dao
  * Class {%nameCamel%}Dao
  * @date {%date%}
  * @date {%date%}
- * @package app\dao{%path%}
+ * @package app\dao\crub{%path%}
  */
  */
 class {%nameCamel%}Dao extends BaseDao
 class {%nameCamel%}Dao extends BaseDao
 {
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/model/CrudModel.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  * @date {%time%}
  */
  */
 
 
-namespace app\model{%path%};
+namespace app\model\crud{%path%};
 
 
 
 
 use crmeb\basic\BaseModel;
 use crmeb\basic\BaseModel;
@@ -24,7 +24,7 @@ use crmeb\basic\BaseModel;
 /**
 /**
  * Class {%nameCamel%}
  * Class {%nameCamel%}
  * @date {%date%}
  * @date {%date%}
- * @package app\model{%path%}
+ * @package app\model\crud{%path%}
  */
  */
 class {%nameCamel%} extends BaseModel
 class {%nameCamel%} extends BaseModel
 {
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/service/CrudService.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  * @date {%time%}
  */
  */
 
 
-namespace app\services{%path%};
+namespace app\services\crub{%path%};
 
 
 use app\services\BaseServices;
 use app\services\BaseServices;
 use think\exception\ValidateException;
 use think\exception\ValidateException;
@@ -25,7 +25,7 @@ use think\exception\ValidateException;
 /**
 /**
  * Class CrudService
  * Class CrudService
  * @date {%date%}
  * @date {%date%}
- * @package app\services{%path%}
+ * @package app\services\crub{%path%}
  */
  */
 class {%nameCamel%}Service extends BaseServices
 class {%nameCamel%}Service extends BaseServices
 {
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  * @date {%time%}
  */
  */
 
 
-namespace app\adminapi\validate{%path%};
+namespace app\adminapi\validate\crub{%path%};
 
 
 
 
 use think\Validate;
 use think\Validate;
@@ -24,7 +24,7 @@ use think\Validate;
 /**
 /**
  * Class CrudValidate
  * Class CrudValidate
  * @date {%date%}
  * @date {%date%}
- * @package app\adminapi\validate{%path%}
+ * @package app\adminapi\validate\crub{%path%}
  */
  */
 class {%nameCamel%}Validate extends Validate
 class {%nameCamel%}Validate extends Validate
 {
 {

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 24359 - 8
crmeb/public/install/crmeb.sql