浏览代码

逆解析key

wzh 3 周之前
父节点
当前提交
008c43e44a
共有 2 个文件被更改,包括 29 次插入12 次删除
  1. 1 1
      src/main/java/com/qlm/controller/jinzai/MobileController.java
  2. 28 11
      src/main/webapp/mobile/index.jsp

+ 1 - 1
src/main/java/com/qlm/controller/jinzai/MobileController.java

@@ -572,7 +572,7 @@ public class MobileController extends Controller{
 			return null;
 		}
 		String location = latitude+","+longitude;
-		String key = "HTABZ-CBHRQ-WXT5C-BWAGZ-ARXY3-QMB5N";
+		String key = "D35BZ-WFCHT-R5MXD-LK437-T5DCH-NYFKC";
 		String url = "https://apis.map.qq.com/ws/geocoder/v1/?location="+location+"&key="+key+"&get_poi=0";
 	
 		String xmlStr = HttpKit.get(url);

+ 28 - 11
src/main/webapp/mobile/index.jsp

@@ -579,6 +579,8 @@
 
 	<script src="${ctx}/mobile/layer-mobile/layer.js"></script>
 	<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
+	<script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
+	
 	<script>
 	let showError = false;
 	  var latitude = "";
@@ -596,17 +598,32 @@
 
 	  wx.ready(function(){
 		  showError = true;
-		  wx.getLocation({
-			  type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
-			  success: function (res) {
-			     latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
-			     longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
-				$("#isLocation").hide();
-			  },
-			  fail:function(){
-				  $("#isLocation").show();
-			  }
-			});
+// 		  wx.getLocation({
+// 			  type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
+// 			  success: function (res) {
+// 			     latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
+// 			     longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
+// 				$("#isLocation").hide();
+// 			  },
+// 			  fail:function(){
+// 				  $("#isLocation").show();
+// 			  }
+// 			});
+				 if(window["qq"] == undefined) return;
+				 var geolocation = new qq.maps.Geolocation("CXFBZ-R27RF-MSQJV-JVWS4-3BAXQ-XXBN6", "myapp");
+				  geolocation.getLocation(function(pos){//老版本的定位不支持ios10,使用腾讯地图的api可以支持
+				  		var addr = pos.addr;
+				  		latitude = pos.lat;
+				  		longitude = pos.lng;
+				        var province = pos.province;
+				  		var city = pos.city;
+				  		var district = pos.district;
+				  		if(!district){
+				  			district = "";
+				  		}
+				  		addr = province+";"+city+";"+district+";"+addr;
+				        addr = addr+"#("+lat+","+lnt+")";
+				  });
 	  });
 
 	  wx.error(function(res){