try
Select Case e.host
Case "192.168.1.153","127.0.0.1","ycyysf.viphk.ngrok.org"
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
Dim xo As XObject = XObject.Parse(e.PlainText)
' msgbox(xo("MsgType"))
msgbox(e.PlainText)
msgbox(xo("MsgType"))
If (wechatserv IsNot Nothing And xo("MsgType")<>"event" ) 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 = "d:\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 "ApplyService.htm"
Dim wb As New WeUI
wb.AddPageTitle("","pageheader","服务申请","请选择下面的对应的服务按钮")
With wb.AddGrid("","g1")
.Add("c1","软件需求登记", "./images/button.png","DemandRegist.htm") '没有问题
.Add("c2","Cell", "./images/cell.png", "http://www.foxtable.com")
.Add("c3","Toast", "./images/toast.png", "http://www.foxtable.com")
.Add("c4","Dialog", "./images/dialog.png", "http://www.foxtable.com")
.Add("c5","Progress", "./images/progress.png", "http://www.foxtable.com")
.Add("c6","Msg", "./images/msg.png", "http://www.foxtable.com")
.Add("c7","Article", "./images/article.png", "http://www.foxtable.com")
.Add("c8","ActionSheet", "./images/actionSheet.png", "http://www.foxtable.com")
.Add("c9","Icons", "./images/icons.png", "http://www.foxtable.com")
.Add("c10","Panel", "./images/panel.png", "http://www.foxtable.com")
.Add("c11","Tab", "./images/tab.png", "http://www.foxtable.com")
.Add("c12","SearchBar", "./images/search.png", "http://www.foxtable.com")
End With
e.WriteString(wb.Build)
Case "list.htm"
Functions.Execute("List",e)
Case "addnew.htm"
Functions.Execute("AddNew",e)
Case "edit.htm"
Functions.Execute("Edit",e)
Case "delete.htm"
Functions.Execute("Delete",e)
Case "SatisSurvey.htm"
Functions.Execute("SatisSurvey",e)
Case "CCintroduction.htm"
Functions.Execute("CCintroduction",e)
Case "order1.htm"
Functions.Execute("JTweb",e)
.AddInput("sl","数量","number")
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 'e.path 的配对
End If
End Select 'e.host的配对
'记录接收的消息,方便分析
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