From 4bc4398398fc5463cdfdd4e61e2b218b42e94f46 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Mon, 24 Apr 2023 17:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=BE=91=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/v1/setting/SystemCrud.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php index 5ff9b115f..62b2a24f9 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php @@ -326,19 +326,23 @@ class SystemCrud extends AuthController if (!$crudInfo) { return app('json')->fail('修改的CRUD文件不存在'); } - $makePath = []; + + $makeFilepath = ''; foreach ($crudInfo->make_path as $key => $item) { if (in_array($key, ['pages', 'router', 'api'])) { $item = Make::adminTemplatePath() . $item; } else { $item = app()->getRootPath() . $item; } - $makePath[$key] = $item; + if ($filepath == $item) { + $makeFilepath = $item; + break; + } } - if (!in_array($filepath, $crudInfo->make_path)) { + if (!$makeFilepath || !in_array($filepath, $crudInfo->make_path)) { return app('json')->fail('您没有权限修改此文件'); } - $res = $service->savefile($filepath, $comment); + $res = $service->savefile($makeFilepath, $comment); if ($res) { return app('json')->success(100000); } else {