Commit a5e4689b authored by hujun's avatar hujun

个推模板

parent 69d9487a
<?php
namespace app\chat\utils;
use DictionaryAlertMsg;
use IGtAPNPayload;
use IGtTransmissionTemplate;
/**
* Created by PhpStorm.
......@@ -115,18 +118,34 @@ class GeTuiUtils
*/
function onlineAllTemplate($payload, $black_title, $content)
{
$template = new \IGtNotificationTemplate();
$template = new IGtTransmissionTemplate();
$template->set_appId($this->igt_app_id);//应用appid
$template->set_appkey($this->igt_app_key);//应用appkey
$template->set_transmissionType(1);//透传消息类型
$template->set_transmissionContent($payload);//透传内容
$template->set_title($black_title);//通知栏标题
$template->set_text($content);//通知栏内容
// $template->set_logo("http://wwww.igetui.com/logo.png");//通知栏logo
$template->set_isRing(true);//是否响铃
$template->set_isVibrate(true);//是否震动
$template->set_isClearable(true);//通知栏是否可清除
//$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
// APN高级推送
$apn = new IGtAPNPayload();
$alertmsg=new DictionaryAlertMsg();
$alertmsg->body=$content;
$alertmsg->actionLocKey="ActionLockey";
$alertmsg->locKey="LocKey";
$alertmsg->locArgs=array("locargs");
$alertmsg->launchImage="launchimage";
// iOS8.2 支持
$alertmsg->title=$black_title;
$alertmsg->titleLocKey="TitleLocKey";
$alertmsg->titleLocArgs=array("TitleLocArg");
$apn->alertMsg=$alertmsg;
$apn->badge=1;
$apn->sound="";
$apn->add_customMsg("payload","请填写内容");
// $apn->contentAvailable=1;
$apn->category="ACTIONABLE";
$template->set_apnInfo($apn);
return $template;
}
......
......@@ -76,10 +76,10 @@ class RPush
$payload = json_encode(array(
'title' => $title,
'content' => $msg_content,
'content' => "",
'type' => 'chat',
'url' => '',
'name' => $title,
'name' => '',
'imageUrl' => '',
'id' => 0,
'ext' => [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment