| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace mall\controllers;
- use bizMall\goods\services\CategoryService;
- use bizMall\goods\services\GoodsCategoryService;
- use bizMall\user\classes\UserClass;
- use Yii;
- use yii\web\Controller;
- use common\components\util;
- class CategoryController extends BaseController
- {
- //获取分类 ssh 2019.12.2
- public function actionList()
- {
- //添加最近访问的门店
- UserClass::addRecentShop($this->shopId, $this->user);
- $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);
- }
- }
|