| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace mall\controllers;
- use bizHd\custom\classes\CustomClass;
- 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()
- {
- //普莲花艺、叶上花、丰行、小武鲜花、九江云朵、源花汇不能在花卉宝下单,多处要同步修改,关键词ls_mall_not_open
- $mainId = $this->mainId;
- if (getenv('YII_ENV') == 'production') {
- if (in_array($mainId, [40057, 7779, 42940, 26374,10536])) {
- util::fail('暂无商品哦,编号25395');
- }
- } else {
- if (in_array($mainId, [0, 1])) {
- util::fail('暂无商品哦!编号639942');
- }
- }
- //建立客户关系
- CustomClass::buildRelation($this->shop, $this->user);
- $mainId = $this->mainId ?? 0;
- $where = ['mainId' => $mainId, 'delStatus' => 0, 'status' => 1];
- //默认列出正常分类,美团等第三方分类不列表
- $where['style'] = 0;
- $return = CategoryService::getAllCategory($where);
- 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);
- }
- }
|