CategoryController.php 870 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace mall\controllers;
  3. use bizMall\goods\services\CategoryService;
  4. use bizMall\goods\services\GoodsCategoryService;
  5. use Yii;
  6. use yii\web\Controller;
  7. use common\components\util;
  8. class CategoryController extends BaseController
  9. {
  10. //获取分类 shish 2019.12.2
  11. public function actionList()
  12. {
  13. $return = CategoryService::getEnableList($this->sjId);
  14. util::success($return);
  15. }
  16. //取分类下商品 shish 2019.12.2
  17. public function actionGoodsList()
  18. {
  19. $categoryId = Yii::$app->request->get('categoryId');
  20. //没有分类默认取商家第一个分类
  21. $categoryId = !empty($categoryId) ? $categoryId : CategoryService::getTopCategoryId($this->sjId);
  22. $where = [];
  23. $where['merchantId'] = $this->sjId;
  24. $where['cId'] = $categoryId;
  25. $where['delStatus'] = 0;
  26. $data = GoodsCategoryService::getGoodsList($where);
  27. util::success($data);
  28. }
  29. }