<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
|
<% Session.CodePage=65001 %>
|
<% Response.charset = "utf-8" %>
|
<!--#include virtual="/weixin/OAuth2.gds"-->
|
<!--#include virtual="/inc/function.gds"-->
|
<%
|
Set rs = Server.CreateObject("ADODB.Recordset")
|
'腾讯地图
|
lbs_key="KDJBZ-45QW2-I36UJ-CB53K-OUFE5-DJBQ5"
|
|
'百度地图
|
'ak="lA7jbMtGXprDlUfbvAGNRuXm4phHhk7b" 'vicgame
|
ak="rGQBbHKGjAtVQy23OckafQkC6nNlaGmi" 'vicgame_NS1
|
|
FromLatLng=trim(Request("FromLatLng"))
|
WaypointsLatLng=trim(Request("WaypointsLatLng"))
|
ToLatLng=trim(Request("ToLatLng"))
|
|
If FromLatLng<>"" And ToLatLng<>"" And 1=2 then '腾讯地图
|
appUrl = "https://apis.map.qq.com/ws/direction/v1/driving/"
|
args1 = "from="&FromLatLng&"&to="&ToLatLng&"&key="&lbs_key
|
If WaypointsLatLng<>"" Then
|
args1 = args1&"&waypoints="&WaypointsLatLng
|
End If
|
'Response.Write appUrl&"?"&args1 &"<br><br>"
|
'Response.End
|
HTMLCODE= GetBody(appUrl,args1)
|
'Response.Write HTMLCODE &"<br><br>"
|
'Response.End
|
|
str="["&HTMLCODE&"]"
|
set obj = getjson(str)
|
status = obj.get(0).status
|
lbs_from=""
|
lbs_from_j=""
|
webJson=""
|
Dim FormArray()
|
REDIM FormArray(10,10)
|
'表头
|
If status=0 then
|
distance = obj.get(0).result.routes.get(0).distance '方案总距离
|
duration = obj.get(0).result.routes.get(0).duration '方案估算时间(含路况)
|
'Response.Write distance&","&duration &"<br><br>"
|
'Response.End
|
'webJson="{""method"":""StoreDistance"",""result"":1,""to_lat"":"""&to_lat&""",""to_lng"":"""&to_lng&"""}"
|
webJson=distance&"|"&duration
|
Else
|
webJson=0
|
End If
|
|
ElseIf FromLatLng<>"" And ToLatLng<>"" then '百度地图
|
appUrl = "https://api.map.baidu.com/directionlite/v1/driving"
|
args1 = "origin="&FromLatLng&"&destination="&ToLatLng&"&ak="&ak
|
If WaypointsLatLng<>"" Then
|
args1 = args1&"&waypoints="&Replace(WaypointsLatLng,";","|")
|
End If
|
'Response.Write appUrl&"?"&args1 &"<br><br>"
|
'Response.End
|
HTMLCODE= GetBody(appUrl,args1)
|
'Response.Write HTMLCODE &"<br><br>"
|
'Response.End
|
|
str="["&HTMLCODE&"]"
|
set obj = getjson(str)
|
status = obj.get(0).status
|
lbs_from=""
|
lbs_from_j=""
|
webJson=""
|
'表头
|
If status=0 then
|
distance = obj.get(0).result.routes.get(0).distance '方案总距离
|
duration = obj.get(0).result.routes.get(0).duration '方案估算时间(含路况)
|
'Response.Write distance&","&duration &"<br><br>"
|
'Response.End
|
'webJson="{""method"":""StoreDistance"",""result"":1,""to_lat"":"""&to_lat&""",""to_lng"":"""&to_lng&"""}"
|
webJson=distance&"|"&duration
|
Else
|
webJson=0
|
End If
|
|
Else
|
webJson=0
|
End If
|
'Response.End
|
|
Response.Write webJson
|
%>
|