Преглед на файлове

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

From-wh преди 2 години
родител
ревизия
44ec10ca30
променени са 1 файла, в които са добавени 9 реда и са изтрити 4 реда
  1. 9 4
      crmeb/app/adminapi/controller/v1/setting/SystemCrud.php

+ 9 - 4
crmeb/app/adminapi/controller/v1/setting/SystemCrud.php

@@ -326,19 +326,24 @@ class SystemCrud extends AuthController
         if (!$crudInfo) {
             return app('json')->fail('修改的CRUD文件不存在');
         }
-        $makePath = [];
+
+        $makeFilepath = '';
         foreach ($crudInfo->make_path as $key => $item) {
+            $path = $item;
             if (in_array($key, ['pages', 'router', 'api'])) {
                 $item = Make::adminTemplatePath() . $item;
             } else {
                 $item = app()->getRootPath() . $item;
             }
-            $makePath[$key] = $item;
+            if ($filepath == $path) {
+                $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 {