mirror of
https://gitee.com/zoujingli/WeChatDeveloper.git
synced 2025-04-06 03:58:03 +08:00
update WeChat/Media.php.
获取临时和永久素材时,可以直接返回组装后的素材链接。(方便将链接提交给第三方处理附件,已知七牛和讯飞可以直接处理微信的素材链接) Signed-off-by: pkkgu <910111100@qq.com>
This commit is contained in:
parent
f5123f899e
commit
649bda174c
@ -57,6 +57,7 @@ class Media extends BasicWeChat
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id={$media_id}";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
if($outType=='url') return $url;
|
||||
$result = Tools::get($url);
|
||||
if (is_array($json = json_decode($result, true))) {
|
||||
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
|
||||
@ -144,6 +145,7 @@ class Media extends BasicWeChat
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
if($outType=='url') return $url;
|
||||
$result = Tools::post($url, ['media_id' => $media_id]);
|
||||
if (is_array($json = json_decode($result, true))) {
|
||||
if (!$this->isTry && isset($json['errcode']) && in_array($json['errcode'], ['40014', '40001', '41001', '42001'])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user