Răsfoiți Sursa

添加分类

shish 4 ani în urmă
părinte
comite
c7e83708bc

+ 1 - 0
app-hd/controllers/CategoryController.php

@@ -34,6 +34,7 @@ class CategoryController extends BaseController
     {
         $post = Yii::$app->request->post();
         $post['sjId'] = $this->sjId;
+        $post['mainId'] = $this->mainId;
         $cat = CategoryService::addCategory($post);
         util::success(['id' => $cat['id']]);
     }

+ 2 - 2
biz-hd/goods/classes/CategoryClass.php

@@ -50,8 +50,8 @@ class CategoryClass extends BaseClass
     public static function addCategory($data)
     {
         $categoryName = $data['categoryName'];
-        $sjId = $data['sjId'];
-        $exists = self::getByCondition(['sjId' => $sjId, 'delStatus' => 0, 'categoryName' => $categoryName]);
+        $mainId = $data['mainId'] ?? 0;
+        $exists = self::getByCondition(['mainId' => $mainId, 'delStatus' => 0, 'categoryName' => $categoryName]);
         if (!empty($exists)) {
             util::fail('分类名称已经存在');
         }