diff --git a/app/api/controller/CeshiController.php b/app/api/controller/CeshiController.php index b5ec28fee..a4c7ec91a 100644 --- a/app/api/controller/CeshiController.php +++ b/app/api/controller/CeshiController.php @@ -13,7 +13,7 @@ use Symfony\Component\HttpClient\HttpClient; class CeshiController extends BaseApiController { - public array $notNeedLogin = ['index','ceshi']; + public array $notNeedLogin = ['index','ceshi','ceshi1']; public function index() { @@ -41,33 +41,23 @@ class CeshiController extends BaseApiController } } - 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; + public function ceshi1(){ + $params=[ + 'car_id'=>3, + 'start_time'=>'2023-08-18', + 'end_time'=>'2023-08-18 23:59:59' + ]; + $task=Task::where('id',485)->select()->toArray(); + foreach($task as $k=>$v){ + if(isset($v['extend']['terminus']['lnglat'])){ + $arr=$v['extend']['terminus']['lnglat']; + app(RemoteController::class)->coordinate($params,$arr[0],$arr[1]); + } + if(isset($v['extend']['transfer']['lnglat'])){ + $arr=$v['extend']['transfer']['lnglat']; + app(RemoteController::class)->coordinate($params,$arr[0],$arr[1]); } } - - return [$closestPoint,$distance]; } - function calculateDistance( $longitude1,$latitude1, $longitude2,$latitude2 ) { - $earthRadius = 6371; // 地球半径,单位为公里 - - $dLat = deg2rad($latitude2 - $latitude1); - $dLon = deg2rad($longitude2 - $longitude1); - - $a = sin($dLat/2) * sin($dLat/2) + - cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * - sin($dLon/2) * sin($dLon/2); - $c = 2 * asin(sqrt($a)); - - return $earthRadius * $c*1000; - } } \ No newline at end of file diff --git a/app/common/model/Company.php b/app/common/model/Company.php index 3e974abba..b5a2b07c4 100644 --- a/app/common/model/Company.php +++ b/app/common/model/Company.php @@ -17,6 +17,7 @@ namespace app\common\model; use app\common\model\contract\Contract; use app\common\model\dict\DictData; use think\facade\Db; +use think\model\concern\SoftDelete; /** * Company模型 @@ -25,6 +26,9 @@ use think\facade\Db; */ class Company extends BaseModel { + use SoftDelete; + + protected $deleteTime = 'delete_time'; protected $name = 'company';