更新
This commit is contained in:
parent
947f0c33ee
commit
ffe0042ed0
@ -11,7 +11,7 @@ class RemoteController extends BaseApiController
|
||||
|
||||
public array $notNeedLogin = ['index'];
|
||||
|
||||
public function shang_date_total_price($company,$is_day=1,$arr)
|
||||
public function shang_date_total_price($company,$is_day,$arr)
|
||||
{
|
||||
if($is_day==1){
|
||||
$start_time = date('Y-m-d');
|
||||
@ -165,12 +165,12 @@ class RemoteController extends BaseApiController
|
||||
* 获取坐标的距离
|
||||
*/
|
||||
public function coordinate($parmas,$longitude1,$latitude1){
|
||||
|
||||
$res = HttpClient::create()->request('GET', 'http://logistics.lihaink.cn/api/getCarHistory', [
|
||||
'query' => $parmas,
|
||||
]);
|
||||
$json=json_decode($res->getContent(),true);
|
||||
$points=$json['data'];
|
||||
|
||||
$target =[
|
||||
"lat"=> $latitude1,
|
||||
"lon"=> $longitude1
|
||||
@ -191,7 +191,6 @@ class RemoteController extends BaseApiController
|
||||
foreach ($points as $point) {
|
||||
// halt($point,$target);
|
||||
$distance = sqrt(pow(($point['lat'] - $target['lat']), 2) + pow(($point['lon'] - $target['lon']), 2));
|
||||
|
||||
if ($distance < $minDistance) {
|
||||
$minDistance = $distance;
|
||||
$closestPoint = $point;
|
||||
|
@ -99,13 +99,18 @@ class TaskController extends BaseApiController
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$task = Task::where('id', $parmas['id'])->find()->toArray();
|
||||
$datas=[
|
||||
'car_id'=>3,
|
||||
'start_time'=>'2023-08-18',
|
||||
'end_time'=>'2023-08-18 23:59:59'
|
||||
];
|
||||
$data['status'] = 2;
|
||||
if (isset($parmas['terminus'])) {
|
||||
$res = App(RemoteController::class)->coordinate($parmas, $parmas['terminus']['lnglat'][0], ['terminus']['lnglat'][1]);
|
||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['terminus']['lnglat'][0], $parmas['terminus']['lnglat'][1]);
|
||||
$task['extend']['update']['terminus']['lnglat'] = $parmas['terminus'];
|
||||
}
|
||||
if (isset($parmas['transfer'])) {
|
||||
$res = App(RemoteController::class)->coordinate($parmas, $parmas['transfer']['lnglat'][0], ['transfer']['lnglat'][1]);
|
||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
||||
$task['extend']['update']['transfer']['lnglat'] = $parmas['transfer'];
|
||||
}
|
||||
if (isset($task['extend']['update']['terminus']) && isset($task['extend']['update']['transfer'])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user