shish 2 tahun lalu
induk
melakukan
69e659dc08
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  1. 10 0
      app-ghs/controllers/CpClassController.php

+ 10 - 0
app-ghs/controllers/CpClassController.php

@@ -94,6 +94,16 @@ class CpClassController extends BaseController
             util::fail('不是你的分类哦');
         }
         $name = $get['name'] ?? '';
+
+        $list = CpClassClass::getAllByCondition(['mainId' => $this->mainId, 'delStatus' => 0], null, '*', null, true);
+        if (!empty($list)) {
+            foreach ($list as $info) {
+                if ($info->id != $id && $info->name == $name) {
+                    util::fail('分类名已经存在');
+                }
+            }
+        }
+
         $inTurn = $get['inTurn'] ?? 100;
         $print = $get['print'] ?? 0;
         $hide = $get['hide'] ?? 0;