From 82676ead469dcc6795ba5b138dd925f82f4f5ca9 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Wed, 12 Apr 2023 15:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9crud=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/setting/SystemCrud.php | 13 ++ .../services/system/SystemCrudServices.php | 210 ++++++++++-------- crmeb/crmeb/services/crud/Controller.php | 5 +- crmeb/crmeb/services/crud/Make.php | 17 +- crmeb/crmeb/services/crud/Model.php | 7 + crmeb/crmeb/services/crud/Route.php | 16 +- crmeb/crmeb/services/crud/Service.php | 6 +- crmeb/crmeb/services/crud/ViewApi.php | 7 +- crmeb/crmeb/services/crud/ViewPages.php | 6 +- crmeb/crmeb/services/crud/ViewRouter.php | 3 +- .../crud/stubs/controller/CrudController.stub | 4 +- .../services/crud/stubs/dao/CrudDao.stub | 4 +- .../services/crud/stubs/model/CrudModel.stub | 4 +- .../crud/stubs/service/CrudService.stub | 4 +- .../crud/stubs/validate/crudValidate.stub | 4 +- 15 files changed, 182 insertions(+), 128 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php index 219e1f959..1a2372000 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php @@ -72,8 +72,13 @@ class SystemCrud extends AuthController ['fromField', []], ['columnField', []], ['filePath', []], + ['isTable', 0], ]); + if (!$data['tableName']) { + return app('json')->fail('缺少表名'); + } + $this->services->createCrud($data); return app('json')->success('创建成功'); @@ -96,6 +101,14 @@ class SystemCrud extends AuthController ['columnField', []], ], true); + if (!$tableName) { + return app('json')->fail('缺少表名'); + } + + if (in_array($tableName, SystemCrudServices::NOT_CRUD_TABANAME)) { + return app('json')->fail('不能生成系统自带数据表'); + } + $routeName = 'crud/' . Str::snake($tableName); $make = $this->services->makeFile($tableName, $routeName, false, [ diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php index e8efc38bc..72cc4097c 100644 --- a/crmeb/app/services/system/SystemCrudServices.php +++ b/crmeb/app/services/system/SystemCrudServices.php @@ -42,6 +42,18 @@ use Phinx\Db\Adapter\MysqlAdapter; 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. * @param SystemCrudDao $dao @@ -151,10 +163,14 @@ class SystemCrudServices extends BaseServices $filePath = $data['filePath']; //创建数据库 - if ($tableField) { + if ($tableField && !$data['isTable']) { $this->makeDatebase($tableName, $tableComment, $tableField); } + if (in_array($tableName, self::NOT_CRUD_TABANAME)) { + throw new ValidateException('不能生成系统自带数据表'); + } + //读取表结构 $column = $this->getColumnNamesList($tableName); if (!$column) { @@ -164,16 +180,19 @@ class SystemCrudServices extends BaseServices $routeName = 'crud/' . Str::snake($tableName); $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']) { $data['menuName'] = $tableName; } - $data = [ + $dataMenu = [ 'pid' => $data['pid'], 'menu_name' => $data['menuName'], 'menu_path' => '', @@ -183,81 +202,94 @@ class SystemCrudServices extends BaseServices 'unique_auth' => $uniqueAuth, '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 . '//edit', - 'method' => 'GET', - 'name' => $data['menuName'] . '获取修改表单接口', - 'app_name' => 'adminapi', - 'cate_id' => $cateId, - 'add_time' => date('Y-m-d H:i:s') - ], - [ - 'path' => $routeName . '/', - 'method' => 'PUT', - 'name' => $data['menuName'] . '修改数据接口', - 'app_name' => 'adminapi', - 'cate_id' => $cateId, - 'add_time' => date('Y-m-d H:i:s') - ], - [ - 'path' => $routeName . '/', - '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 . '//edit', + 'method' => 'GET', + 'name' => $data['menuName'] . '获取修改表单接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '/', + 'method' => 'PUT', + 'name' => $data['menuName'] . '修改数据接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '/', + '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(); } @@ -323,41 +355,41 @@ class SystemCrudServices extends BaseServices $options['columnField'] = is_array($options['columnField']) ? $options['columnField'] : []; //生成控制器 $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); - [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName, '/'); + [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName); //生成dao $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); - [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, '/', [ + [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, [ 'menus' => $options['menuName'], 'route' => $routeName ]); //生成service $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'], ]); //生成验证器 $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); - [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, '/', [ + [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, [ 'route' => $routeName, ]); //生成前台接口 $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, ]); //生成前台页面 $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'] ]); diff --git a/crmeb/crmeb/services/crud/Controller.php b/crmeb/crmeb/services/crud/Controller.php index ce3e19a51..68926aab1 100644 --- a/crmeb/crmeb/services/crud/Controller.php +++ b/crmeb/crmeb/services/crud/Controller.php @@ -49,8 +49,9 @@ class Controller extends Make * @email 136327134@qq.com * @date 2023/3/13 */ - public function handle(string $name, string $path, array $options = []) + public function handle(string $name, array $options = []) { + $path = $options['path'] ?? ''; $contentPhp = ''; $var = ["{%date%}"]; $fieldPhp = [$this->value['date']]; @@ -98,7 +99,7 @@ class Controller extends Make $filePath = $this->getFilePathName($path, $this->value['nameCamel']); - return [$this->makeFile($filePath, $contentStr), $filePath]; + return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath]; } /** diff --git a/crmeb/crmeb/services/crud/Make.php b/crmeb/crmeb/services/crud/Make.php index a69813615..77716f0cb 100644 --- a/crmeb/crmeb/services/crud/Make.php +++ b/crmeb/crmeb/services/crud/Make.php @@ -219,9 +219,9 @@ abstract class Make * @email 136327134@qq.com * @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); $this->value['name'] = $nameData; @@ -236,7 +236,7 @@ abstract class Make $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) { + $path = $path ?: $this->filePathName; + $path = str_replace([$this->basePath, $this->baseDir], '', $path); $path = ltrim(str_replace('\\', '/', $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 { - return '\\' . $res; + return ''; } } diff --git a/crmeb/crmeb/services/crud/Model.php b/crmeb/crmeb/services/crud/Model.php index 4e427ec1a..8ad46680d 100644 --- a/crmeb/crmeb/services/crud/Model.php +++ b/crmeb/crmeb/services/crud/Model.php @@ -40,6 +40,13 @@ class Model extends Make 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 diff --git a/crmeb/crmeb/services/crud/Route.php b/crmeb/crmeb/services/crud/Route.php index e4ce0f438..9c75a930f 100644 --- a/crmeb/crmeb/services/crud/Route.php +++ b/crmeb/crmeb/services/crud/Route.php @@ -36,12 +36,12 @@ class Route extends Make /** * @param string $name - * @param string $path * @param array $options * @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'] ?? []; $route = $options['route'] ?? ''; $controller = $options['controller'] ?? ''; @@ -67,14 +67,14 @@ class Route extends Make $routeContent = ""; foreach ($action as $item) { - $routeContent .= $this->getStub($item) . "\r\n"; + $routeContent .= file_get_contents($this->getStub($item)) . "\r\n"; } if ($var && $value) { $routeContent = str_replace($var, $value, $routeContent); } - $content = $this->getStub(); + $content = file_get_contents($this->getStub()); $this->value['content-php'] = $routeContent; @@ -82,16 +82,16 @@ class Route extends Make $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 $name * @return string + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 */ protected function getFilePathName(string $path, string $name): string { diff --git a/crmeb/crmeb/services/crud/Service.php b/crmeb/crmeb/services/crud/Service.php index de1af91c8..b18d95c9a 100644 --- a/crmeb/crmeb/services/crud/Service.php +++ b/crmeb/crmeb/services/crud/Service.php @@ -36,15 +36,15 @@ class Service extends Make /** * @param string $name - * @param string $path * @param array $options * @return mixed|void * @author 等风来 * @email 136327134@qq.com * @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); @@ -92,7 +92,7 @@ class Service extends Make $filePath = $this->getFilePathName($path, $this->value['nameCamel']); - return [$this->makeFile($filePath, $contentStr), $filePath]; + return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath]; } /** diff --git a/crmeb/crmeb/services/crud/ViewApi.php b/crmeb/crmeb/services/crud/ViewApi.php index 7ee1c914d..ba535d0d8 100644 --- a/crmeb/crmeb/services/crud/ViewApi.php +++ b/crmeb/crmeb/services/crud/ViewApi.php @@ -60,16 +60,15 @@ class ViewApi extends Make /** * @param string $name - * @param string $path * @param array $options * @return array * @author 等风来 * @email 136327134@qq.com * @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'] ?? []; if (!$action) { $action = ['index', 'create', 'save', 'edit', 'update']; @@ -103,7 +102,7 @@ class ViewApi extends Make $content = $this->makeFile($filePath, $contentStr); - return [$content, $filePath]; + return [$content, $this->filePathName ?: $filePath]; } /** diff --git a/crmeb/crmeb/services/crud/ViewPages.php b/crmeb/crmeb/services/crud/ViewPages.php index 8869e7148..d60b092ad 100644 --- a/crmeb/crmeb/services/crud/ViewPages.php +++ b/crmeb/crmeb/services/crud/ViewPages.php @@ -66,20 +66,20 @@ class ViewPages extends Make * @email 136327134@qq.com * @date 2023/4/3 */ - public function handle(string $name, string $path, array $options = []) + public function handle(string $name, array $options = []) { $field = $options['field'] ?? []; $columnStr = []; 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['content-vue'] = "\n" . implode(',', $columnStr); $this->value['pathApiJs'] = $options['pathApiJs'] ?? ''; $this->value['nameCamel'] = Str::snake($name, '-'); - return parent::handle($name, $path, $options); + return parent::handle($name, $options); } /** diff --git a/crmeb/crmeb/services/crud/ViewRouter.php b/crmeb/crmeb/services/crud/ViewRouter.php index e7ab628f7..bc8aae408 100644 --- a/crmeb/crmeb/services/crud/ViewRouter.php +++ b/crmeb/crmeb/services/crud/ViewRouter.php @@ -66,8 +66,9 @@ class ViewRouter extends Make * @email 136327134@qq.com * @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); $menus = $options['menus'] ?? $name; diff --git a/crmeb/crmeb/services/crud/stubs/controller/CrudController.stub b/crmeb/crmeb/services/crud/stubs/controller/CrudController.stub index 7da581dbf..8bebff6ba 100644 --- a/crmeb/crmeb/services/crud/stubs/controller/CrudController.stub +++ b/crmeb/crmeb/services/crud/stubs/controller/CrudController.stub @@ -16,7 +16,7 @@ * @date {%time%} */ -namespace app\adminapi\controller\v1{%path%}; +namespace app\adminapi\controller\crud{%path%}; use app\adminapi\controller\AuthController; use think\facade\App; @@ -24,7 +24,7 @@ use think\facade\App; /** * Class {%nameCamel%} * @date {%date%} - * @package app\adminapi\controller\v1{%path%} + * @package app\adminapi\controller\crud{%path%} */ class {%nameCamel%} extends AuthController { diff --git a/crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub b/crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub index e1968469e..eed5b1b2e 100644 --- a/crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub +++ b/crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub @@ -16,7 +16,7 @@ * @date {%time%} */ -namespace app\dao{%path%}; +namespace app\dao\crub{%path%}; use app\dao\BaseDao; @@ -24,7 +24,7 @@ use app\dao\BaseDao; /** * Class {%nameCamel%}Dao * @date {%date%} - * @package app\dao{%path%} + * @package app\dao\crub{%path%} */ class {%nameCamel%}Dao extends BaseDao { diff --git a/crmeb/crmeb/services/crud/stubs/model/CrudModel.stub b/crmeb/crmeb/services/crud/stubs/model/CrudModel.stub index e7947bf36..d6e871d99 100644 --- a/crmeb/crmeb/services/crud/stubs/model/CrudModel.stub +++ b/crmeb/crmeb/services/crud/stubs/model/CrudModel.stub @@ -16,7 +16,7 @@ * @date {%time%} */ -namespace app\model{%path%}; +namespace app\model\crud{%path%}; use crmeb\basic\BaseModel; @@ -24,7 +24,7 @@ use crmeb\basic\BaseModel; /** * Class {%nameCamel%} * @date {%date%} - * @package app\model{%path%} + * @package app\model\crud{%path%} */ class {%nameCamel%} extends BaseModel { diff --git a/crmeb/crmeb/services/crud/stubs/service/CrudService.stub b/crmeb/crmeb/services/crud/stubs/service/CrudService.stub index fc929e8d9..8eb66a2d9 100644 --- a/crmeb/crmeb/services/crud/stubs/service/CrudService.stub +++ b/crmeb/crmeb/services/crud/stubs/service/CrudService.stub @@ -16,7 +16,7 @@ * @date {%time%} */ -namespace app\services{%path%}; +namespace app\services\crub{%path%}; use app\services\BaseServices; use think\exception\ValidateException; @@ -25,7 +25,7 @@ use think\exception\ValidateException; /** * Class CrudService * @date {%date%} - * @package app\services{%path%} + * @package app\services\crub{%path%} */ class {%nameCamel%}Service extends BaseServices { diff --git a/crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub b/crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub index 7df4bd47d..553e07b9c 100644 --- a/crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub +++ b/crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub @@ -16,7 +16,7 @@ * @date {%time%} */ -namespace app\adminapi\validate{%path%}; +namespace app\adminapi\validate\crub{%path%}; use think\Validate; @@ -24,7 +24,7 @@ use think\Validate; /** * Class CrudValidate * @date {%date%} - * @package app\adminapi\validate{%path%} + * @package app\adminapi\validate\crub{%path%} */ class {%nameCamel%}Validate extends Validate {