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