|
|
@@ -120,6 +120,7 @@ class CategoryController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$catId = $get['catId'] ?? 0;
|
|
|
$where = [];
|
|
|
+ $goodsCond = [];
|
|
|
$where['mainId'] = $this->mainId;
|
|
|
if (!empty($catId)) {
|
|
|
$where['cId'] = $catId;
|
|
|
@@ -128,15 +129,35 @@ class CategoryController extends BaseController
|
|
|
if (is_numeric($flower)) {
|
|
|
$where['flower'] = $flower;
|
|
|
}
|
|
|
+ // flowerNum 是针对 xhGoods 表的条件查询
|
|
|
$flowerNum = $get['flowerNum'] ?? 0;
|
|
|
- if (!empty($flowerNum)) {
|
|
|
- $where['flowerNum'] = $flowerNum;
|
|
|
+ if ($flowerNum > 0) {
|
|
|
+ $goodsCond['flowerNum'] = $flowerNum;
|
|
|
}
|
|
|
+ if (isset($get['lookPrice'])) { // 1:有价格 2:无价格 -- 根据前端的传值
|
|
|
+ $lookPrice = intval($get['lookPrice']);
|
|
|
+ if ($lookPrice == 1) {
|
|
|
+ $goodsCond['priceType'] = 1;
|
|
|
+ }
|
|
|
+ if ($lookPrice == 2) {
|
|
|
+ $goodsCond['priceType'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isset($get['lookStock'])) { // 1:有库存 2:无库存 -- 根据前端的传值
|
|
|
+ $lookStock = intval($get['lookStock']);
|
|
|
+ if ($lookStock == 1) {
|
|
|
+ $goodsCond['stock>'] = 0;
|
|
|
+ }
|
|
|
+ if ($lookStock == 2) {
|
|
|
+ $goodsCond['stock'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$searchText = $get['searchText'] ?? '';
|
|
|
if (!empty($searchText)) {
|
|
|
$where['name'] = ['like', $searchText];
|
|
|
}
|
|
|
- $data = GoodsCategoryService::getGoodsList($where);
|
|
|
+ $data = GoodsCategoryService::getGoodsList($where, $goodsCond);
|
|
|
util::success($data);
|
|
|
}
|
|
|
|