更新
This commit is contained in:
parent
411cdfa3f0
commit
11aa471aa7
@ -157,7 +157,6 @@ class JunziqianController extends BaseApiController
|
|||||||
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
||||||
$request->needQifengSign = 1;
|
$request->needQifengSign = 1;
|
||||||
//发起PING请求
|
//发起PING请求
|
||||||
// halt($request);
|
|
||||||
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
||||||
return $response;
|
return $response;
|
||||||
// return $this->success('', (array)$response);
|
// return $this->success('', (array)$response);
|
||||||
|
@ -186,7 +186,6 @@ class RemoteController extends BaseApiController
|
|||||||
"lat"=> $latitude1,
|
"lat"=> $latitude1,
|
||||||
"lon"=> $longitude1
|
"lon"=> $longitude1
|
||||||
];
|
];
|
||||||
|
|
||||||
$closestPoint = $this->getClosestPoint($points, $target);
|
$closestPoint = $this->getClosestPoint($points, $target);
|
||||||
return $this->calculateDistance($target['lon'], $target['lat'], $closestPoint[0]['lon'], $closestPoint[0]['lat']);
|
return $this->calculateDistance($target['lon'], $target['lat'], $closestPoint[0]['lon'], $closestPoint[0]['lat']);
|
||||||
|
|
||||||
@ -197,11 +196,9 @@ class RemoteController extends BaseApiController
|
|||||||
* 计算两点之间的距离
|
* 计算两点之间的距离
|
||||||
*/
|
*/
|
||||||
function getClosestPoint($points, $target) {
|
function getClosestPoint($points, $target) {
|
||||||
halt($points,$target);
|
|
||||||
$minDistance = PHP_INT_MAX;
|
$minDistance = PHP_INT_MAX;
|
||||||
$closestPoint = null;
|
$closestPoint = null;
|
||||||
foreach ($points as $point) {
|
foreach ($points as $point) {
|
||||||
// halt($point,$target);
|
|
||||||
$distance = sqrt(pow(($point['lat'] - $target['lat']), 2) + pow(($point['lon'] - $target['lon']), 2));
|
$distance = sqrt(pow(($point['lat'] - $target['lat']), 2) + pow(($point['lon'] - $target['lon']), 2));
|
||||||
if ($distance < $minDistance) {
|
if ($distance < $minDistance) {
|
||||||
$minDistance = $distance;
|
$minDistance = $distance;
|
||||||
|
@ -101,6 +101,7 @@ class TaskController extends BaseApiController
|
|||||||
public function add_tricycle_coordinate()
|
public function add_tricycle_coordinate()
|
||||||
{
|
{
|
||||||
$parmas = $this->request->param();
|
$parmas = $this->request->param();
|
||||||
|
Log::error(json_encode($parmas));
|
||||||
$task = Task::where('id', $parmas['id'])->find()->toArray();
|
$task = Task::where('id', $parmas['id'])->find()->toArray();
|
||||||
$object_id=CompanyProperty::where('company_id',$this->userInfo['company_id'])->value('object_id');
|
$object_id=CompanyProperty::where('company_id',$this->userInfo['company_id'])->value('object_id');
|
||||||
if(!$object_id){
|
if(!$object_id){
|
||||||
@ -120,7 +121,7 @@ class TaskController extends BaseApiController
|
|||||||
return $this->fail('定位不存在');
|
return $this->fail('定位不存在');
|
||||||
}
|
}
|
||||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['terminus']['lnglat'][0], $parmas['terminus']['lnglat'][1]);
|
$res = App(RemoteController::class)->coordinate($datas, $parmas['terminus']['lnglat'][0], $parmas['terminus']['lnglat'][1]);
|
||||||
if($res==false){
|
if($res===false){
|
||||||
return $this->fail('定位不存在|或GPS无轨迹');
|
return $this->fail('定位不存在|或GPS无轨迹');
|
||||||
}
|
}
|
||||||
$task['extend']['update']['terminus'] = $parmas['terminus'];
|
$task['extend']['update']['terminus'] = $parmas['terminus'];
|
||||||
@ -130,7 +131,7 @@ class TaskController extends BaseApiController
|
|||||||
return $this->fail('定位不存在');
|
return $this->fail('定位不存在');
|
||||||
}
|
}
|
||||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
$res = App(RemoteController::class)->coordinate($datas, $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
||||||
if($res==false){
|
if($res===false){
|
||||||
return $this->fail('定位不存在|或GPS无轨迹');
|
return $this->fail('定位不存在|或GPS无轨迹');
|
||||||
}
|
}
|
||||||
$task['extend']['update']['transfer'] = $parmas['transfer'];
|
$task['extend']['update']['transfer'] = $parmas['transfer'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user