From 6bf50292a4e68420be1c7d742284484a4458e41e Mon Sep 17 00:00:00 2001 From: Wayne <943146732@qq.com> Date: Wed, 28 Feb 2024 23:41:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BA=97=E9=93=BA=E7=9A=84?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/Shop.php | 12 ++++++++++++ app/store/model/store/Shop.php | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/store/controller/Shop.php b/app/store/controller/Shop.php index c0a23048..e349e24f 100644 --- a/app/store/controller/Shop.php +++ b/app/store/controller/Shop.php @@ -97,6 +97,18 @@ class Shop extends Controller return $this->renderError($model->getError() ?: '更新失败'); } + public function updateParking(int $shopId): Json + { + // 门店详情 + $model = ShopModel::detail($shopId); + // 新增记录 + if ($model->editParking($this->postForm())) { + return $this->renderSuccess('更新成功'); + } + return $this->renderError($model->getError() ?: '更新失败'); + } + + /** * 删除门店 * @param int $shopId diff --git a/app/store/model/store/Shop.php b/app/store/model/store/Shop.php index e677b644..6ab723b3 100644 --- a/app/store/model/store/Shop.php +++ b/app/store/model/store/Shop.php @@ -105,6 +105,16 @@ class Shop extends ShopModel $data['remark'] = json_encode($data['remark'], JSON_UNESCAPED_UNICODE); return $this->save($this->createData($data)) !== false; } + + public function editParking(array $data): bool + { + if (!empty($data['parking_coordinate'])) { + $parking_coordinate = explode(',', $data['parking_coordinate']); + $data['parking_latitude'] = $parking_coordinate[0]; + $data['parking_longitude'] = $parking_coordinate[1]; + } + return $this->save($data) !== false; + } /** * 软删除