From fa365ebb90aa40a4b1dd3c80f66b328e2fe195fd Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sun, 29 Sep 2024 17:53:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E7=82=B9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LocalStore.php | 13 ++++++++++++- app/api/logic/LocalStoreLogic.php | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/api/controller/LocalStore.php b/app/api/controller/LocalStore.php index 31ee1ada..a70fd8f3 100755 --- a/app/api/controller/LocalStore.php +++ b/app/api/controller/LocalStore.php @@ -243,7 +243,7 @@ class LocalStore extends Api $model = new LocalStoreLogic; $result['distance'] = round($model->distance($result['latitude'], $result['longitude'], $latitude, $longitude) / 1000, 2) . "公里"; $result['header_image'] = FileConfig::get('aliyunoss.domain') . 'local_life_shop/' . $result['header_image']; - $result['post_station'] = LocalStorePostStation::where(['user_id' => $this->user_id, 'lstore_id' => $id])->field('id, province, city, area, address, lat,lng')->select()->toArray(); + $result['post_station'] = LocalStorePostStation::where(['user_id' => $this->user_id, 'lstore_id' => $id, 'is_delete' => 0])->field('id, province, city, area, address, lat,lng')->select()->toArray(); return JsonServer::success('成功获取', $result); } @@ -362,4 +362,15 @@ class LocalStore extends Api return JsonServer::error($e->getMessage()); } } + + public function delPostStation() + { + try { + $post = $this->request->post(); + LocalStoreLogic::delPostStation($post, $this->user_id); + return JsonServer::success('设置成功'); + } catch (\Exception $e) { + return JsonServer::error($e->getMessage()); + } + } } \ No newline at end of file diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 41219f22..f9cad205 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -374,4 +374,22 @@ class LocalStoreLogic extends Logic throw new \Exception('更新失败'); } + + public static function delPostStation($post, $user_id) + { + if (!$post['id']) { + throw new \Exception('参数不能为空'); + } + + $result = LocalStorePostStation::where([ + 'id' => $post['id'], + 'user_id' => $user_id + ])->update(['is_delete' => 1]); + + if ($result) { + return true; + } + + throw new \Exception('删除失败'); + } } \ No newline at end of file