% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<% Session.CodePage=65001 %>
<% Response.charset = "utf-8" %>
<%
lbs_key="KDJBZ-45QW2-I36UJ-CB53K-OUFE5-DJBQ5"
city=trim(Request("city"))
keyword=trim(Request("keyword"))
LatLng=trim(Request("LatLng"))
title=trim(Request("title"))
address=trim(Request("address"))
If title<>"" And address<>"" And LatLng<>"" Then
'地址记录
CAMEmap=Request.Cookies("CAMEmap")
If CAMEmap<>"" Then
CAMEmapPS = SPLIT(CAMEmap,"|")
CAMEmap=""
for i = 0 to UBOUND(CAMEmapPS)
If CAMEmapPS(i)<>"" And i<10 Then
CAMEmapPSa = SPLIT(CAMEmapPS(i),":")
If CAMEmapPSa(0)<>title Then
CAMEmap=CAMEmap&"|"&CAMEmapPS(i)
End If
End If
Next
CAMEmap=title&":"&address&":"&LatLng&CAMEmap
Response.Cookies("CAMEmap")=CAMEmap
Else
CAMEmap=title&":"&address&":"&LatLng
Response.Cookies("CAMEmap")=CAMEmap
End If
Response.Cookies("CAMEmap").Expires=date+365
webJson=CAMEmap
ElseIf keyword<>"" Then
'地址查询
If city="" Then city="广州"
appUrl = "https://apis.map.qq.com/ws/place/v1/suggestion/"
args1 = "keyword="&keyword&"&key="&lbs_key
If city<>"" Then args1 = args1&"®ion="&city
'Response.Write appUrl&"?"&args1 &"
"
'Response.End
HTMLCODE= GetBody(appUrl,args1)
webJson=HTMLCODE
Else
'显示历史地址
CAMEmap=Request.Cookies("CAMEmap")
If CAMEmap<>"" Then
CAMEmapPS = SPLIT(CAMEmap,"|")
webJson="{""status"": 0,""message"":""query ok"",""count"": 0,""data"": ["
for i = 0 to UBOUND(CAMEmapPS)
If CAMEmapPS(i)<>"" And i<10 Then
CAMEmapPSa = SPLIT(CAMEmapPS(i),":")
If CAMEmapPSa(0)<>title Then
webJson=webJson&"{""title"":"""&CAMEmapPSa(0)&""",""address"":"""&CAMEmapPSa(1)&""",""location"":{""lat"":"&Replace(CAMEmapPSa(2),",",",""lng"":")&"}},"
End If
End If
Next
webJson=webJson&"],""request_id"":""0""}"
webJson=Replace(webJson,",]","]")
Else
webJson="{""status"": 0,""message"":""query ok"",""count"": 0,""data"": [],""request_id"":""0""}"
End If
End If
Response.Write webJson
%>