Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions gaode.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module.exports = function (RED) {
}).then(function (response) {
var data = response.data
var status = data['status']
image_map = `https://restapi.amap.com/v3/staticmap?location=${data.locations}&zoom=${zoom}&size=750*500&markers=mid,,A:${data.locations}&key=${gaodeKey}`
node.log(image_map)
if (status != 1) {
throw new Error(JSON.stringify(data))
}
Expand Down Expand Up @@ -115,9 +117,16 @@ module.exports = function (RED) {
})
}).then(function (response) {
var data = response.data
var status = data['status']
if (status != 1) {
throw new Error(JSON.stringify(data))
if(config.s3){
var errcode = data['errcode']
if(errcode != 0){
throw new Error(JSON.stringify(data))
}
}else{
var status = data['status']
if (status != 1) {
throw new Error(JSON.stringify(data))
}
}

var paths = null
Expand Down Expand Up @@ -161,7 +170,7 @@ module.exports = function (RED) {
}

if (config.s3) {
return `https://restapi.amap.com/v3/direction/bicycling?origin=${locaions[0]}&destination=${locaions[1]}&key=${gaodeKey}`
return `https://restapi.amap.com/v4/direction/bicycling?origin=${locaions[0]}&destination=${locaions[1]}&key=${gaodeKey}`
}

if (config.s4) {
Expand All @@ -178,4 +187,4 @@ module.exports = function (RED) {
}
RED.nodes.registerType("gaode-server", RemoteServerNode);

}
}