|
|
@@ -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();
|
|
|
}
|
|
|
|
|
|
}
|