merchantId); util::success($list); } //查看详情 shish 2019.12.8 public function actionDetail() { $id = Yii::$app->request->get('categoryId', 0); $category = CategoryService::getById($id); CategoryService::valid($category, $this->merchantId); $info = CategoryService::getInfo($id); util::success($info); } //添加分类 shish 2019.12.8 public function actionAdd() { $post = Yii::$app->request->post(); $post['merchantId'] = $this->merchantId; $cat = CategoryService::addCategory($post); util::success(['id' => $cat['id']]); } //更新分类 shish 2019.12.8 public function actionUpdate() { $post = Yii::$app->request->post(); $categoryId = isset($post['categoryId']) ? $post['categoryId'] : 0; $category = CategoryService::getById($categoryId); CategoryService::valid($category, $this->merchantId); CategoryService::updateCategory($category, $post); util::complete('修改成功'); } //分类启用停用 shish 2019.12.8 public function actionChangeStatus() { $get = Yii::$app->request->get(); $categoryId = isset($get['categoryId']) ? $get['categoryId'] : 0; $status = isset($get['status']) ? $get['status'] : 0; $category = CategoryService::getById($categoryId); CategoryService::valid($category, $this->merchantId); CategoryService::changeStatus($categoryId, $status); util::complete(); } //删除分类 shish 2019.12.28 public function actionDelete() { $get = Yii::$app->request->get(); $categoryId = isset($get['categoryId']) ? $get['categoryId'] : 0; $category = CategoryService::getById($categoryId); CategoryService::valid($category, $this->merchantId); CategoryService::deleteCategory($categoryId); util::complete('删除成功'); } //取分类下商品 shish 2019.12.2 public function actionGoodsList() { $categoryId = Yii::$app->request->get('categoryId'); //没有分类默认取商家第一个分类 $categoryId = !empty($categoryId) ? $categoryId : CategoryService::getTopCategoryId($this->merchantId); $where = []; $where['merchantId'] = $this->merchantId; $where['cId'] = $categoryId; $where['delStatus'] = 0; $data = GoodsCategoryService::getGoodsList($where); util::success($data); } //分类排序 shish 2020.3.11 public function actionSort() { $id = Yii::$app->request->get('id', 0); $inTurn = Yii::$app->request->get('inTurn', 0); $category = CategoryService::getById($id); CategoryService::valid($category, $this->merchantId); CategoryService::updateById($id, ['inTurn' => $inTurn]); util::complete(); } }