소스 검색

清洗服务费结算

whitefang 1 년 전
부모
커밋
a2d49ebf54
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      app/workerapi/lists/GoodsCategoryLists.php

+ 6 - 3
app/workerapi/lists/GoodsCategoryLists.php

@@ -31,7 +31,10 @@ class GoodsCategoryLists extends BaseWorkerDataLists implements ListsSearchInter
         $where = [];
         if(!empty($this->userId)){
             $ids = explode(',', MasterWorker::where('id', $this->userId)->value('category_ids'));
-            $ids && $where[] = ['id', 'in', $ids];
+            if(!empty($ids)){
+                $category_types = GoodsCategory::where('id', 'in', $ids)->group('category_type')->column('category_type');
+                $category_types && $where['category_type'] = ['in', $category_types];
+            }
         }
         return $where;
     }
@@ -48,7 +51,7 @@ class GoodsCategoryLists extends BaseWorkerDataLists implements ListsSearchInter
     public function lists(): array
     {
         $lists = GoodsCategory::where($this->searchWhere)
-            //->where($this->queryWhere())
+            ->where($this->queryWhere())
             ->field(['id', 'pid' ,'picture', 'name'])
             ->order(['weigh' => 'desc'])
             ->select()
@@ -66,7 +69,7 @@ class GoodsCategoryLists extends BaseWorkerDataLists implements ListsSearchInter
      */
     public function count(): int
     {
-        return GoodsCategory::where($this->searchWhere)->count();
+        return GoodsCategory::where($this->searchWhere)->where($this->queryWhere())->count();
     }
 
 }