コード例 #1
0
 /**
  * 极光推送统计
  * @param array $msg_ids 需要统计的消息id
  * @param int $app_type_id 应用id 默认为大厨商城app
  */
 public function stats(array $msg_ids, $app_type_id = 1)
 {
     list($appkey, $secret) = $this->_get_appkey($app_type_id);
     if (empty($appkey) || empty($secret)) {
         echo 'empty appkey';
         return;
     }
     $br = '<br/>';
     $client = new JPushClient($appkey, $secret);
     try {
         $result = $client->report($msg_ids);
         foreach ($result->received_list as $received) {
             echo '---------' . $br;
             echo 'msg_id : ' . $received->msg_id . $br;
             echo 'android_received : ' . $received->android_received . $br;
             echo 'ios_apns_sent : ' . $received->ios_apns_sent . $br;
         }
     } catch (APIRequestException $e) {
         echo 'Push Fail.' . $br;
         echo 'Http Code : ' . $e->httpCode . $br;
         echo 'code : ' . $e->code . $br;
         echo 'message : ' . $e->message . $br;
         echo 'Response JSON : ' . $e->json . $br;
         echo 'rateLimitLimit : ' . $e->rateLimitLimit . $br;
         echo 'rateLimitRemaining : ' . $e->rateLimitRemaining . $br;
         echo 'rateLimitReset : ' . $e->rateLimitReset . $br;
     } catch (APIConnectionException $e) {
         echo 'Push Fail.' . $br;
         echo 'message' . $e->getMessage() . $br;
     }
 }
コード例 #2
0
ファイル: ReportTest.php プロジェクト: Maplecms/shopnc-api
 public function testReportMore()
 {
     $client = new JPushClient($this->appKey, $this->masterSecret);
     $result = $client->report('769835449,1093175430');
     $this->assertTrue($result->isOk === true);
 }
コード例 #3
0
ファイル: pushReport.php プロジェクト: bmchun/sunset
<?php

require_once '../../third_party/vendor/autoload.php';
use JPush\Model as M;
use JPush\JPushClient;
use JPush\Exception\APIConnectionException;
use JPush\Exception\APIRequestException;
$br = '<br/>';
$app_key = '74a7874f76fa5eb4e6baa6b3';
$master_secret = 'd50c83278b63a7b004da7364';
$client = new JPushClient($app_key, $master_secret);
try {
    $msg_ids = '2969371506';
    $result = $client->report($msg_ids);
    foreach ($result->received_list as $received) {
        echo '---------' . $br;
        echo 'msg_id : ' . $received->msg_id . $br;
        echo 'android_received : ' . $received->android_received . $br;
        echo 'ios_apns_sent : ' . $received->ios_apns_sent . $br;
    }
} catch (APIRequestException $e) {
    echo 'Push Fail.' . $br;
    echo 'Http Code : ' . $e->httpCode . $br;
    echo 'code : ' . $e->code . $br;
    echo 'message : ' . $e->message . $br;
    echo 'Response JSON : ' . $e->json . $br;
    echo 'rateLimitLimit : ' . $e->rateLimitLimit . $br;
    echo 'rateLimitRemaining : ' . $e->rateLimitRemaining . $br;
    echo 'rateLimitReset : ' . $e->rateLimitReset . $br;
} catch (APIConnectionException $e) {
    echo 'Push Fail.' . $br;