发送语音消息

@param string $toUser
@param string $media_id
@return string
761700
public function sendVoice($toUser, $media_id)
    {
        $ret = array();
        $ret['touser'] = $toUser;
        $ret['msgtype'] = 'voice';
        $ret['voice']['media_id'] = $media_id;
        return $this->send($ret);
    }
648252
public function sendVoiceByOpenid(array $toUsers, $media_id, $title = "", $description = "")
    {
        $ret = array();
        $ret['touser'] = $toUsers;
        $ret['msgtype'] = 'voice';
        $ret['voice']['media_id'] = $media_id;
        $ret['voice']['title'] = $title;
        $ret['voice']['description'] = $description;
        return $this->send($ret);
    }
930938
private function getFavMedia($each_fav, $key)
    {
        $media_id = $each_fav->find('a', 2)->href;
        $media_id = explode('/', $media_id);

        return $media_id[$key];
    }
449667
public static function generateAvatarMarkup($user_id)
    {
        $filetypes = ['jpg', 'gif', 'png'];
        $avatar_markup = '';

        foreach ($filetypes as $cur_type) {
            $path = ForumSettings::get('o_avatars_dir') . '/' . $user_id . '.' . $cur_type;

            if (file_exists(ForumEnv::get('WEB_ROOT') . $path) &&
                $img_size = getimagesize(ForumEnv::get('WEB_ROOT') . $path)
            ) {
                $avatar_markup = '<img class="avatar" src="' .
                    \RunBB\Core\Utils::escape(Container::get('url')->base() . $path . '?m=' .
                        filemtime(ForumEnv::get('WEB_ROOT') . $path)) . '" ' . $img_size[3] . ' alt="" />';
                break;
            }
        }

        return $avatar_markup;
    }
582110
public function add($id, $mediaId)
    {
        return $this->getFactory()->createResult(
            $this->getApi()->addMediaToList($id, $mediaId)
        );
    }
597490
public MpNews getMpNews(String mediaId) {
        String url = WxEndpoint.get("url.material.mpnews.get");

        String json = String.format("{\"media_id\":\"%s\"}", mediaId);
        logger.info("get mpnews: {}", json);
        String response = wxClient.post(url, json);
        return JsonMapper.defaultMapper().fromJson(response, MpNews.class);
    }
777151
public function uploadvideo($media_id, $title, $description)
    {
        if (empty($media_id)) {
            $this->setError('参数缺失');

            return false;
        }

        $queryStr                = [];
        $queryStr['media_id']    = $media_id;
        $queryStr['title']       = $title;
        $queryStr['description'] = $description;

        $res = $this->_post('uploadvideo', $queryStr);

        return $res;
    }
535451
public function sendTemplateMessage($touser, $template_id, $data, $url = null) {
		$this->getData('/cgi-bin/message/template/send', [
			'access_token' => $this->getAccessToken(),
		], Json::encode([
			'touser' => $touser,
			'template_id' => $template_id,
			'url' => $url,
			'data' => $data,
		]));

		return $this->errcode == 0;
	}
576889
public function batchSyncUser($mediaId, $callback = [])
    {
        $params = [
            'media_id' => $mediaId,
            'callback' => $callback,
        ];

        return $this->parseJSON('json', [self::API_SYNC_USER, $params]);
    }
132489
public function getItemStatus($id, $mediaId, array $parameters = [], array $headers = [])
    {
        return $this->getFactory()->createItemStatus(
            $this->getApi()->getItemStatus($id, $mediaId, $parameters, $headers)
        );
    }
320713
public function getMediaWithHttpInfo($media_id, $is_video = false)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $url_prefix = $is_video ? str_replace('https', 'http', self::API_URL_PREFIX) : self::API_URL_PREFIX;
        $url = $url_prefix . self::MEDIA_GET_URL . "access_token={$this->access_token}" . '&media_id=' . $media_id;
        $oCurl = curl_init();
        if (stripos($url, "https://") !== false) {
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($oCurl, CURLOPT_SSLVERSION, 1);
        }
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
        $sContent = curl_exec($oCurl);
        $aStatus = curl_getinfo($oCurl);
        $result = array();
        if (intval($aStatus["http_code"]) !== 200) {
            return false;
        }
        if ($sContent) {
            if (is_string($sContent)) {
                $json = json_decode($sContent, true);
                if (isset($json['errcode'])) {
                    $this->errCode = $json['errcode'];
                    $this->errMsg = $json['errmsg'];
                    return $this->checkRetry(__FUNCTION__, func_get_args());
                }
            }
            $result['content'] = $sContent;
            $result['info'] = $aStatus;
            return $result;
        }
        return false;
    }
407540
public function getUserMedia($id = 'self', $limit = 0)
    {
        $params = array();

        if ($limit > 0) {
            $params['count'] = $limit;
        }

        return $this->_makeCall('users/' . $id . '/media/recent', strlen($this->getAccessToken()), $params);
    }
324710
public function getNews($media_id = null, $all = true, $page = 1, $count = 20) {
		return $media_id ? $this->getMaterial($media_id) : $this->getMaterials('news', $all, $page, $count);
	}
1168477
public function getStory($media_id, $key, $iv) {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		// Retrieve encrypted story and decrypt.
		$blob = parent::get('/story_blob?story_id=' . $media_id);

		if (!empty($blob)) {
			return parent::decryptCBC($blob, $key, $iv);
		}

		return FALSE;
	}
1153213
public static MediaGetResult mediaGet(String access_token,String media_id){
		return mediaGet(access_token, media_id, false);
	}
268096
public function getMedia($media_id){
		if (!$this->access_token && !$this->checkAuth()) return false;
		$result = $this->http_get(self::API_URL_PREFIX.self::MEDIA_GET_URL.'access_token='.$this->access_token.'&media_id='.$media_id);
		if ($result)
		{
			$json = json_decode($result,true);
			if (isset($json['errcode'])) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			return $result;
		}
		return false;
	}
473376
public function openidVideo($media_id = '', $openids = [], $title = '', $description = '')
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['video']['media_id'] = $media_id;

        if (!empty($title)) {
            $queryStr['video']['title'] = $title;
        }

        if (!empty($description)) {
            $queryStr['video']['description'] = $description;
        }

        $queryStr['msgtype'] = 'video';

        $this->module = 'message';

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

        return $res;
    }