|
@@ -3,6 +3,7 @@ namespace app\workerapi\lists;
|
|
|
|
|
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
|
|
+use app\common\model\master_worker\MasterWorker;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* GoodsCategory列表
|
|
* GoodsCategory列表
|
|
@@ -26,7 +27,14 @@ class GoodsCategoryLists extends BaseWorkerDataLists implements ListsSearchInter
|
|
|
|
|
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ public function queryWhere(){
|
|
|
|
|
+ $where = [];
|
|
|
|
|
+ if(!empty($this->userId)){
|
|
|
|
|
+ $ids = explode(',', MasterWorker::where('id', $this->userId)->value('category_ids'));
|
|
|
|
|
+ $ids && $where[] = ['id', 'in', $ids];
|
|
|
|
|
+ }
|
|
|
|
|
+ return $where;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @notes 获取列表
|
|
* @notes 获取列表
|
|
@@ -40,6 +48,7 @@ class GoodsCategoryLists extends BaseWorkerDataLists implements ListsSearchInter
|
|
|
public function lists(): array
|
|
public function lists(): array
|
|
|
{
|
|
{
|
|
|
$lists = GoodsCategory::where($this->searchWhere)
|
|
$lists = GoodsCategory::where($this->searchWhere)
|
|
|
|
|
+ //->where($this->queryWhere())
|
|
|
->field(['id', 'pid' ,'picture', 'name'])
|
|
->field(['id', 'pid' ,'picture', 'name'])
|
|
|
->order(['weigh' => 'desc'])
|
|
->order(['weigh' => 'desc'])
|
|
|
->select()
|
|
->select()
|