添加修改站点方法
This commit is contained in:
parent
98d06d719a
commit
6fbb553722
@ -390,12 +390,24 @@ class LocalStore extends Api
|
||||
}
|
||||
}
|
||||
|
||||
// 修改自提站点联系电话
|
||||
public function editPostStationPhone()
|
||||
{
|
||||
try {
|
||||
$post = $this->request->post();
|
||||
LocalStoreLogic::editPostStationPhone($post);
|
||||
return JsonServer::success('设置成功');
|
||||
} catch (\Exception $e) {
|
||||
return JsonServer::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 删除自提点
|
||||
public function delPostStation()
|
||||
{
|
||||
try {
|
||||
$post = $this->request->post();
|
||||
LocalStoreLogic::delPostStation($post, $this->user_id);
|
||||
LocalStoreLogic::delPostStation($post);
|
||||
return JsonServer::success('设置成功');
|
||||
} catch (\Exception $e) {
|
||||
return JsonServer::error($e->getMessage());
|
||||
|
||||
@ -464,6 +464,10 @@ class LocalStoreLogic extends Logic
|
||||
throw new \Exception('经纬度不能为空');
|
||||
}
|
||||
|
||||
if (!$post['phone']) {
|
||||
throw new \Exception('自提点联系电话不能为空');
|
||||
}
|
||||
|
||||
$post['user_id'] = $user_id;
|
||||
$result = LocalStorePostStation::insert($post);
|
||||
|
||||
@ -474,16 +478,32 @@ class LocalStoreLogic extends Logic
|
||||
throw new \Exception('更新失败');
|
||||
}
|
||||
|
||||
public static function delPostStation($post, $user_id)
|
||||
// 修改自提站点联系电话
|
||||
public static function editPostStationPhone($post)
|
||||
{
|
||||
if (!$post['id']) {
|
||||
throw new \Exception('参数不能为空');
|
||||
}
|
||||
|
||||
if (!$post['phone']) {
|
||||
throw new \Exception('自提点联系电话不能为空');
|
||||
}
|
||||
|
||||
$result = LocalStorePostStation::where([
|
||||
'id' => $post['id'],
|
||||
])->update(['phone' => $post['phone']]);
|
||||
}
|
||||
|
||||
// 删除自提点
|
||||
public static function delPostStation($post)
|
||||
{
|
||||
if (!$post['id']) {
|
||||
throw new \Exception('参数不能为空');
|
||||
}
|
||||
|
||||
$result = LocalStorePostStation::where([
|
||||
'id' => $post['id'],
|
||||
'user_id' => $user_id
|
||||
])->update(['is_delete' => 1]);
|
||||
'id' => $post['id']
|
||||
])->update(['is_delete' => 1, 'delete_time' => time()]);
|
||||
|
||||
if ($result) {
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user