Kaynağa Gözat

接口api/getEnablePlaces增加百度坐标转换成高德坐标

git 6 yıl önce
ebeveyn
işleme
18298e4876

+ 8 - 0
Home/Lib/Action/ApiAction.class.php

@@ -257,6 +257,14 @@ class ApiAction extends Action {
 		if(!$res){
 			json_fail('备案点不存在!');
 		}
+		//百度坐标转换成高德坐标系
+		$lngLatAlter = new \Jms\Algo\Geometry();
+		foreach($res as $key => $row){
+			$alterRes = $lngLatAlter->convertBd09ToGcj02($row['Latitude'], $row['Longitude']);
+			$row['Latitude'] = $alterRes['lat'];
+			$row['Longitude'] = $alterRes['lat'];
+			$res[$key] = $row; 
+		}
 		json_success('查询成功',$res);
 	}
 	

+ 14 - 0
Home/Lib/Action/IndexAction.class.php

@@ -13,6 +13,20 @@ class IndexAction extends Action {
 	
  
 	public  function test(  ){
+		/*
+		$object = new \Qrcode\QRcode();
+		$object->png('qweqwe','/data/wwwroot/develop.rltest.cn/1.2.7/czwx/Home/static/image/test.png',3,4);
+		
+		$reslut = \PHPQRCode\QRcode::png("Test", false, 'L', 4, 2,true);
+		var_dump($result);
+		
+		//echo 'ok';
+		exit;
+		$qrCode = new Endroid\QrCode\QrCode('Life is too short to be generating QR codes');
+		header('Content-Type: '.$qrCode->getContentType());
+		echo $qrCode->writeString();
+		exit();
+		*/
 		$info = array(
 			'ExpireTime' => time()+600,
 			'LicensePlate' => 'BJ000001'