diff --git a/es/service/amap/Amap.d.ts b/es/service/amap/Amap.d.ts index e60bc8e..0d28b2e 100644 --- a/es/service/amap/Amap.d.ts +++ b/es/service/amap/Amap.d.ts @@ -18,5 +18,6 @@ export declare class AmapInstance { }): Promise; geocode(data: { address: string; + city?: string; }): Promise; } diff --git a/es/service/amap/Amap.js b/es/service/amap/Amap.js index e9cdd17..ddc8a32 100644 --- a/es/service/amap/Amap.js +++ b/es/service/amap/Amap.js @@ -70,8 +70,8 @@ export class AmapInstance { return jsonData; } async geocode(data) { - const { address } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${this.key}`; + const { address, city } = data; + 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/wechat/WechatMp.js b/es/service/wechat/WechatMp.js index 007a1ac..481f1e7 100644 --- a/es/service/wechat/WechatMp.js +++ b/es/service/wechat/WechatMp.js @@ -187,7 +187,7 @@ export class WechatMpInstance { const { type, media, filetype, filename } = options; const formData = new FormData(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 + contentType: filetype, filename: filename, // 微信识别需要 }); const getLength = () => { @@ -332,7 +332,7 @@ export class WechatMpInstance { body: JSON.stringify({ jump_wxa: jump_wxa, is_expire: true, - expire_type: expireType, //默认是零,到期失效的 scheme 码失效类型,失效时间类型:0,失效间隔天数类型:1 + expire_type: expireType, expire_time: expiresAt, expire_interval: expireInterval, }), diff --git a/es/service/wechat/WechatPublic.js b/es/service/wechat/WechatPublic.js index f79f3fe..2b173e9 100644 --- a/es/service/wechat/WechatPublic.js +++ b/es/service/wechat/WechatPublic.js @@ -511,8 +511,8 @@ export class WechatPublicInstance { const { type, media, description, filetype, filename, fileLength } = options; const formData = new FormData(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); if (type === 'video') { @@ -535,8 +535,8 @@ export class WechatPublicInstance { const { media, filetype, filename, fileLength } = options; const formData = new FormData(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); const headers = formData.getHeaders(); @@ -556,8 +556,8 @@ export class WechatPublicInstance { const { type, media, filetype, filename, fileLength } = options; const formData = new FormData(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); const headers = formData.getHeaders(); diff --git a/lib/service/amap/Amap.d.ts b/lib/service/amap/Amap.d.ts index e60bc8e..0d28b2e 100644 --- a/lib/service/amap/Amap.d.ts +++ b/lib/service/amap/Amap.d.ts @@ -18,5 +18,6 @@ export declare class AmapInstance { }): Promise; geocode(data: { address: string; + city?: string; }): Promise; } diff --git a/lib/service/amap/Amap.js b/lib/service/amap/Amap.js index 20217ab..dadb1aa 100644 --- a/lib/service/amap/Amap.js +++ b/lib/service/amap/Amap.js @@ -73,8 +73,8 @@ class AmapInstance { return jsonData; } async geocode(data) { - const { address } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${this.key}`; + const { address, city } = data; + 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/wechat/WechatMp.js b/lib/service/wechat/WechatMp.js index 5be8c56..cf1bf70 100644 --- a/lib/service/wechat/WechatMp.js +++ b/lib/service/wechat/WechatMp.js @@ -191,7 +191,7 @@ class WechatMpInstance { const { type, media, filetype, filename } = options; const formData = new form_data_1.default(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 + contentType: filetype, filename: filename, // 微信识别需要 }); const getLength = () => { @@ -336,7 +336,7 @@ class WechatMpInstance { body: JSON.stringify({ jump_wxa: jump_wxa, is_expire: true, - expire_type: expireType, //默认是零,到期失效的 scheme 码失效类型,失效时间类型:0,失效间隔天数类型:1 + expire_type: expireType, expire_time: expiresAt, expire_interval: expireInterval, }), diff --git a/lib/service/wechat/WechatPublic.js b/lib/service/wechat/WechatPublic.js index a598f53..1819f59 100644 --- a/lib/service/wechat/WechatPublic.js +++ b/lib/service/wechat/WechatPublic.js @@ -515,8 +515,8 @@ class WechatPublicInstance { const { type, media, description, filetype, filename, fileLength } = options; const formData = new form_data_1.default(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); if (type === 'video') { @@ -539,8 +539,8 @@ class WechatPublicInstance { const { media, filetype, filename, fileLength } = options; const formData = new form_data_1.default(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); const headers = formData.getHeaders(); @@ -560,8 +560,8 @@ class WechatPublicInstance { const { type, media, filetype, filename, fileLength } = options; const formData = new form_data_1.default(); formData.append('media', media, { - contentType: filetype, // 微信识别需要 - filename: filename, // 微信识别需要 + contentType: filetype, + filename: filename, knownLength: fileLength, }); const headers = formData.getHeaders(); diff --git a/src/service/amap/Amap.ts b/src/service/amap/Amap.ts index abeb594..40492e9 100644 --- a/src/service/amap/Amap.ts +++ b/src/service/amap/Amap.ts @@ -97,9 +97,9 @@ export class AmapInstance { return jsonData; } - async geocode(data: { address: string }) { - const { address } = data; - const url = `https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${this.key}`; + 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}`; let response: Response; try { response = await global.fetch(url);