|
|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
namespace app\api\lists;
|
|
|
|
|
|
+use app\api\logic\GoodsLogic;
|
|
|
use app\common\model\goods_category\GoodsCategory;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
|
|
|
@@ -26,7 +27,15 @@ class GoodsCategoryLists extends BaseApiDataLists implements ListsSearchInterfac
|
|
|
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
+ public function queryWhere()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ if (isset($this->params['platform_appid']) && !empty($this->params['platform_appid'])) {
|
|
|
+ $ids = GoodsLogic::getPlatformCategoryIds($this->params['platform_appid']);
|
|
|
+ $where[] = ['id','in' ,$ids];
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @notes 获取列表
|
|
|
@@ -39,7 +48,7 @@ class GoodsCategoryLists extends BaseApiDataLists implements ListsSearchInterfac
|
|
|
*/
|
|
|
public function lists(): array
|
|
|
{
|
|
|
- $lists = GoodsCategory::where($this->searchWhere)->where('status',1)
|
|
|
+ $lists = GoodsCategory::where($this->searchWhere)->where($this->queryWhere())->where('status',1)
|
|
|
->field(['id', 'pid' ,'picture', 'name'])
|
|
|
->order(['weigh' => 'desc'])
|
|
|
->select()
|
|
|
@@ -57,7 +66,7 @@ class GoodsCategoryLists extends BaseApiDataLists implements ListsSearchInterfac
|
|
|
*/
|
|
|
public function count(): int
|
|
|
{
|
|
|
- return GoodsCategory::where($this->searchWhere)->count();
|
|
|
+ return GoodsCategory::where($this->searchWhere)->where($this->queryWhere())->count();
|
|
|
}
|
|
|
|
|
|
}
|