CategoryController.php 838 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace client\controllers;
  3. use biz\goods\services\CategoryService;
  4. use biz\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->merchantId);
  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();
  22. $where = [];
  23. $where['merchantId'] = $this->merchantId;
  24. $where['cId'] = $categoryId;
  25. $data = GoodsCategoryService::getGoodsList($where);
  26. util::success($data);
  27. }
  28. }