分享自己封装的微信公众号类 基于ThinkPHP5.1
<?php
namespace app\util;
use think\Controller;
class Wxutil
{
public function check(){
$param = input('param.');
$signature = $param['signature'];
$timestamp = $param['timestamp'];
$nonce = $param['nonce'];
$echostr = $param['echostr'];
$system = FF('config/wxconfig');
$arrayname = array($timestamp,$nonce,$system['token']);
sort($arrayname, SORT_STRING);
$temp = implode($arrayname);
$temp = sha1($temp);
if($temp==$signature){
return $echostr;
}else{
return false;
exit;
}
}
public function reponseMsg(){
$postArr = file_get_contents('php://input');
$postobj = simplexml_load_string($postArr);
$rx_type = strtolower($postobj->MsgType);
switch($rx_type){
case 'event':
$resultStr = $this->handleEvent($postobj);
break;
case 'text':
$resultStr = $this->handleText($postobj);
break;
case 'image':
$resultStr = $this->sendutypeal($postobj);
break;
case 'voice':
$resultStr = $this->sendutypeal($postobj);
break;
case 'video':
$resultStr = $this->sendutypeal($postobj);
break;
case 'shortvideo':
$resultStr = $this->sendutypeal($postobj);
break;
case 'location':
$resultStr = $this->sendutypeal($postobj);
break;
case 'link':
$resultStr = $this->sendutypeal($postobj);
break;
default:
$resultStr = "Unknow msg type: ".$rx_type;
}
echo $resultStr;
}
public function handleEvent($object)
{
$contentStr = "";
$rx_type = strtolower($object->Event);
switch($rx_type){
case "subscribe":
$type = 2;
$data = $this->getfolwlist($type);
if($data){
echo $this->sendFormUser($data['type'], $data['reply'],$object);
}
break;
case 'unsubscribe':
$keyword = '取消关注';
$data = [
['keyword'=>'取消关注','reply'=>'谢谢关注','type'=>'text'],
];
break;
case 'scan':
echo $this->responseText($object,'您已经关注过楼');
case 'click':
return $this->checkClick($object,$object->EventKey);
break;
case 'location':
file_put_contents('dlwz.json', '{"latitude": "'.$object->Latitude.'", "wd": '.$object->Longitude.'}');
return $this->responseText($object,'您地址的经纬度为'.$object->Latitude.','.$object->Longitude);
break;
default;
}
if($data){
$is_keyw = $this->is_keyword($keyword,$data);
if(!$is_keyw){
$contentStr = $keyword;
echo $this->responseText($object,$contentStr);
}else{
$is_str = $this->is_keytype($is_keyw,$data);
switch ($is_str){
case 'text':
echo $this->responseText($object,$is_keyw);
break;
case 'imagtext':
echo $this->handleImtw($object,$is_keyw);
break;
case 'voice':
echo $this->handlevoice($object,$is_keyw);
break;
case 'image':
echo $this->responseimg($object,$is_keyw);
break;
case 'video':
echo $this->handlvideo($object,$is_keyw);
break;
case 'music':
echo $this->handmusic($object,$is_keyw);
break;
default;
}
}
}
}
public function messageToUserName($content){
$userlist = $this->getuserlist();
$acctoken = $this->getWxAccessToken();
$data = [
'touser' => 'otFQV1U8ud9-it0i67eQd223GWvU',
'msgtype' => 'text',
'text' => [
'content' => iconv("ISO-8859-1","UTF-8",$content),
]
];
$url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$acctoken;
$result = $this->http_curl($url,'post','json',json_encode($data));
return $result;
}
public function checkClick($postobj,$eventkey){
$menulist = $this->getmenuclick($eventkey);
$data = $menulist['reply'];
return $this->handleImtw($postobj,$data);
}
public function receiveVoice($postobj){
$recogniton = $postobj->Recognition;
return $this->responseText($postobj,$recogniton);
}
public function sendutypeal($postobj){
$type = 2;
$data = $this->getautolist($type);
echo $this->sendFormUser($data['type'],$data['reply'],$postobj);
}
public function handleText($postobj)
{
$keyword = trim($postobj->Content);
if(!empty( $keyword )){
$data = $this->getkeywordlist();
echo $this->sendofuserda($postobj,$keyword,$data);
}
}
public function sendofuserda($postobj,$keyword,$data){
$is_keyw = $this->is_keyword($keyword,$data);
if(!$is_keyw){
$type = 2;
$data = $this->getautolist($type);
if($data){
return $this->sendFormUser($data['type'],$data['reply'],$postobj);
}
}else{
$is_str = $this->is_keytype($is_keyw,$data);
return $this->sendFormUser($is_str,$is_keyw,$postobj);
}
}
public function sendFormUser($is_str,$is_keyw,$postobj){
switch ($is_str){
case 'text':
return $this->responseText($postobj,$is_keyw);
break;
case 'imagtext':
echo $this->handleImtw($postobj,$is_keyw);
break;
case 'voice':
echo $this->handlevoice($postobj,$is_keyw);
break;
case 'image':
echo $this->responseimg($postobj,$is_keyw);
break;
case 'video':
echo $this->handlvideo($postobj,$is_keyw);
break;
case 'music':
echo $this->handmusic($postobj,$is_keyw);
break;
default;
}
}
public function is_keyword($keyword,$data){
foreach($data as $key=>$value){
if(strpos($value['keyword'],$keyword) !== false){
return $value['reply'];
}
}
return false;
}
public function is_keytype($is_keyw,$data){
foreach($data as $key=>$value){
if($is_keyw==$value['reply']){
return $value['type'];
}
}
}
public function handleImtw($postobj,$data){
$str = "";
foreach ($data as $key => $value) {
$str.="<item>
<Title><![CDATA[".$value['Title']."]]></Title>
<Description><![CDATA[".$value['Description']."]]></Description>
<PicUrl><![CDATA[".$value['PicUrl']."]]></PicUrl>
<Url><![CDATA[".$value['Url']."]]></Url>
</item>";
}
$xml=' <xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%d</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>'.count($data).'</ArticleCount>
<Articles>
'.$str.'
</Articles>
</xml> ';
echo sprintf($xml,$postobj->FromUserName,$postobj->ToUserName,time());
}
public function handleImage($postobj){
$fromUsername = $postobj->FromUserName;
$toUsername = $postobj->ToUserName;
$mediaid = $postobj->MediaId;
$textTpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%d</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<Image>
<MediaId><![CDATA[%s]]></MediaId>
</Image>
</xml>";
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, time(),$mediaid);
echo $resultStr;
}
public function responseText($object, $content, $flag=0)
{
$textTpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[%s]]></Content>
<FuncFlag>%d</FuncFlag>
</xml>";
$resultStr = sprintf($textTpl, $object->FromUserName, $object->ToUserName, time(), $content, $flag);
return $resultStr;
}
public function responseimg($object,$mid)
{
$texttpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<Image>
<MediaId><![CDATA[%s]]></MediaId>
</Image>
</xml>";
$resultStr = sprintf($texttpl, $object->FromUserName, $object->ToUserName,time(),$mid);
return $resultStr;
}
public function handlevoice($object,$mid){
$texttpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<Voice>
<MediaId><![CDATA[%s]]></MediaId>
</Voice>
</xml>";
$resultStr = sprintf($texttpl, $object->FromUserName, $object->ToUserName,time(),$mid);
return $resultStr;
}
public function handlvideo($object,$vodo){
$texttpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<Video>
<MediaId><![CDATA[%s]]></MediaId>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
</Video>
</xml>";
$resultStr = sprintf($texttpl, $object->FromUserName, $object->ToUserName,time(),$vodo['mid'],$vodo['title'],$vodo['description']);
return $resultStr;
}
public function handmusic($object,$vodo){
$texttpl = "<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[music]]></MsgType>
<Music>
<Title><![CDATA[%s]]></Title>
<Description><![CDATA[%s]]></Description>
<MusicUrl><![CDATA[%s]]></MusicUrl>
<HQMusicUrl><![CDATA[%s]]></HQMusicUrl>
</Music>
</xml>";
file_put_contents('121212.txt',$vodo);
$resultStr = sprintf($texttpl,$object->FromUserName,$object->ToUserName,time(),$vodo['title'],$vodo['description'],$vodo['musicurl'],$vodo['musicurl']);
file_put_contents('121212.txt',$resultStr);
return $resultStr;
}
public function getuserinfo($object){
$AccessToken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=$AccessToken&openid=$object->FromUserName&lang=zh_CN";
$userinfo = $this->http_curl($url,'get','json');
return $userinfo;
}
public function definedItem($postArr){
header('content-type:text/html;charset=utf-8');
$access_token = $this ->getWxAccessToken();
$url ='https://api.weixin.qq.com/cgi-bin/menu/create?access_token='.$access_token;
$postJson = urldecode(json_encode($postArr));
$res = $this->http_curl($url,'post','json',$postJson);
return $res;
}
public function getusermenu(){
header('content-type:text/html;charset=utf-8');
$access_token = $this ->getWxAccessToken();
$url ='https://api.weixin.qq.com/cgi-bin/menu/get?access_token='.$access_token;
$res = $this->http_curl($url,'post','json');
return $res;
}
public function delusermenu(){
header('content-type:text/html;charset=utf-8');
$access_token = $this ->getWxAccessToken();
$url ='https://api.weixin.qq.com/cgi-bin/menu/delete?access_token='.$access_token;
$res = $this->http_curl($url,'post','json');
return $res;
}
public function http_curl($url,$type='get',$res='json',$arr=''){
$ch =curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if($type == 'post'){
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$arr);
}
$output =curl_exec($ch);
if($res=='json'){
if(curl_error($ch)) {
return curl_error($ch);
}else{
return json_decode($output,true);
}
}
curl_close($ch);
echo var_dump($output);
}
public function http_tourl($url,$type='get',$arr=''){
$ch =curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if($type == 'post'){
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$arr);
}
$output =curl_exec($ch);
curl_close($ch);
return $output;
}
public function getWxAccessToken(){
$res = file_get_contents('access_token.json');
$result = json_decode($res, true);
return $result["access_token"];
}
public function clear_quea(){
header('content-type:text/html;charset=utf-8');
$access_token = $this ->getWxAccessToken();
$url ='https://api.weixin.qq.com/cgi-bin/clear_quota?access_token='.$access_token;
$appid = ['appid' => 'wxe6c34af4726ebd5b'];
$arr = json_encode($appid,true);
$res = $this->http_curl($url,'post','json',$arr);
var_dump($res);
}
public function getuserlist(){
$getWxAccessToken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=".$getWxAccessToken;
$res = $this->http_curl($url);
return $res['data'];
}
public function sendText($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=$access_token";
$getuserlist = $this->getuserlist();
$arr = array(
'touser'=> $getuserlist['openid'],
'msgtype'=>'text',
'text'=>array('content'=> iconv("ISO-8859-1","UTF-8",$content)),
);
$dataJson = json_encode($arr);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function sendtimg($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=$access_token";
$getuserlist = $this->getuserlist();
$arr = array(
'touser'=> $getuserlist['openid'],
'msgtype'=>'mpnews',
'send_ignore_reprint' => 0,
'mpnews'=>array('media_id'=> $content),
);
$dataJson = json_encode($arr);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function sendImage($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=$access_token";
$getuserlist = $this->getuserlist();
$arr = array(
'touser'=> $getuserlist['openid'],
'msgtype'=>'image',
'image'=>array('media_id' => $content),
);
$dataJson = json_encode($arr);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function sendvoice($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=$access_token";
$getuserlist = $this->getuserlist();
$arr = array(
'touser'=> $getuserlist['openid'],
'msgtype'=>'voice',
'voice'=>array('media_id' => $content),
);
$dataJson = json_encode($arr);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function sendvideo($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=$access_token";
$getuserlist = $this->getuserlist();
$arr = array(
'touser'=> $getuserlist['openid'],
'msgtype'=>'mpvideo',
'mpvideo'=>array('media_id' => $content,'title'=>'test','description'=>'test'),
);
$dataJson = json_encode($arr);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function uploadsendvideo($content){
$access_token = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadvideo?access_token=$access_token";
$dataJson = json_encode($content);
$res = $this->http_curl($url,'post','json',$dataJson);
return $res;
}
public function userRecord(){
}
public function addmember(){
}
public function temporarydata($type,$weburl){
$accesstoken = $this->getWxAccessToken();
$url = 'https://api.weixin.qq.com/cgi-bin/media/upload?access_token='.$accesstoken.'&type='.$type;
$path = array('media' => new \CURLFile(realpath($weburl['tmp_name']),$weburl['type'],$weburl['name']));
$resulf = $this->http_curl($url,'post','json',$path);
return $resulf;
}
public function gettemporarylist($mediaid){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token=".$accesstoken."&media_id=".$mediaid;
return $url;
}
public function gettemporaryVoice($mediaid){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=".$accesstoken."&media_id=".$mediaid;
return $url;
}
public function permanenimgtex($json){
$accesstoken = $this->getWxAccessToken();
$url = 'https://api.weixin.qq.com/cgi-bin/material/add_news?access_token='.$accesstoken;
$resulf = $this->http_curl($url,'post','json',$json);
return $resulf;
}
public function permanendata($path,$type,$title="",$dis=""){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=".$accesstoken."&type=".$type;
if($type=="video"){
$b = json_encode(array('title'=>$title, 'introduction'=>$dis));
$res = array('media' => new \CURLFile(realpath($path['tmp_name']),$path['type'],$path['name']),'description'=>$b);
$is_send = $this->http_curl($url,'post','json',$res);
}else{
$data = array('media' => new \CURLFile(realpath($path['tmp_name']),$path['type'],$path['name']));
$is_send = $this->http_curl($url,'post','json',$data);
}
return $is_send;
}
public function permanentlist($media){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=" .$accesstoken;
$arr = json_encode(array('media_id' => $media));
$res = $this->http_tourl($url,'post',$arr);
return $res;
}
public function permanentdel($media){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=".$accesstoken;
$arr = json_encode(array('media_id' => $media),true);
$res = $this->http_curl($url,'post','json',$arr);
return $res;
}
public function parmanentedit($json){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/update_news?access_token=" .$accesstoken;
$resulf = $this->http_curl($url,'post','json',$json);
return $resulf;
}
public function parmanentcount(){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token=" .$accesstoken;
$res = $this->http_curl($url);
return $res;
}
public function materiallist($param){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=" .$accesstoken;
$arr = json_encode(array('type' => $param['type'],'offset'=>$param['offset'],'count'=>$param['count']));
$res = $this->http_curl($url,'post','json',$arr);
return $res;
}
public function autoreply(){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=".$accesstoken;
$res = $this->http_curl($url);
}
public function getkeywordlist(){
$keywordarr = db('hinge_reply')->field('keyword,reply,type')->select();
foreach($keywordarr as $key => $value){
if($value['type']=='imagtext' || $value['type']=='video' || $value['type']=='music'){
$keywordarr[$key]['reply'] = json_decode($value['reply'],true);
}
}
return $keywordarr;
}
public function getautolist($type){
if($type==2){
$keywordarr = db('auto_reply')->where(['is_open'=>1])->field('reply,type')->find();
if(!$keywordarr){
$keywordarr = db('auto_reply')->where(['is_open'=>2])->field('reply,type')->find();
}
if($keywordarr['type']=='imagtext' || $keywordarr['type']=='video' || $keywordarr['type']=='music'){
$keywordarr['reply'] = json_decode($keywordarr['reply'],true);
}
}else{
$keywordarr = db('auto_reply')->select();
}
return $keywordarr;
}
public function getfolwlist($type){
if($type==2){
$keywordarr = db('follow_reply')->where(['is_open'=>1])->field('reply,type')->find();
if($keywordarr['type']=='imagtext' || $keywordarr['type']=='video' || $keywordarr['type']=='music'){
$keywordarr['reply'] = json_decode($keywordarr['reply'],true);
}
}else{
$keywordarr = db('follow_reply')->select();
}
return $keywordarr;
}
public function getmenuclick($even){
$menulist = db('menu_list')->where(['dentif'=>$even,'is_default'=>0])->field('dentif,reply,type')->find();
if(!$menulist){
$menulist = db('menu_list')->where(['dentif'=>$even,'is_default'=>1])->field('dentif,reply,type')->find();
}
$menulist['reply'] = json_decode($menulist['reply'],true);
return $menulist;
}
public function uploadimgs($data,$dataname){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=".$accesstoken;
$res = $this->http_curl($url,'post','json',array('media' => new \CURLFile($data,'image/jpeg',$dataname)));
return $res;
}
public function uploadimgtext($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=".$accesstoken;
$res = $this->http_curl($url,'post','json',$data);
return $res;
}
public function delmasscl($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=".$accesstoken;
$urarr = json_encode($data);
$res = $this->http_curl($url,'post','json',$urarr);
return $res;
}
public function getmasscl($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=".$accesstoken;
$urarr = json_encode($data);
$res = $this->http_curl($url,'post','json',$urarr);
return $res;
}
public function creategroup($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token=".$accesstoken;
$dataarr = [
'tag' => [
'name' => $data,
]
];
$res = $this->http_curl($url,'post','json',json_encode($dataarr));
return $res;
}
public function getgroup(){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token=".$accesstoken;
$res = $this->http_curl($url,'get','json');
return $res;
}
public function editgroup($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/update?access_token=".$accesstoken;
$dataarr = [
'tag' => [
'id' => $data['id'],
'name' => $data['name'],
]
];
$res = $this->http_curl($url,'post','json',json_encode($dataarr));
return $res;
}
public function delgroup($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=".$accesstoken;
$dataarr = [
'tag' => [
'id' => $data['id'],
]
];
$res = $this->http_curl($url,'post','json',json_encode($dataarr));
return $res;
}
public function getusergroup($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=".$accesstoken;
$dataarr = [
'tagid' => $data['tagid'],
'next_openid' => $data['next_openid'],
];
$res = $this->http_curl($url,'post','json',json_encode($dataarr));
return $res;
}
public function createtagging($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=".$accesstoken;
$data1 = [
'openid_list' => json_decode($data['openid_list']),
'tagid' => $data['tagid'],
];
$data1 = json_encode($data1);
$res = $this->http_curl($url,'post','json',$data1);
return $res;
}
public function deltagging($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=".$accesstoken;
$data1 = [
'openid_list' => json_decode($data['openid_list']),
'tagid' => $data['tagid'],
];
$data1 = json_encode($data1);
$res = $this->http_curl($url,'post','json',$data1);
return $res;
}
public function getidlistuser($data){
$accesstoken = $this->getWxAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=".$accesstoken;
$dataarr = [
'openid' => $data,
];
$res = $this->http_curl($url,'post','json',json_encode($dataarr));
return $res;
}
}