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