|
|
@@ -51,15 +51,20 @@ class CategoryController extends BaseController
|
|
|
util::success(['list' => []]);
|
|
|
}
|
|
|
|
|
|
- $categoryId = Yii::$app->request->get('categoryId');
|
|
|
- if (empty($categoryId)) {
|
|
|
- util::fail('没有找到分类');
|
|
|
- }
|
|
|
$where = [];
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $categoryId = isset($get['categoryId']) ? intval($get['categoryId']) : 0;
|
|
|
+ if ($categoryId != 0) {
|
|
|
+ $where['cId'] = $categoryId;
|
|
|
+ }
|
|
|
$where['mainId'] = $this->mainId;
|
|
|
- $where['cId'] = $categoryId;
|
|
|
- $where['delStatus'] = 0;
|
|
|
- $where['status'] = 1;
|
|
|
+ $where['delStatus'] = 0;//只获取非删除状态
|
|
|
+ $where['status'] = 1;//上下架状态为1(正常)
|
|
|
+
|
|
|
+ $searchText = $get['searchText'] ?? '';
|
|
|
+ if (!empty($searchText)) {
|
|
|
+ $where['name'] = ['like', $searchText];
|
|
|
+ }
|
|
|
|
|
|
$shop = $this->shop;
|
|
|
$stockModel = $shop->stockModel ?? 0;
|