请提出具体的问题!改起来什么地方有问题?
比如服务端接收聊天窗口信息后,wechatReceivedMessage事件:
'处理接收到客户端的消息,然后转发到指定用户微信'
Dim userid = e.WeChatID
If e.ContentType = 0 Then '本例子只处理文本消息
Dim drUser As DataRow = DataTables("微信用户").Find(CExp("[_Identify]={0} ",userid))
If drUser IsNot Nothing Then
Dim text = WeChat.SendMessageHelper.GetSendMessage(WeChat.ApiType.MP, "text")
text.touser = drUser("OpenID")
text.AddContent(e.Content)
Dim weRet = WeChat.WeChatServer.Server(Vars("mpappid")).SendMsgController.SendMessage(text.ToJson(True)) '发送消息到微信
If not weRet.Success Then
Functions.Execute("logText",weRet.ErrorMessage & "|" & text.ToJson(True))
End If
End If
End If
改为
Dim userid = e.WeChatID
If e.ContentType = 0 Then '本例子只处理文本消息
Dim drUser As DataRow = DataTables("微信用户").Find(CExp("[_Identify]={0} ",userid))
If drUser IsNot Nothing Then
Dim jo As New JObject
jo("touser") = drUser("OpenID")
jo("msgtype") = "text"
jo("text") = New JObject
jo("text")("content") = e.Content
Dim URL As String = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"
Dim hc As New HttpClient(CExp(URL, Functions.Execute("GetAccessToken")))
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData())
If jo("errcode") <> "0" Then
Functions.Execute("logText",jo("errmsg") & "|" & text.ToJson(True))
End If
End If
End If