以第一段代码为例
内部函数:
Dim str As String = Args(0)
Dim xo As XObject = XObject.Parse(str)
Dim st As New Date(1970,1,1,8,0,0)
Select Case xo("MsgType")
Case "text","image","voice","video","shortvideo" '为了简单,这里只保存文本?图片?语音和视频消息.
Dim dr As DataRow = DataTables("Message").AddNew()
dr("FromUserName") = xo("FromUserName")
dr("CreateTime") = st.AddSeconds(xo("CreateTime"))
dr("MsgType") = xo("MsgType")
dr("MsgId") = xo("MsgId")
dr("MediaId") = xo("MediaId")
dr("ThumbMediaId") = xo("ThumbMediaId")
dr("PicUrl") = xo("PicUrl")
dr("Content") = xo("Content")
dr("Format") = xo("Format")
dr("Recognition") = xo("Recognition")
dr.Save()
End Select
HttpRequest事件代码改为
Select Case e.path
Case "wefox"
If e.Request.HttpMethod = "GET"
If Functions.Execute("VerifySignature",e) Then
e.WriteString(e.GetValues("echostr"))
End If
ElseIf e.Request.HttpMethod = "Post"
Functions.Execute("函数名称",e.PlainText)
End If
End Select