From 621cf2e5f957cc94588ec6ef855bc84912c39910 Mon Sep 17 00:00:00 2001 From: zengyyh Date: Sat, 14 Sep 2024 13:49:53 +0800 Subject: [PATCH] 123 --- app/store/controller/Goods.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/store/controller/Goods.php b/app/store/controller/Goods.php index 5649f6dc..82400775 100644 --- a/app/store/controller/Goods.php +++ b/app/store/controller/Goods.php @@ -396,5 +396,20 @@ class Goods extends Controller return $this->renderSuccess('操作成功'); } + /** + * 修改商品状态(上下架) + * @param array $goodsIds 商品id集 + * @param bool $state 为true表示上架 + * @return Json + */ + public function jingpin(array $goodsIds, int $is_jingpin): Json + { + $model = new GoodsModel; + if (!$model->setIsJingpin($goodsIds, $is_jingpin)) { + return $this->renderError($model->getError() ?: '操作失败'); + } + return $this->renderSuccess('操作成功'); + } + }