|
@@ -229,7 +229,9 @@ class VPush
|
|
|
if (empty($tag) || empty($regIds)) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+ if (!is_array($regIds)){
|
|
|
+ $regIds = [$regIds];
|
|
|
+ }
|
|
|
// token授权
|
|
|
$this->getAccessToken();
|
|
|
|
|
@@ -335,20 +337,24 @@ class VPush
|
|
|
// 组装请求数据
|
|
|
$authToken = $this->_accessToken;
|
|
|
$option = ['json' => $sendData];
|
|
|
-
|
|
|
- // 请求
|
|
|
- $client = new Client(['timeout' => 5.0, 'headers' => ['authToken' => $authToken]]);
|
|
|
- if ($method === 'POST') {
|
|
|
- $response = $client->request('POST', $url, $option);
|
|
|
- } else {
|
|
|
- $response = $client->request('GET', $url);
|
|
|
+ try {
|
|
|
+
|
|
|
+ // 请求
|
|
|
+ $client = new Client(['timeout' => 5.0, 'headers' => ['authToken' => $authToken]]);
|
|
|
+ if ($method === 'POST') {
|
|
|
+ $response = $client->request('POST', $url, $option);
|
|
|
+ } else {
|
|
|
+ $response = $client->request('GET', $url);
|
|
|
+ }
|
|
|
+
|
|
|
+ $body = $response->getBody()->__toString();
|
|
|
+ $result = json_decode($body, true);
|
|
|
+ myLog('push')->info('[VIVO] getDataByInfo', compact('url', 'option', 'authToken', 'result'));
|
|
|
+ return $result;
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ myLog('vivo-push-erro')->info('[VIVO] getDataByInfo', compact('url', 'option', 'authToken', 'result'));
|
|
|
+ return [];
|
|
|
}
|
|
|
-
|
|
|
- $body = $response->getBody()->__toString();
|
|
|
- $result = json_decode($body, true);
|
|
|
-
|
|
|
- myLog('push')->info('[VIVO] getDataByInfo', compact('url', 'option', 'authToken', 'result'));
|
|
|
- return $result;
|
|
|
}
|
|
|
}
|
|
|
|