|
@@ -19,25 +19,11 @@ class WechatCheckSyncService
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
|
*/
|
|
|
public static function pullupload($item, $accessToken) {
|
|
|
- $client = new Client(['timeout' => 3]);
|
|
|
- $httpResult = $client->post('https://api.weixin.qq.com/wxa/sec/vod/pullupload?access_token='.$accessToken, [
|
|
|
+ $url = 'https://api.weixin.qq.com/wxa/sec/vod/pullupload?access_token='.$accessToken;
|
|
|
+ $parsedContent = self::postWechat($url, [
|
|
|
'media_name' => $item->media_name,
|
|
|
'media_url' => $item->video_url
|
|
|
]);
|
|
|
-
|
|
|
- $httpStatus = $httpResult->getStatusCode();
|
|
|
- if(200 != $httpStatus) {
|
|
|
- CommonBusinessException::throwError(Errors::REQUEST_HTTP_STATUS_ERROR);
|
|
|
- }
|
|
|
- $httpContent = $httpResult->getBody()->getContents();
|
|
|
- $parsedContent = \json_decode($httpContent, true);
|
|
|
- if(0 != ($parsedContent['errcode'] ?? 0)) {
|
|
|
- myLog('WechatCheckSync')->error('拉取上传异常', [
|
|
|
- 'series_id' => $item->id,
|
|
|
- 'errMsg' => $httpContent
|
|
|
- ]);
|
|
|
- CommonBusinessException::throwError(Errors::REQUEST_HTTP_STATUS_ERROR);
|
|
|
- }
|
|
|
return $parsedContent['task_id'];
|
|
|
}
|
|
|
|
|
@@ -109,7 +95,7 @@ class WechatCheckSyncService
|
|
|
'data' => $data,
|
|
|
'errMsg' => $httpContent
|
|
|
]);
|
|
|
- CommonBusinessException::throwError(Errors::REQUEST_HTTP_STATUS_ERROR);
|
|
|
+ CommonBusinessException::throwError(Errors::REQUEST_CODE_STATUS_ERROR);
|
|
|
}
|
|
|
|
|
|
return $parsedContent;
|