更新
This commit is contained in:
parent
d77fbaf6fa
commit
8d3eb6d833
@ -21,7 +21,6 @@ class RemoteController extends BaseApiController
|
|||||||
if (isset($arr['start_time']) && $arr['end_time']) {
|
if (isset($arr['start_time']) && $arr['end_time']) {
|
||||||
$start_time = $arr['start_time'];
|
$start_time = $arr['start_time'];
|
||||||
$end_time = $arr['end_time'];
|
$end_time = $arr['end_time'];
|
||||||
|
|
||||||
}
|
}
|
||||||
$parmas = [
|
$parmas = [
|
||||||
"start_date" => $start_time,
|
"start_date" => $start_time,
|
||||||
@ -98,20 +97,15 @@ class RemoteController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shang_date_list($company,$is_day,$querys){
|
public function shang_date_list($company, $querys)
|
||||||
if($is_day==1){
|
{
|
||||||
$start_time = date('Y-m-d');
|
$start_time = date('Y-m-d');
|
||||||
$time = strtotime($start_time) + 86399;
|
$time = strtotime($start_time) + 86399;
|
||||||
$end_time = date('Y-m-d H:i:s', $time);
|
$end_time = date('Y-m-d H:i:s', $time);
|
||||||
}else{
|
|
||||||
$start_time = date('Y-m-d',strtotime('-1 day', time()));
|
|
||||||
$time=strtotime($start_time)+86399;
|
|
||||||
$end_time=date('Y-m-d H:i:s',$time);
|
|
||||||
}
|
|
||||||
if (isset($querys['start_time']) && isset($querys['end_time'])) {
|
if (isset($querys['start_time']) && isset($querys['end_time'])) {
|
||||||
$start_time = $querys['start_time'];
|
$start_time = $querys['start_time'];
|
||||||
$end_time = $querys['end_time'];
|
$end_time = $querys['end_time'];
|
||||||
|
|
||||||
}
|
}
|
||||||
$parmas = [
|
$parmas = [
|
||||||
"start_date" => $start_time,
|
"start_date" => $start_time,
|
||||||
@ -165,14 +159,14 @@ class RemoteController extends BaseApiController
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 获取坐标的距离
|
* 获取坐标的距离
|
||||||
*/
|
*/
|
||||||
public function coordinate($parmas,$longitude1,$latitude1){
|
public function coordinate($parmas, $longitude1, $latitude1)
|
||||||
|
{
|
||||||
$res = HttpClient::create()->request('GET', env('project.logistic_domain') . '/api/getCarHistory', [
|
$res = HttpClient::create()->request('GET', env('project.logistic_domain') . '/api/getCarHistory', [
|
||||||
'query' => $parmas,
|
'query' => $parmas,
|
||||||
]);
|
]);
|
||||||
@ -187,14 +181,14 @@ class RemoteController extends BaseApiController
|
|||||||
];
|
];
|
||||||
$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']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 计算两点之间的距离
|
* 计算两点之间的距离
|
||||||
*/
|
*/
|
||||||
function getClosestPoint($points, $target) {
|
function getClosestPoint($points, $target)
|
||||||
|
{
|
||||||
$minDistance = PHP_INT_MAX;
|
$minDistance = PHP_INT_MAX;
|
||||||
$closestPoint = null;
|
$closestPoint = null;
|
||||||
foreach ($points as $point) {
|
foreach ($points as $point) {
|
||||||
@ -215,7 +209,8 @@ class RemoteController extends BaseApiController
|
|||||||
*
|
*
|
||||||
* 计算两点之间的距离
|
* 计算两点之间的距离
|
||||||
*/
|
*/
|
||||||
function calculateDistance( $longitude1,$latitude1, $longitude2,$latitude2 ) {
|
function calculateDistance($longitude1, $latitude1, $longitude2, $latitude2)
|
||||||
|
{
|
||||||
$earthRadius = 6371; // 地球半径,单位为公里
|
$earthRadius = 6371; // 地球半径,单位为公里
|
||||||
|
|
||||||
$dLat = deg2rad($latitude2 - $latitude1);
|
$dLat = deg2rad($latitude2 - $latitude1);
|
||||||
|
@ -62,12 +62,12 @@ class TaskController extends BaseApiController
|
|||||||
if ($find != false) {
|
if ($find != false) {
|
||||||
if($time<time()){
|
if($time<time()){
|
||||||
$transaction_pool=TaskTemplate::where('id',$item['template_id'])->value('transaction_pool');
|
$transaction_pool=TaskTemplate::where('id',$item['template_id'])->value('transaction_pool');
|
||||||
if($transaction_pool==0){
|
|
||||||
$find['transaction']['arr']['transaction_pool']=$find['transaction']['arr']['total_price'];
|
|
||||||
}else{
|
|
||||||
$find['transaction']['arr']['transaction_pool']=bcadd($find['transaction']['arr']['total_price'],$transaction_pool,2);
|
|
||||||
}
|
|
||||||
$res[$k]['extend']['transaction'] = $find;
|
$res[$k]['extend']['transaction'] = $find;
|
||||||
|
if($transaction_pool==0){
|
||||||
|
$res[$k]['extend']['transaction']['arr']['transaction_pool']=$find['arr']['total_price'];
|
||||||
|
}else{
|
||||||
|
$res[$k]['extend']['transaction']['arr']['transaction_pool']=bcadd($res[$k]['extend']['transaction']['arr']['total_price'],$transaction_pool,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Task::where('id',$item['id'])->update(['extend'=>json_encode(['transaction'=>$find],true)]);
|
// Task::where('id',$item['id'])->update(['extend'=>json_encode(['transaction'=>$find],true)]);
|
||||||
} else {
|
} else {
|
||||||
@ -93,13 +93,15 @@ class TaskController extends BaseApiController
|
|||||||
// $list = App(RemoteController::class)->shang_date_list($company, 1, $parmas);
|
// $list = App(RemoteController::class)->shang_date_list($company, 1, $parmas);
|
||||||
$parmas['start_time']=date('Y-m-d',$task['start_time']);
|
$parmas['start_time']=date('Y-m-d',$task['start_time']);
|
||||||
$parmas['end_time']=$task['end_time'].' 23:59:59';
|
$parmas['end_time']=$task['end_time'].' 23:59:59';
|
||||||
$list = App(RemoteController::class)->shang_date_list($company, 1, $parmas);
|
$list = App(RemoteController::class)->shang_date_list($company, $parmas);
|
||||||
|
$shang_date_total_price = App(RemoteController::class)->shang_date_total_price($company,$parmas,$task['template_id']);
|
||||||
|
|
||||||
if ($task != false) {
|
if ($task != false) {
|
||||||
$find['list'] = $list;
|
$find['list'] = $list;
|
||||||
if($transaction_pool==0){
|
if($transaction_pool==0){
|
||||||
$task['extend']['transaction']['arr']['transaction_pool']=$task['extend']['transaction']['arr']['total_price'];
|
$task['extend']['transaction']['arr']['transaction_pool']=$shang_date_total_price['arr']['total_price'];
|
||||||
}else{
|
}else{
|
||||||
$task['extend']['transaction']['arr']['transaction_pool']=bcadd($task['extend']['transaction']['arr']['total_price'],$transaction_pool,2);
|
$task['extend']['transaction']['arr']['transaction_pool']=bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2);
|
||||||
}
|
}
|
||||||
$find['extend']=$task['extend'];
|
$find['extend']=$task['extend'];
|
||||||
return $this->success('ok', $find);
|
return $this->success('ok', $find);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user