module WeixinAuthorize::Api::Groups

Public Instance Methods

batch_update_group_for_openids(openids, group_id) click to toggle source

批量移动用户分组

# File lib/weixin_authorize/api/groups.rb, line 42
def batch_update_group_for_openids(openids, group_id)
  group_url = "#{group_base_url}/members/batchupdate"
  http_post(group_url, {openid_list: openids, to_groupid: group_id})
end
create_group(group_name) click to toggle source

创建分组 api.weixin.qq.com/cgi-bin/groups/create?access_token=ACCESS_TOKEN

# File lib/weixin_authorize/api/groups.rb, line 8
def create_group(group_name)
  create_url = "#{group_base_url}/create"
  http_post(create_url, {group: {name: group_name}})
end
delete_group(group_id) click to toggle source
# File lib/weixin_authorize/api/groups.rb, line 47
def delete_group(group_id)
  group_url = "#{group_base_url}/delete"
  http_post(group_url, {group: {id: group_id}})
end
get_group_for(openid) click to toggle source

查询用户所在分组 api.weixin.qq.com/cgi-bin/groups/getid?access_token=ACCESS_TOKEN

# File lib/weixin_authorize/api/groups.rb, line 22
def get_group_for(openid)
  group_url = "#{group_base_url}/getid"
  http_post(group_url, {openid: openid})
end
groups() click to toggle source

查询所有分组 api.weixin.qq.com/cgi-bin/groups/get?access_token=ACCESS_TOKEN

# File lib/weixin_authorize/api/groups.rb, line 15
def groups
  groups_url = "#{group_base_url}/get"
  http_get(groups_url)
end
update_group_for_openid(openid, to_groupid) click to toggle source

移动用户分组 api.weixin.qq.com/cgi-bin/groups/members/update?access_token=ACCESS_TOKEN

# File lib/weixin_authorize/api/groups.rb, line 36
def update_group_for_openid(openid, to_groupid)
  group_url = "#{group_base_url}/members/update"
  http_post(group_url, {openid: openid, to_groupid: to_groupid})
end
update_group_name(group_id, new_group_name) click to toggle source

修改分组名 api.weixin.qq.com/cgi-bin/groups/update?access_token=ACCESS_TOKEN

# File lib/weixin_authorize/api/groups.rb, line 29
def update_group_name(group_id, new_group_name)
  group_url = "#{group_base_url}/update"
  http_post(group_url, {group: {id: group_id, name: new_group_name}})
end

Private Instance Methods

group_base_url() click to toggle source
# File lib/weixin_authorize/api/groups.rb, line 54
def group_base_url
  "/groups"
end