Quellcode durchsuchen

名称已经存在

shish vor 3 Jahren
Ursprung
Commit
b0a520805a
1 geänderte Dateien mit 11 neuen und 0 gelöschten Zeilen
  1. 11 0
      app-ghs/controllers/GhsController.php

+ 11 - 0
app-ghs/controllers/GhsController.php

@@ -28,6 +28,17 @@ class GhsController extends BaseController
         if (stringUtil::getWordNum($name) > 8) {
             util::fail('名称不能超过8个汉字');
         }
+
+        $hasGhsList = GhsClass::getAllByCondition(['ownShopId' => $this->shopId], null, '*', null, true);
+        if (!empty($hasGhsList)) {
+            foreach ($hasGhsList as $hasGhs) {
+                $hasGhsName = $hasGhs->name ?? '';
+                if ($hasGhsName == $name) {
+                    util::fail('名称已经存在了');
+                }
+            }
+        }
+
 //        $has = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => SjClass::STYLE_KM_SUPPLIER]);
 //        if (!empty($has)) {
 //