Forráskód Böngészése

获取分类的商品

shish 6 éve
szülő
commit
d6045be552
1 módosított fájl, 14 hozzáadás és 0 törlés
  1. 14 0
      app/business/controllers/CategoryController.php

+ 14 - 0
app/business/controllers/CategoryController.php

@@ -9,6 +9,7 @@
 namespace business\controllers;
 namespace business\controllers;
 
 
 use biz\goods\services\CategoryService;
 use biz\goods\services\CategoryService;
+use biz\goods\services\GoodsCategoryService;
 use Yii;
 use Yii;
 use common\components\util;
 use common\components\util;
 
 
@@ -74,5 +75,18 @@ class CategoryController extends BaseController
 		CategoryService::valid($category, $this->merchantId);
 		CategoryService::valid($category, $this->merchantId);
 		util::ok('删除成功');
 		util::ok('删除成功');
 	}
 	}
+	
+	//取分类下商品 shish 2019.12.2
+	public function actionGoodsList()
+	{
+		$categoryId = Yii::$app->request->get('categoryId');
+		//没有分类默认取商家第一个分类
+		$categoryId = !empty($categoryId) ? $categoryId : CategoryService::getTopCategoryId();
+		$where = [];
+		$where['merchantId'] = $this->merchantId;
+		$where['cId'] = $categoryId;
+		$data = GoodsCategoryService::getGoodsList($where);
+		util::success($data);
+	}
 
 
 }
 }