Răsfoiți Sursa

add tencentkey

马国华 7 ani în urmă
părinte
comite
335fb866f3
1 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  1. 8 1
      prototype/addressComponent.js

+ 8 - 1
prototype/addressComponent.js

@@ -10,6 +10,7 @@ class AddressComponent extends BaseComponent {
 		super();
 		this.tencentkey = 'RLHBZ-WMPRP-Q3JDS-V2IQA-JNRFH-EJBHL';
 		this.tencentkey2 = 'RRXBZ-WC6KF-ZQSJT-N2QU7-T5QIT-6KF5X';
+		this.tencentkey3 = 'OHTBZ-7IFRG-JG2QF-IHFUK-XTTK6-VXFBN';
 		this.baidukey = 'fjke3YUipM9N64GdOIh1DNeK2APO2WcT';
 		this.baidukey2 = 'fjke3YUipM9N64GdOIh1DNeK2APO2WcT';
 	}
@@ -28,7 +29,7 @@ class AddressComponent extends BaseComponent {
 	 		try{
 		 		let result = await this.fetch('http://apis.map.qq.com/ws/location/v1/ip', {
 		 			ip,
-		 			key: this.tencentkey2,
+		 			key: this.tencentkey,
 		 		})
 		 		if (result.status != 0) {
 		 			result = await this.fetch('http://apis.map.qq.com/ws/location/v1/ip', {
@@ -36,6 +37,12 @@ class AddressComponent extends BaseComponent {
 			 			key: this.tencentkey2,
 			 		})
 		 		}
+		 		if (result.status != 0) {
+		 			result = await this.fetch('http://apis.map.qq.com/ws/location/v1/ip', {
+			 			ip,
+			 			key: this.tencentkey3,
+			 		})
+		 		}
 		 		if (result.status == 0) {
 		 			const cityInfo = {
 		 				lat: result.result.location.lat,