Skip to content

Commit

Permalink
add status message
Browse files Browse the repository at this point in the history
  • Loading branch information
Helperhaps committed Jan 9, 2018
1 parent 5bec830 commit 3d931fb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ $report->getReceived('msg_id');
$report->getReceived(['msg_id1', 'msg_id2']);
```

#### 送达状态查询

```php
$report->getMessageStatus('msg_id0', 'rid0')
# OR
$report->getMessageStatus('msg_id0', ['rid0', 'rid1'])
#OR
$report->getMessageStatus('msg_id0', ['rid0', 'rid1'], '2017-12-21')
```

#### 获取消息统计

```php
Expand Down
13 changes: 13 additions & 0 deletions src/JPush/ReportPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ public function getReceived($msgIds) {
return Http::get($this->client, $url);
}

public function getMessageStatus($msgId, $rids, $data = null) {
$url = $this->client->makeURL('report') . ' status/message';
$registrationIds = is_array($rids) ? $rids : array($rids);
$body = [
'msg_id' => $msgId,
'registration_ids' => $registrationIds
];
if (!is_null($data)) {
$body['data'] = $data;
}
return Http::post($this->client, $url, $body);
}

public function getMessages($msgIds) {
$queryParams = '?msg_ids=';
if (is_array($msgIds) && !empty($msgIds)) {
Expand Down
2 changes: 1 addition & 1 deletion src/JPush/version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
namespace JPush;

const VERSION = '3.5.26';
const VERSION = '3.5.27';

0 comments on commit 3d931fb

Please sign in to comment.