request->get('id', 0); $cId = Yii::$app->request->get('cId', 0); $inTurn = Yii::$app->request->get('inTurn', 0); //验证商品 $info = GoodsService::getById($id); GoodsService::valid($info, $this->mainId); if ($cId != 0) { //验证分类 $category = CategoryService::getById($cId); CategoryService::valid($category, $this->mainId); GoodsCategoryService::updateByCondition(['cId' => $cId, 'gId' => $id], ['inTurn' => $inTurn]); } else { GoodsService::updateById($id, ['inTurn' => $inTurn]); GoodsCategoryService::updateByCondition(['gId' => $id], ['inTurn' => $inTurn]); } util::complete('操作成功'); } //删除商品 ssh 2019.12.7 public function actionDelete() { $id = Yii::$app->request->get('id', 0); $goods = GoodsService::getById($id); GoodsService::valid($goods, $this->mainId); GoodsService::deleteGoods($goods); util::complete(); } //上下架 ssh 2019.12.8 public function actionChangeStatus() { $post = Yii::$app->request->post(); $id = isset($post['id']) ? $post['id'] : 0; $status = isset($post['status']) ? $post['status'] : 1; $info = GoodsService::getById($id); GoodsService::valid($info, $this->mainId); GoodsService::changeStatus($id, $status); util::complete(); } //发送短链接到手机上 ssh 2019.12.8 public function actionSendShortUrl() { $id = Yii::$app->request->get('id'); util::complete(); } //查看商品短链接 ssh 2019.12.8 public function actionShortUrl() { $id = Yii::$app->request->get('id'); util::success(['shortUrl' => 'https://w.url.cn/s/A8iQl2r']); } //商品说明 ssh 2019.12.8 public function actionIntroduce() { $set = GoodsSettingService::getByCondition(['sjId' => $this->sjId]); $introduce = $set['goodsIntroduce']; util::success(['introduce' => $introduce]); } //修改商品说明 ssh 2019.12.8 public function actionUpdateIntroduce() { $introduce = Yii::$app->request->post('introduce', ''); GoodsSettingService::updateByCondition(['sjId' => $this->sjId], ['goodsIntroduce' => $introduce]); util::complete('提交成功'); } //设置 ssh 2019.12.8 public function actionSetting() { $return = GoodsSettingService::getSetting($this->sjId); util::success($return); } //更新涨价 ssh 2019.12.9 public function actionUpdateRise() { $post = Yii::$app->request->post(); $festIdList = isset($post['festIdList']) && !empty($post['festIdList']) ? $post['festIdList'] : []; unset($post['festIdList']); $riseSwitch = isset($post['riseSwitch']) && is_numeric($post['riseSwitch']) ? $post['riseSwitch'] : 1; if ($riseSwitch == 1) { if (empty($festIdList)) { util::fail('请选择节日'); } FestRiseService::deleteByCondition(['sjId' => $this->sjId]); $add = []; foreach ($festIdList as $festId) { $add[] = ['sjId' => $this->sjId, 'festId' => $festId]; } FestRiseService::batchAdd($add); } GoodsSettingService::updateByCondition(['sjId' => $this->sjId], $post); util::complete('提交成功'); } }