更新店铺的停车场

wysf
Wayne 11 months ago
parent f87797e2aa
commit 6bf50292a4
  1. 12
      app/store/controller/Shop.php
  2. 10
      app/store/model/store/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

@ -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;
}
/**
* 软删除

Loading…
Cancel
Save