diff --git a/es/service/amap/Amap.js b/es/service/amap/Amap.js index ddc8a32..fbf691d 100644 --- a/es/service/amap/Amap.js +++ b/es/service/amap/Amap.js @@ -71,7 +71,7 @@ export class AmapInstance { } async geocode(data) { const { address, city } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `$city=${city}` : ''}&key=${this.key}`; + const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `&city=${city}` : ''}&key=${this.key}`; let response; try { response = await global.fetch(url); diff --git a/es/service/mapWorld/mapWorld.d.ts b/es/service/mapWorld/mapWorld.d.ts new file mode 100644 index 0000000..e457d5b --- /dev/null +++ b/es/service/mapWorld/mapWorld.d.ts @@ -0,0 +1,6 @@ +export default class MapWorldInstance { + key: string; + constructor(key: string); + geo(): void; + regeo(): void; +} diff --git a/es/service/mapWorld/mapWorld.js b/es/service/mapWorld/mapWorld.js new file mode 100644 index 0000000..3259238 --- /dev/null +++ b/es/service/mapWorld/mapWorld.js @@ -0,0 +1,10 @@ +export default class MapWorldInstance { + key; + constructor(key) { + this.key = key; + } + geo() { + } + regeo() { + } +} diff --git a/lib/service/amap/Amap.js b/lib/service/amap/Amap.js index dadb1aa..3d352f7 100644 --- a/lib/service/amap/Amap.js +++ b/lib/service/amap/Amap.js @@ -74,7 +74,7 @@ class AmapInstance { } async geocode(data) { const { address, city } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `$city=${city}` : ''}&key=${this.key}`; + const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `&city=${city}` : ''}&key=${this.key}`; let response; try { response = await global.fetch(url); diff --git a/lib/service/mapWorld/mapWorld.d.ts b/lib/service/mapWorld/mapWorld.d.ts new file mode 100644 index 0000000..e457d5b --- /dev/null +++ b/lib/service/mapWorld/mapWorld.d.ts @@ -0,0 +1,6 @@ +export default class MapWorldInstance { + key: string; + constructor(key: string); + geo(): void; + regeo(): void; +} diff --git a/lib/service/mapWorld/mapWorld.js b/lib/service/mapWorld/mapWorld.js new file mode 100644 index 0000000..5101714 --- /dev/null +++ b/lib/service/mapWorld/mapWorld.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class MapWorldInstance { + key; + constructor(key) { + this.key = key; + } + geo() { + } + regeo() { + } +} +exports.default = MapWorldInstance; diff --git a/src/service/amap/Amap.ts b/src/service/amap/Amap.ts index 40492e9..6f82f9c 100644 --- a/src/service/amap/Amap.ts +++ b/src/service/amap/Amap.ts @@ -97,9 +97,14 @@ export class AmapInstance { return jsonData; } + /** + * 高德这个接口搜索能力很弱,但高级接口要收费,只能先暂时用着 + * @param data + * @returns + */ async geocode(data: { address: string, city?: string }) { const { address, city } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `$city=${city}` : ''}&key=${this.key}`; + const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}${city ? `&city=${city}` : ''}&key=${this.key}`; let response: Response; try { response = await global.fetch(url); diff --git a/src/service/mapWorld/mapWorld.ts b/src/service/mapWorld/mapWorld.ts new file mode 100644 index 0000000..c3cae30 --- /dev/null +++ b/src/service/mapWorld/mapWorld.ts @@ -0,0 +1,14 @@ +export default class MapWorldInstance { + key: string; + constructor(key: string) { + this.key = key; + } + + geo() { + + } + + regeo() { + + } +} \ No newline at end of file