Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] 永久素材上传视频无法上传问题 #304

Closed
yanqing6628780 opened this issue Feb 29, 2016 · 7 comments
Closed

[3.0] 永久素材上传视频无法上传问题 #304

yanqing6628780 opened this issue Feb 29, 2016 · 7 comments

Comments

@yanqing6628780
Copy link

qq 20160229123603
Http.php这个类的upload函数.要在$this->request的options参数加上'stream' => true才能上传成功
不过,这样会造成两个问题.
1.就是视频标题和视频描述的中文会转成unicode
2.微信那边没有返回media_id.虽然没有media_id但是素材是上传成功的
qq 20160229124002

从微信提供的调用示例看:
curl "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN" -F [email protected] -F description='{"title":VIDEO_TITLE, "introduction":INTRODUCTION}'
造成这个原因可能是因为那个@字符?
这条命令提交视频文件是能正确返回的media_id的.

@overtrue
Copy link
Collaborator

请尝试在 stream=true 的情况下,修改这部分代码:

https://github.com/overtrue/wechat/blob/master/src/Material/Material.php#L95-L102

为:

 $params = [
            'description' => json_encode(
                [
                    'title' => $title,
                    'introduction' => $description,
                ]
            , JSON_UNESCAPED_UNICODE),
        ];

再看看结果。

@yanqing6628780
Copy link
Author

@overtrue 这样中文没问题了.
至于第2个问题.
虽然,我能处理这个异常.但是,由于微信那边不返回media_id,你的checkAndThrow会报下面的
0-Argument 1 passed to EasyWeChat\Core\AbstractAPI::checkAndThrow() must be of the type array, boolean given
我也明白是啥原因造成的...就是不知道怎样告诉写微信接口那班操蛋的人

@overtrue
Copy link
Collaborator

@yanqing6628780 OK,就是说这样还是不返回 media_id 了嘛。

我再想想是否有其它原因。

overtrue added a commit that referenced this issue Feb 29, 2016
@overtrue overtrue closed this as completed Mar 3, 2016
@stan415
Copy link

stan415 commented Jul 4, 2018

请问这个问题解决了吗?

@overtrue
Copy link
Collaborator

overtrue commented Jul 4, 2018

@stan415 你遇到啥问题了

@stan415
Copy link

stan415 commented Jul 4, 2018

@overtrue 跟上面一样的,上传视频素材微信那边不返回media_id,checkAndThrow会报这个错
Argument 1 passed to EasyWeChat\Core\AbstractAPI::checkAndThrow() must be of the type array, boolean given

@overtrue
Copy link
Collaborator

overtrue commented Jul 4, 2018

@stan415 超时了吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants