添加删除自提点信息

This commit is contained in:
wangxiaowei 2024-09-29 17:53:43 +08:00
parent 64855de6f1
commit fa365ebb90
2 changed files with 30 additions and 1 deletions

@ -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());
}
}
}

@ -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('删除失败');
}
}