shish пре 3 година
родитељ
комит
cebf35c983

+ 1 - 1
app-ghs/controllers/AuthController.php

@@ -65,7 +65,7 @@ class AuthController extends PublicController
         }
         $admin = AdminClass::getByCondition(['mobile' => $phoneNumber]);
         if (empty($admin)) {
-            util::fail('请注册或联系批发店添加');
+            util::fail('请先注册或请店长添加自己为员工');
         }
         $currentShopId = $admin['currentGhsShopId'] ?? 0;
         $openShop = $admin['openGhsShop'] ?? 1;

+ 7 - 4
app-hd/controllers/CategoryController.php

@@ -84,12 +84,11 @@ class CategoryController extends BaseController
     {
         $get = Yii::$app->request->get();
         $catId = $get['catId'] ?? 0;
-        if (empty($catId)) {
-            util::fail('没有分类');
-        }
         $where = [];
         $where['mainId'] = $this->mainId;
-        $where['cId'] = $catId;
+        if (!empty($catId)) {
+            $where['cId'] = $catId;
+        }
         $flower = $get['flower'] ?? '';
         if (is_numeric($flower)) {
             $where['flower'] = $flower;
@@ -103,6 +102,10 @@ class CategoryController extends BaseController
         if (!empty($flowerNum)) {
             $where['flowerNum'] = $flowerNum;
         }
+        $searchText = $get['searchText'] ?? '';
+        if (!empty($searchText)) {
+            $where['name'] = ['like', $searchText];
+        }
         $data = GoodsCategoryService::getGoodsList($where);
         util::success($data);
     }

+ 9 - 1
app-hd/controllers/KindController.php

@@ -14,7 +14,15 @@ class KindController extends BaseController
     //品类列表
     public function actionList()
     {
-        $list = KindClass::getKindList($this->mainId);
+        $get = Yii::$app->request->get();
+        $mainId = $this->mainId ?? 0;
+        $where = ['mainId' => $mainId, 'delStatus' => 0];
+        $name = isset($get['name']) ? $get['name'] : '';
+        $name = trim($name);
+        if (!empty($name)) {
+            $where['name'] = ['like', $name];
+        }
+        $list = KindClass::getKindList($where);
         util::success($list);
     }
 

+ 6 - 6
biz-hd/goods/classes/KindClass.php

@@ -30,14 +30,14 @@ class KindClass extends BaseClass
         self::add($post, true);
     }
 
-    public static function getKindList($mainId)
+    public static function getKindList($where)
     {
-        $where = ['mainId' => $mainId, 'delStatus' => 0];
-        $kindList = self::getAllByCondition($where, 'flower DESC,inTurn DESC', '*');
-        if (empty($kindList)) {
-            return $kindList;
+        $data = self::getList('*', $where);
+        $list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
+        if (empty($list)) {
+            return $data;
         }
-        return $kindList;
+        return $data;
     }
 
 }