You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.9 KiB
66 lines
2.9 KiB
2 months ago
|
<?php
|
||
|
namespace LaneWeChat\Core;
|
||
|
|
||
|
class UserManage{
|
||
|
public static function createGroup($groupName){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/groups/create?access_token=' . $accessToken;
|
||
|
$data = '{"group":{"name":"' . $groupName . '"}}';
|
||
|
return Curl::callWebServer($queryUrl, $data, 'POST');
|
||
|
}
|
||
|
|
||
|
public static function getGroupList(){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/groups/get?access_token=' . $accessToken;
|
||
|
$data = '';
|
||
|
return Curl::callWebServer($queryUrl, $data, 'GET');
|
||
|
}
|
||
|
|
||
|
public static function getGroupByOpenId($openId){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/groups/getid?access_token=' . $accessToken;
|
||
|
$data = '{"openid":"' . $openId . '"}';
|
||
|
return Curl::callWebServer($queryUrl, $data, 'POST');
|
||
|
}
|
||
|
|
||
|
public static function editGroupName($groupId, $groupName){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/groups/update?access_token=' . $accessToken;
|
||
|
$data = '{"group":{"id":' . $groupId . ',"name":"' . $groupName . '"}}';
|
||
|
return Curl::callWebServer($queryUrl, $data, 'POST');
|
||
|
}
|
||
|
|
||
|
public static function editUserGroup($openid, $to_groupid){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=' . $accessToken;
|
||
|
$data = '{"openid":"' . $openid . '","to_groupid":' . $to_groupid . '}';
|
||
|
return Curl::callWebServer($queryUrl, $data, 'POST');
|
||
|
}
|
||
|
|
||
|
public static function getUserInfo($openId){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $accessToken . '&openid=' . $openId;
|
||
|
return Curl::callWebServer($queryUrl, '', 'GET');
|
||
|
}
|
||
|
|
||
|
public static function getFansList($next_openid=''){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
if(empty($next_openid)){
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . $accessToken;
|
||
|
}else{
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . $accessToken . '&next_openid=' . $next_openid;
|
||
|
}
|
||
|
return Curl::callWebServer($queryUrl, '', 'GET');
|
||
|
}
|
||
|
|
||
|
public static function setRemark($openId, $remark){
|
||
|
$accessToken = AccessToken::getAccessToken();
|
||
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=' . $accessToken;
|
||
|
$data = json_encode(array('openid'=>$openId, 'remark'=>$remark));
|
||
|
return Curl::callWebServer($queryUrl, $data, 'POST');
|
||
|
}
|
||
|
|
||
|
public static function getNetworkState(){
|
||
|
echo "WeixinJSBridge.invoke('getNetworkType',{},function(e){WeixinJSBridge.log(e.err_msg);});";
|
||
|
}
|
||
|
}
|