以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  微信发送卡片信息无法发送  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=121416)

--  作者:xietan417
--  发布时间:2018/7/5 17:08:00
--  微信发送卡片信息无法发送
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={0}"
Dim hc As new HttpClient(Cexp(ur,Functions.Execute("GetQYAccessToken")))
Dim jo As New JObject
Dim ja As New JArray
jo("touser") = "xt"
jo("msgtype") = "textcard"
jo("agentid") = 1000015
For i As Integer = 1 To 1 \'可以一次发送最多8个图文消息,这里只发送了1个
    Dim ao As New JObject()
    ao("title") =  "特朗普" \'标题
    ao("description") = "特朗普在白宫提名尼尔·戈萨奇为美国最高法院大法官" \'描述
    ao("url") = "http://news.ifeng.com/a/20170201/50640529_0.shtml" \'连接
    ao("btntxt") = "更多" \'图片
    ja.Add(ao)
Next
jo("textcard") =  New JObject()
jo("textcard")= ja
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
If jo("errcode") = "0" Then
    MessageBox.show("消息发送成功!")
Else
    MessageBox.show(jo.ToString)
End If

这个代码发不信息!

--  作者:有点蓝
--  发布时间:2018/7/5 17:37:00
--  

jo("textcard") =  New JObject()
jo("textcard")= ja
output.show(jo.ToString()),看消息内容是什么,核对微信文档的格式看有什么不同
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
output.show(jo.ToString()),看返回什么结果
If jo("errcode") = "0" Then
    MessageBox.show("消息发送成功!")
Else
    MessageBox.show(jo.ToString)
End If

--  作者:xietan417
--  发布时间:2018/7/5 18:59:00
--  
{
  "touser": "xt",
  "msgtype": "textcard",
  "agentid": 1000015,
  "textcard": [
    {
      "title": "特朗普",
      "description": "特朗普在白宫提名尼尔·戈萨奇为美国最高法院大法官",
      "url": "http://news.ifeng.com/a/20170201/50640529_0.shtml",
      "btntxt": "更多"
    }
  ]
}
{
  "errcode": 40035,
  "errmsg": "Invalid input"
}

怎么会多了红色那个[?
[此贴子已经被作者于2018/7/5 19:01:22编辑过]

--  作者:有点甜
--  发布时间:2018/7/5 20:40:00
--  

应该是接口变了,代码改成

 

Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={0}"
Dim hc As new HttpClient(Cexp(ur,Functions.Execute("GetQYAccessToken")))
Dim jo As New JObject
Dim ja As New JArray
jo("touser") = "xt"
jo("msgtype") = "textcard"
jo("agentid") = 1000015

Dim ao As New JObject()
ao("title") =  "特朗普" \'标题
ao("description") = "特朗普在白宫提名尼尔·戈萨奇为美国最高法院大法官" \'描述
ao("url") = "http://news.ifeng.com/a/20170201/50640529_0.shtml" \'连接
ao("btntxt") = "更多" \'图片

jo("textcard")= ao
msgbox(jo.tostring)
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
If jo("errcode") = "0" Then
    MessageBox.show("消息发送成功!")
Else
    MessageBox.show(jo.ToString)
End If

 


--  作者:xietan417
--  发布时间:2018/7/5 23:52:00
--  
谢谢甜版,还有一个问题就是如何设置字体的颜色?
"description" : "<div class=\\"gray\\">2016年9月26日</div> <div class=\\"normal\\">恭喜你抽中iPhone 7一台,领奖码:xxxx</div><div class=\\"highlight\\">请于2016年10月10日前联系行政同事领取</div>",



--  作者:有点甜
--  发布时间:2018/7/6 9:15:00
--  
Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={0}"
Dim hc As new HttpClient(Cexp(ur,Functions.Execute("GetQYAccessToken")))
Dim jo As New JObject
Dim ja As New JArray
jo("touser") = "xt"
jo("msgtype") = "textcard"
jo("agentid") = 1000015
Dim ao As New JObject()
ao("title") =  "特朗普" \'标题
ao("description") = "<div class=""gray"">2016年9月26日</div> <div class=""normal"">恭喜你抽中iPhone 7一台,领奖码:xxxx</div><div class=""highlight"">请于2016年10月10日前联系行政同事领取</div>"
ao("url") = "http://news.ifeng.com/a/20170201/50640529_0.shtml" \'连接
ao("btntxt") = "更多" \'图片
jo("textcard")= ao
msgbox(jo.tostring)
hc.Content = jo.ToString()
jo = JObject.Parse(hc.GetData)
If jo("errcode") = "0" Then
    MessageBox.show("消息发送成功!")
Else
    MessageBox.show(jo.ToString)
End If

--  作者:xietan417
--  发布时间:2018/7/6 10:14:00
--  
谢谢甜版!
--  作者:yangwenghd
--  发布时间:2018/7/26 11:37:00
--  
Dim proc As new process
proc.file = "Tencent://Message/?uin=" & Tables("供应商档案").Current("联系方式_微信")
proc.start
如果设置按钮 怎么弹出微信对话框呀?感谢 感谢 

--  作者:有点甜
--  发布时间:2018/7/26 11:54:00
--  
以下是引用yangwenghd在2018/7/26 11:37:00的发言:
Dim proc As new process
proc.file = "Tencent://Message/?uin=" & Tables("供应商档案").Current("联系方式_微信")
proc.start
如果设置按钮 怎么弹出微信对话框呀?感谢 感谢 

 

没有对应的接口。无法做到。


--  作者:yangwenghd
--  发布时间:2018/7/26 11:57:00
--  
感谢 嘿嘿,谢谢