修改了Amap中的一些小bug

This commit is contained in:
Xu Chang 2024-11-24 16:17:46 +08:00
parent 1db861e71c
commit 1270466056
8 changed files with 57 additions and 3 deletions

View File

@ -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);

6
es/service/mapWorld/mapWorld.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export default class MapWorldInstance {
key: string;
constructor(key: string);
geo(): void;
regeo(): void;
}

View File

@ -0,0 +1,10 @@
export default class MapWorldInstance {
key;
constructor(key) {
this.key = key;
}
geo() {
}
regeo() {
}
}

View File

@ -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);

6
lib/service/mapWorld/mapWorld.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export default class MapWorldInstance {
key: string;
constructor(key: string);
geo(): void;
regeo(): void;
}

View File

@ -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;

View File

@ -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);

View File

@ -0,0 +1,14 @@
export default class MapWorldInstance {
key: string;
constructor(key: string) {
this.key = key;
}
geo() {
}
regeo() {
}
}