|
|
@@ -80,13 +80,15 @@ class pushNotice
|
|
|
$rand = rand(1000, 9999);
|
|
|
$rId = $time . $rand . $adminId;
|
|
|
$push = new GTPushRequest();
|
|
|
- $push->setRequestId($rId);
|
|
|
+ $push->setRequestId(self::micro_time());
|
|
|
$push->setSettings($set);
|
|
|
|
|
|
$message = new GTPushMessage();
|
|
|
$notify = new GTNotification();
|
|
|
$notify->setTitle($title);
|
|
|
$notify->setBody($body);
|
|
|
+ $notify->setChannelId('channelId1');
|
|
|
+ $notify->setChannelName('channelName1');
|
|
|
$notify->setChannelLevel(4);
|
|
|
|
|
|
//点击通知后续动作,目前支持以下后续动作:
|
|
|
@@ -99,7 +101,8 @@ class pushNotice
|
|
|
|
|
|
//厂商推送消息参数
|
|
|
$pushChannel = new GTPushChannel();
|
|
|
- //ios
|
|
|
+
|
|
|
+ // ------------- ios ---------------
|
|
|
$ios = new GTIos();
|
|
|
$ios->setType("notify");
|
|
|
$ios->setAutoBadge("1");
|
|
|
@@ -113,8 +116,8 @@ class pushNotice
|
|
|
$aps->setThreadId("threadId");
|
|
|
|
|
|
$alert = new GTAlert();
|
|
|
- $alert->setTitle("alert title");
|
|
|
- $alert->setBody("alert body");
|
|
|
+ $alert->setTitle($title);
|
|
|
+ $alert->setBody($body);
|
|
|
$alert->setActionLocKey("ActionLocKey");
|
|
|
$alert->setLocKey("LocKey");
|
|
|
$alert->setLocArgs(array("LocArgs1","LocArgs2"));
|
|
|
@@ -127,7 +130,7 @@ class pushNotice
|
|
|
$aps->setAlert($alert);
|
|
|
$ios->setAps($aps);
|
|
|
|
|
|
- $multimedia = new GTMultimedia();
|
|
|
+ /*$multimedia = new GTMultimedia();
|
|
|
$multimedia->setUrl("url");
|
|
|
$multimedia->setType(1);
|
|
|
$multimedia->setOnlyWifi(false);
|
|
|
@@ -136,29 +139,34 @@ class pushNotice
|
|
|
$multimedia2->setType(2);
|
|
|
$multimedia2->setOnlyWifi(true);
|
|
|
$ios->setMultimedia(array($multimedia));
|
|
|
- $ios->addMultimedia($multimedia2);
|
|
|
+ $ios->addMultimedia($multimedia2);*/
|
|
|
$pushChannel->setIos($ios);
|
|
|
+ // ------------- ios end ---------------
|
|
|
+
|
|
|
|
|
|
- //安卓
|
|
|
+ // ----------------- 安卓 -----------------
|
|
|
$android = new GTAndroid();
|
|
|
$ups = new GTUps();
|
|
|
- // $ups->setTransmission("ups Transmission");
|
|
|
+ //$ups->setTransmission("ups Transmission");
|
|
|
+ $ups->addOption("HW","badgeAddNum",1);
|
|
|
+ //$ups->addOption("OP","channel","Default");
|
|
|
+ //$ups->addOption("OP","aaa","bbb");
|
|
|
+ //$ups->addOption(null,"a","b");
|
|
|
+
|
|
|
$thirdNotification = new GTThirdNotification();
|
|
|
$thirdNotification->setTitle($title);
|
|
|
- $thirdNotification->setBody("body".self::micro_time());
|
|
|
- $thirdNotification->setClickType(GTThirdNotification::CLICK_TYPE_URL);
|
|
|
- $thirdNotification->setIntent("intent:#Intent;component=你的包名/你要打开的 activity 全路径;S.parm1=value1;S.parm2=value2;end");
|
|
|
- $thirdNotification->setUrl("http://docs.getui.com/getui/server/rest_v2/push/");
|
|
|
- $thirdNotification->setPayload("payload");
|
|
|
- $thirdNotification->setNotifyId(456666);
|
|
|
- $ups->addOption("HW","badgeAddNum",1);
|
|
|
- $ups->addOption("OP","channel","Default");
|
|
|
- $ups->addOption("OP","aaa","bbb");
|
|
|
- $ups->addOption(null,"a","b");
|
|
|
+ $thirdNotification->setBody("body-".self::micro_time().': ' . $body);
|
|
|
+ $thirdNotification->setClickType(GTThirdNotification::CLICK_TYPE_STAERAPP);
|
|
|
+ //$thirdNotification->setIntent("intent:#Intent;component=你的包名/你要打开的 activity 全路径;S.parm1=value1;S.parm2=value2;end");
|
|
|
+ //$thirdNotification->setUrl("http://docs.getui.com/getui/server/rest_v2/push/");
|
|
|
+ //$thirdNotification->setPayload("payload");
|
|
|
+ $thirdNotification->setNotifyId(self::micro_time());
|
|
|
|
|
|
$ups->setNotification($thirdNotification);
|
|
|
$android->setUps($ups);
|
|
|
$pushChannel->setAndroid($android);
|
|
|
+ // ----------------- 安卓 end -----------------
|
|
|
+
|
|
|
$push->setPushChannel($pushChannel);
|
|
|
|
|
|
|