try
Select Case e.host
Case "192.168.3.6","127.0.0.1","glsafe1.free.ngrok.cc"
Dim dr As DataRow
Dim url As String
Dim wechatserv As WeChat.WeChatPublicNo
If e.Path > "" Then
url = "http://" & e.host & "/" & e.Path.replace("\\","/").replace("\'","\'\'").replace("""","""""") & "/"
wechatserv = Functions.Execute("WeChat_GetServerByUrl",url) \'查询是否有此地址的微信公众号
End If
If wechatserv IsNot Nothing Then \'说明是微信接口回调消息
wechatserv.ProcessMessage(e,"WeChat_ProcessRequestMsg") \'处理消息并获取返回值
\'Functions.Execute("LogText","回复=" & weRet)
Else
\'通用事件头
\'如果网页路径定义了中间目录,如"ordertest/logon.htm" ,则下面的fl实际就是"d:\\web\\ordertest\\weui\\weui.me.js"
\'因此你需要把WeUI框架三个文件复制到"d:\\web\\ordertest\\weui"目录下
Dim fl As String = "C:\\web\\" & e.path
If filesys.FileExists(fl)
Dim idx As Integer = fl.LastIndexOf(".")
Dim ext As String = fl.SubString(idx)
Select Case ext
Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
e.WriteFile(fl)
Return \'这里必须返回
End Select
End If
Select Case e.Path
Case "gettoken" \'做为AccessToken中控服务
Dim atoken As WeChat.AccessToken = WeChat.WeChatAccessTokenController.GetServiceAccessToken(e.PlainText)
e.WriteString(atoken.ToJson()) \'返回access_token的JSON数据
Case "scanlogon" \'做为AccessToken中控服务
Functions.Execute("Http_ScanLogon" ,e)
Case Else
If e.Path.StartsWith("ordertest\\") Then \'公众号订单测试地址前缀都统一使用这个
Functions.Execute("Order_HttpRequest",e)
ElseIf e.Path.StartsWith("review\\") Then \'企业号订单审核地址前缀都统一使用这个
Functions.Execute("Order_HttpReview",e)
End If
End Select
End If
End Select
\'记录接收的消息,方便分析
Dim str As new StringBuilder
\'str.AppendLine("host=" & e.host)
str.AppendLine("path=" & e.Path)
str.AppendLine("HttpMethod=" & e.Request.HttpMethod)
\'str.AppendLine("poststring=" & e.PlainText)
\'str.AppendLine("ip=" & e.Request.RemoteEndPoint().Address.ToString())
For Each key As String In e.Values.Keys
str.AppendLine(key & "=" & e.Values(key))
Next
Functions.Execute("logText",str.ToString)
catch ex As Exception
Functions.Execute("LogText",ex)
e.WriteString("")
End Try