黑名单管理

关于黑名单管理接口,参考:

https://developers.weixin.qq.com/doc/offiaccount/User_Management/Manage_blacklist.html

拉黑用户

拉黑用户的代码参考:

Dim url As String = "https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist?access_token={0}"
Dim
hc As New HttpClient(CExp(url,Functions.Execute("GetAccessToken")))
Dim
jo As New JObject
Dim
ja As New JArray
ja
.Add("ojDlHuIVSy7OUrI43K_9sTS7n8gE") '要拉黑的用户OpenID
ja
.Add("ojDlHuOzrMnI90y6P0m7uQ79eZQQ")
jo
("openid_list") = ja
hc
.Content = jo.ToString()
jo
= JObject.Parse(hc.GetData)
If
jo("errcode") = "0" Then
    MessageBox.Show("已经成功拉黑")

Else

    MessageBox.Show(jo.ToString)

End
If

取消拉黑

取消拉黑用户的代码参考:

Dim
url As String = "https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist?access_token={0}"
Dim
hc As New HttpClient(CExp(url,Functions.Execute("GetAccessToken")))
Dim
jo As New JObject
Dim
ja As New JArray
ja
.Add("oQdguwzDwS696vh5vnXU3u0aD9fk") '要取消拉黑的用户OpenID
ja
.Add("oQdguw1qKnHQu5oIew-osH6JSIZA"
jo
("openid_list") = ja
hc
.Content = jo.ToString()
jo
= JObject.Parse(hc.GetData)
If
jo("errcode") = "0" Then
    MessageBox.Show("已经取消拉黑")

Else

    MessageBox.Show(jo.ToString)

End
If

黑名单列表

要列出黑名单中的所有用户,请参考:

Dim url As String = "https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist?access_token={0}"
Dim
hc As New HttpClient(CExp(url,Functions.Execute("GetAccessToken")))
Dim
jo As New JObject
jo
("begin_openid") = ""
hc
.Content = jo.ToString()
jo
= JObject.Parse(hc.GetData)
If
jo("errcode") Is Nothing AndAlso jo("count") <> "0" Then
    Dim sb As New StringBuilder
    For Each tk As JToken In jo("data")("openid")
        sb.AppendLine(tk.Tostring)
    Next
    Output.Show(sb.ToString())

Else

    MessageBox.Show(
jo.ToString)
End
If


本页地址:http://www.foxtable.com/mobilehelp/topics/0198.htm