瀏覽代碼

namerule配置存在判断修改

kely 11 月之前
父節點
當前提交
11387b6899
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      app/Http/Controllers/API/CustomFieldController.php

+ 2 - 1
app/Http/Controllers/API/CustomFieldController.php

@@ -77,7 +77,8 @@ class CustomFieldController extends Controller
         $nameRuleGroup = NamingRule::query()->where('id',$nameGroupId)->get();
         $allGroups=config("custom-field.groups");
         if(!empty($nameRuleGroup)){
-            if(!in_array($allGroups,$nameRuleGroup->pluck('id')->toArray())){
+            //array_intersect 函数,它返回两个数组的交集
+            if(empty(array_intersect($allGroups,$nameRuleGroup->pluck('id')->toArray()))){
                 throw new \Exception("Please contact the administrator to add the namerule configuration.");
             }
         }