|
@@ -115,6 +115,7 @@ class VPush
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 全量发送(默认是每个app每日可发送一条。)
|
|
|
* @return mixed
|
|
|
* @throws GuzzleException
|
|
|
*/
|
|
@@ -137,12 +138,36 @@ class VPush
|
|
|
return $this->getData(config('push.vivo.sendAll'), $data);
|
|
|
}
|
|
|
|
|
|
- public function getStatistics()
|
|
|
+ public function addTagForUsers($tag, $regIds)
|
|
|
{
|
|
|
+ if (empty($tag) || empty($regIds)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
// token授权
|
|
|
$this->getAccessToken();
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取消息推送的统计值接口
|
|
|
+ * @param $taskIds
|
|
|
+ * @return array|mixed
|
|
|
+ * @throws GuzzleException
|
|
|
+ */
|
|
|
+ public function getStatistics($taskIds)
|
|
|
+ {
|
|
|
+ if (empty($taskIds)) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // token授权
|
|
|
+ $this->getAccessToken();
|
|
|
+
|
|
|
+ // 拼接链接
|
|
|
+ $url = config('push.vivo.getStatistics');
|
|
|
+ $url .= '?taskIds=' . implode(',', $taskIds);
|
|
|
|
|
|
+ return $this->getData($url, [], 'GET');
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -217,12 +242,9 @@ class VPush
|
|
|
{
|
|
|
// 组装请求数据
|
|
|
$option = ['json' => $sendData];
|
|
|
- if ($this->_accessToken) {
|
|
|
- $option['headers']['auth_token'] = $this->_accessToken;
|
|
|
- }
|
|
|
|
|
|
// 请求
|
|
|
- $client = new Client(['timeout' => 10.0]);
|
|
|
+ $client = new Client(['timeout' => 10.0, 'headers' => ['auth_token' => $this->_accessToken]]);
|
|
|
if ($method === 'POST') {
|
|
|
$response = $client->request('POST', $url, $option);
|
|
|
} else {
|