您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 德州分类信息网,免费分类信息发布

微信公众号实现用户管理功能

2024/7/6 5:50:12发布75次查看
1、设置用户备注名接口:https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=access_token
updateremark.php
<?php require_once("../utils.php"); $data = '{ "openid":"o4wmz0h-4hubuvquczx2ezaxil9c", "remark":"jhon" }'; $url = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{"errcode":0,"errmsg":"ok"}



2、获取用户基本信息接口:https://api.weixin.qq.com/cgi-bin/user/info?access_token=access_token&openid=openid&lang=zh_cn
userinfp.php
<?php require_once("../utils.php"); $openid = "o4wmz0h-4hubuvquczx2ezaxil9c"; $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" .utils::get_access_token()."&openid=".$openid."&lang=zh_cn "; $result = utils::https_request($url); echo $result;
返回:
{ "subscribe": 1, "openid": "o4wmz0h-4hubuvquczx2ezaxil9c", "nickname": "promise", "sex": 1, "language": "zh_cn", "city": "", "province": "", "country": "", "headimgurl": "http://wx.qlogo.cn/mmopen/vq7pmkmoamygtqnjbrdesiantxgggkliaoi3stutng5dua1oyaetlodjicyhu9ekmvly2gxf7rhbzgniapodyvmz0onegm7pfgbb/0", "subscribe_time": 1504708412, "remark": "jhon", "groupid": 0, "tagid_list": [] }
3、批量获取用户消息接口:https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=access_token
batchget.php
<?php require_once("../utils.php"); $data = '{ "user_list": [ { "openid": "o4wmz0h-4hubuvquczx2ezaxil9c", "lang": "zh_cn" } ] }'; $url = "https://api.weixin.qq.com/cgi-bin/user/info/batchget?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{ "user_info_list": [ { "subscribe": 1, "openid": "o4wmz0h-4hubuvquczx2ezaxil9c", "nickname": "promise", "sex": 1, "language": "zh_cn", "city": "", "province": "", "country": "", "headimgurl": "http://wx.qlogo.cn/mmopen/vq7pmkmoamygtqnjbrdesiantxgggkliaoi3stutng5dua1oyaetlodjicyhu9ekmvly2gxf7rhbzgniapodyvmz0onegm7pfgbb/0", "subscribe_time": 1504708412, "remark": "jhon", "groupid": 0, "tagid_list": [] } ] }
4、创建标签接口:https://api.weixin.qq.com/cgi-bin/tags/create?access_token=access_token
tags_create.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "tag" : { "name" : "朋友" } }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/create?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{ "tag": { "id": 101, "name": "朋友" } }
5、获取以创建标签接口:https://api.weixin.qq.com/cgi-bin/tags/get?access_token=access_token
tags_get.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token=" .utils::get_access_token(); $result = utils::https_request($url); echo $result;
返回:
{ "tags": [ { "id": 2, "name": "星标组", "count": 0 }, { "id": 100, "name": "同学", "count": 0 }, { "id": 101, "name": "朋友", "count": 0 } ] }
6、编辑标签接口:https://api.weixin.qq.com/cgi-bin/tags/update?access_token=access_token
tags_update.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "tag" : { "id" : 101, "name" : "好朋友" } }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/update?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{"errcode":0,"errmsg":"ok"}



7、删除标签当某个标签下的粉丝超过10w时,后台不可直接删除标签。此时,开发者可以对该标签下的openid列表,先进行取消标签的操作,直到粉丝数不超过10w后,才可直接删除该标签。
接口:https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=access_token
tags_delete.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "tag" : { "id" : 101 } }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/delete?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{"errcode":0,"errmsg":"ok"}



8、批量为用户打标签标签功能目前支持公众号为用户打上最多20个标签。
接口:https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=access_token
tags_batchtagging.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "openid_list" : [ "o4wmz0h-4hubuvquczx2ezaxil9c" ], "tagid" : 100 }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回结果:
{"errcode":0,"errmsg":"ok"}
9、获取标签下粉丝列表接口:https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=access_token
"next_openid":""//第一个拉取的openid,不填默认从头开始拉取
tags_get_user.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "tagid" : 100, "next_openid":"" }'; $url = "https://api.weixin.qq.com/cgi-bin/user/tag/get?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{ "count": 1, "data": { "openid": [ "o4wmz0h-4hubuvquczx2ezaxil9c" ] }, "next_openid": "o4wmz0h-4hubuvquczx2ezaxil9c" }
10、获取用户身上的标签列表接口;https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=access_token
tags_getidlist.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "openid" : "o4wmz0h-4hubuvquczx2ezaxil9c" }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/getidlist?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{ "tagid_list": [ 100 ] }
11、批量为用户取消标签
接口:https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=access_token
tags_batchuntagging.php
<?php @header('content-type: text/plain;charset=utf-8'); require_once("../utils.php"); $data = '{ "openid_list" : [ "o4wmz0h-4hubuvquczx2ezaxil9c" ], "tagid" : 100 }'; $url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?" ."access_token=".utils::get_access_token(); $result = utils::https_request($url, $data); echo $result;
返回:
{"errcode":0,"errmsg":"ok"}



以上就是微信公众号实现用户管理功能的详细内容。
德州分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录