测试个性化菜单匹配结果

@since 0.0.1
@param {string} $openid OpenID或微信号
@return {array}
@example \Yii::$app->wechat->tryMatchMenu($openid);
491309
public function tryMatchMenu($openid) {
		$data = $this->getData('/cgi-bin/menu/trymatch', [
			'access_token' => $this->getAccessToken(),
		], Json::encode(['user_id' => $openid]));

		return $this->errcode == 0 ? $data : [];
	}
61038
public function get_auth_user($openid , $access_token , $lang = 'zh_CN'){

        $url = self::API_URI . self::AUTH_USER_URI;
        $param['access_token'] = $access_token;
        $param['openid'] = $openid;
        $param['lang'] = $lang;

        $user_info_url = $this->create_url($url, $param);
        $data = $this->http_get($user_info_url);

        return $this->return_data($data);
    }
477278
public function getInfo($id)
	{
		$send_snoopy = new Snoopy; 
		$send_snoopy->rawheaders['Cookie']= $this->cookie;
		$t = time().strval(mt_rand(100,999));
		$send_snoopy->referer = "https://mp.weixin.qq.com/cgi-bin/getmessage?t=wxm-message&lang=zh_CN&count=50&token=".$this->_token;
		$submit = "https://mp.weixin.qq.com/cgi-bin/getcontactinfo";
		$post = array('ajax'=>1,'lang'=>'zh_CN','random'=>'0.'.$t,'token'=>$this->_token,'t'=>'ajax-getcontactinfo','fakeid'=>$id);
		$send_snoopy->submit($submit,$post);
		$this->log($send_snoopy->results);
		$result = json_decode($send_snoopy->results,true);
		if(isset($result['contact_info'])){
			return $result['contact_info'];
		}
		return false;
	}
583858
public function toOpenId($userId, $agentId)
    {
        $params = [
            'userid'  => $userId,
            'agentid' => $agentId,
        ];

        return $this->parseJSON('json', [self::API_TO_OPENID, $params]);
    }
600827
public function getUser($userId)
    {
        $result = $this->httpGet(self::WECHAT_USER_GET_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'userid' => $userId
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok' ? $result : false;
    }
858012
private function getAuthorizerAccessToken($uid) {
        $access_token = false;
        #获取数据信息
        $info = $this->getUidAppid($uid);
        if ($info && $info['expire_time'] < time()) {
            $component_access_token = $this->componentAccessToken();
            #提交URL地址
            $url  = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token=$component_access_token";
            $res  = to_array($this->httpGet($url));
            $data = array(
                "component_appid"          => C("wechat", "componentAppid"),
                "authorizer_appid"         => $info['authorizer_appid'],
                "authorizer_refresh_token" => $info['authorizer_refresh_token'],
            );
            #返回Token信息
            $access_token = $res['authorizer_access_token'];
            if ($access_token) {
                $info['expire_time']              = time() + 7000;
                $info['authorizer_access_token']  = $access_token;
                $info['authorizer_refresh_token'] = $res['authorizer_refresh_token'];
                F($key, to_json($info));
            }
        } else {
            $access_token = $data['authorizer_access_token'];
        }
        return $access_token;
    }
764455
public function getUser(string $openID)
    {
        return self::$curl->post(self::USER_TAG.self::$access_token, json_encode([
                'openid' => $openID,
            ]
        ));
    }
93099
public function userInfo($openId) {
        $user = $this->getInfo()->parameters([
            'openid' => $openId
        ])->json();
        if (!array_key_exists('nickname', $user)) {
            return false;
        }
        $user['username'] = $user['nickname'];
        $user['avatar'] = $user['headimgurl'];
        return $user;
    }
45320
public function getBatchUserInfo(array $openids, $lang = 'zh_CN')
    {
        $url = 'https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN';
        $data = ['user_list' => []];
        foreach ($openids as $openid) {
            $data['user_list'][] = ['openid' => $openid, 'lang' => $lang];
        }
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
184159
public function getUserInfo(string $openId, string $lang = 'zh_CN')
    {
        return $this->curl->get(self::GET.$this->access_token.'&'.http_build_query([
                    'openid' => $openId,
                    'lang' => $lang,
                ]
            ));
    }
236118
public function getUserList($next_openid = '')
    {
        $url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid={$next_openid}";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpGetForJson($url);
    }
579020
protected static function cgi_userinfo_uri($access_token, $openid, $lang = 'zh_CN')
    {
        $param = [
            'access_token' => $access_token,
            'openid' => $openid,
            'lang' => $lang,
        ];

        return self::CGI_USERINFO_URI . http_build_query($param);
    }
760310
public function getUserList($next_openid = '')
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_URL_PREFIX . self::USER_GET_URL . "access_token={$this->access_token}&next_openid={$next_openid}");
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json;
        }
        return false;
    }
119306
public function openidText($content = '', $openids = [])
    {
        $queryStr                    = [];
        $queryStr['touser']          = $openids;
        $queryStr['text']['content'] = $content;
        $queryStr['msgtype']         = 'text';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
863195
public function getUserInfo($openid)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_URL_PREFIX . self::USER_INFO_URL . "access_token={$this->access_token}&openid={$openid}");
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json;
        }
        return false;
    }
464861
public function isAttention($openid = '') {
        try {
            $access_token = $this->getAccessToken();
            #设置URL地址
            $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=$access_token&openid=$openid&lang=zh_CN";
            #提交数据
            $res = to_array($this->httpGet($url));
            if (isset($res['subscribe'])) {
                return $res;
            } else {
                throw new Exception($res['errmsg'], $res['errcode']);
            }
        } catch (Exception $e) {
            debug::exception($e);
        }
    }
381934
public function getUserBatchInfo(array $openids, $lang = 'zh_CN')
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $data = array('user_list' => array());
        foreach (array_unique($openids) as $openid) {
            $data['user_list'][] = array('openid' => $openid, 'lang' => $lang);
        }
        $result = Tools::httpPost(self::API_URL_PREFIX . self::USER_BATCH_INFO_URL . "access_token={$this->access_token}", Tools::json_encode($data));
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode']) || !isset($json['user_info_list'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json['user_info_list'];
        }
        return false;
    }