修改了Amap中的一些小bug
This commit is contained in:
parent
1db861e71c
commit
1270466056
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export default class MapWorldInstance {
|
||||
key: string;
|
||||
constructor(key: string);
|
||||
geo(): void;
|
||||
regeo(): void;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
export default class MapWorldInstance {
|
||||
key;
|
||||
constructor(key) {
|
||||
this.key = key;
|
||||
}
|
||||
geo() {
|
||||
}
|
||||
regeo() {
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export default class MapWorldInstance {
|
||||
key: string;
|
||||
constructor(key: string);
|
||||
geo(): void;
|
||||
regeo(): void;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
export default class MapWorldInstance {
|
||||
key: string;
|
||||
constructor(key: string) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
geo() {
|
||||
|
||||
}
|
||||
|
||||
regeo() {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue