From 0ea09d0aa106052f95c96e7001931cbe50569654 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sun, 15 Sep 2024 09:33:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AC=E5=9C=B0=E7=94=9F?= =?UTF-8?q?=E6=B4=BB=E5=95=86=E5=93=81=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LocalStoreGoods.php | 10 ++++++++++ app/api/logic/LocalStoreGoodsLogic.php | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/app/api/controller/LocalStoreGoods.php b/app/api/controller/LocalStoreGoods.php index 21760a19..ec6426b2 100755 --- a/app/api/controller/LocalStoreGoods.php +++ b/app/api/controller/LocalStoreGoods.php @@ -83,4 +83,14 @@ class LocalStoreGoods extends Api } return JsonServer::error('操作失败'); } + + public function delGoods() + { + $form = $this->request->post(); + $result = LocalStoreGoodsLogic::delGoods($form, $this->user_id); + if ($result) { + return JsonServer::success('操作成功'); + } + return JsonServer::error('操作失败'); + } } \ No newline at end of file diff --git a/app/api/logic/LocalStoreGoodsLogic.php b/app/api/logic/LocalStoreGoodsLogic.php index 8596d275..8ad6600c 100644 --- a/app/api/logic/LocalStoreGoodsLogic.php +++ b/app/api/logic/LocalStoreGoodsLogic.php @@ -286,6 +286,17 @@ class LocalStoreGoodsLogic extends Logic return false; } + public static function delGoods($form, $user_id) + { + $result = LocalStoreGoods::where([ + 'id' => $form['id'], + 'user_id' => $user_id + ])->update(['delete_time' => time()]); + + return $result; + } + + // 添加规格 private static function addSpec($id, $user_id, $form) { $len = strlen(Config::get('aliyunoss.domain'));