CategoryController.php 884 B

123456789101112131415161718192021222324252627282930313233343536
  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. //获取分类 ssh 2019.12.2
  11. public function actionList()
  12. {
  13. $return = CategoryService::getEnableList($this->mainId);
  14. util::success($return);
  15. }
  16. //取分类下商品 ssh 2019.12.2
  17. public function actionGoodsList()
  18. {
  19. $categoryId = Yii::$app->request->get('categoryId');
  20. if (empty($categoryId)) {
  21. util::fail('没有找到分类');
  22. }
  23. $where = [];
  24. $where['mainId'] = $this->mainId;
  25. $where['cId'] = $categoryId;
  26. $where['delStatus'] = 0;
  27. $data = GoodsCategoryService::getGoodsList($where);
  28. util::success($data);
  29. }
  30. }