| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace mall\controllers;
- use bizMall\goods\services\CategoryService;
- use bizMall\goods\services\GoodsCategoryService;
- use Yii;
- use yii\web\Controller;
- use common\components\util;
- class CategoryController extends BaseController
- {
- //获取分类 ssh 2019.12.2
- public function actionList()
- {
- $return = CategoryService::getEnableList($this->mainId);
- util::success($return);
- }
- //取分类下商品 ssh 2019.12.2
- public function actionGoodsList()
- {
- $categoryId = Yii::$app->request->get('categoryId');
- if (empty($categoryId)) {
- util::fail('没有找到分类');
- }
- $where = [];
- $where['mainId'] = $this->mainId;
- $where['cId'] = $categoryId;
- $where['delStatus'] = 0;
- $where['status'] = 1;
- $shop = $this->shop;
- $stockModel = $shop->stockModel ?? 0;
- if ($stockModel == 1) {
- //管到支的,查看所有上架并且花材数量设置好的商品
- $where['setItemNum'] = 1;
- }
- $data = GoodsCategoryService::getGoodsList($where);
- util::success($data);
- }
- }
|