更新
This commit is contained in:
parent
203ca1137d
commit
d34992d827
@ -49,6 +49,80 @@ halt(2);
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function ceshi(){
|
public function ceshi(){
|
||||||
|
$points = [
|
||||||
|
[
|
||||||
|
"lat"=> 28.914962,
|
||||||
|
"lon"=>105.442355
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
"lat"=> 28.915456,
|
||||||
|
"lon"=> 105.443891
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917516,
|
||||||
|
"lon"=> 105.443371
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917536,
|
||||||
|
"lon"=> 105.443415
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917001,
|
||||||
|
"lon"=> 105.442421
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917103,
|
||||||
|
"lon"=> 105.442291
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916658,
|
||||||
|
"lon"=> 105.442897
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916428,
|
||||||
|
"lon"=> 105.44278
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917073,
|
||||||
|
"lon"=> 105.443507
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917073,
|
||||||
|
"lon"=> 105.443522
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916796,
|
||||||
|
"lon"=> 105.443466
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916665,
|
||||||
|
"lon"=> 105.443357
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916674,
|
||||||
|
"lon"=> 105.442294
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.916698,
|
||||||
|
"lon"=> 105.442268
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917279,
|
||||||
|
"lon"=> 105.443006
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"lat"=> 28.917234,
|
||||||
|
"lon"=> 105.442979
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$target =[
|
||||||
|
"lat"=> 28.917378,
|
||||||
|
"lon"=> 105.443005
|
||||||
|
];
|
||||||
|
|
||||||
|
$closestPoint = $this->getClosestPoint($points, $target);
|
||||||
|
halt($closestPoint);
|
||||||
// $time=strtotime(date('Y-m-d',strtotime('+1 day')));
|
// $time=strtotime(date('Y-m-d',strtotime('+1 day')));
|
||||||
$time=strtotime(date('Y-m-d'));
|
$time=strtotime(date('Y-m-d'));
|
||||||
$tiem_end=$time+86399;
|
$tiem_end=$time+86399;
|
||||||
@ -63,4 +137,20 @@ halt(2);
|
|||||||
}
|
}
|
||||||
halt(TaskLogic::getError());
|
halt(TaskLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getClosestPoint($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;
|
||||||
|
$closestPoint = $point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$closestPoint,$distance];
|
||||||
|
}
|
||||||
}
|
}
|
@ -98,7 +98,7 @@ class TaskLogic extends BaseLogic
|
|||||||
if ($v['template_info']['type'] == 32) {
|
if ($v['template_info']['type'] == 32) {
|
||||||
$data['director_uid'] = $v['company']['user_id'];
|
$data['director_uid'] = $v['company']['user_id'];
|
||||||
}
|
}
|
||||||
|
$data['extend'] = $v['template_info']['extend'];
|
||||||
$task_id = (new Task())->insertGetId($data);
|
$task_id = (new Task())->insertGetId($data);
|
||||||
TaskSchedulingPlan::where('id', $v['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
TaskSchedulingPlan::where('id', $v['id'])->update(['task_id' => $task_id, 'is_execute' => 1]);
|
||||||
return true;
|
return true;
|
||||||
|
@ -58,6 +58,7 @@ class TaskTemplateLogic extends BaseLogic
|
|||||||
'types' => $params['types'],
|
'types' => $params['types'],
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
'content' => $params['content'],
|
'content' => $params['content'],
|
||||||
|
'extend'=>json_encode($params['extend']),
|
||||||
'stage_day_one' => $params['stage_day_one']??0,
|
'stage_day_one' => $params['stage_day_one']??0,
|
||||||
'proportion_one' => $params['proportion_one']??0,
|
'proportion_one' => $params['proportion_one']??0,
|
||||||
'stage_day_two' => $params['stage_day_two']??0,
|
'stage_day_two' => $params['stage_day_two']??0,
|
||||||
@ -101,6 +102,7 @@ class TaskTemplateLogic extends BaseLogic
|
|||||||
'types' => $params['types'],
|
'types' => $params['types'],
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
'content' => $params['content'],
|
'content' => $params['content'],
|
||||||
|
'extend'=>json_encode($params['extend']),
|
||||||
'stage_day_one' => $params['stage_day_one']??0,
|
'stage_day_one' => $params['stage_day_one']??0,
|
||||||
'proportion_one' => $params['proportion_one']??0,
|
'proportion_one' => $params['proportion_one']??0,
|
||||||
'stage_day_two' => $params['stage_day_two']??0,
|
'stage_day_two' => $params['stage_day_two']??0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user