require_once (__ROOT__ . "/vendor/xinge/index.php");
require_once (__ROOT__ . "/vendor/jpush/jpush/index.php");
if($sublen==40) DemoPushSingleDeviceNotification($Registration_Id,1,$FcName,$MessengText);//添加元素
else JPushDeviceListMultipleNotification($Registration_Id,1,$FcName,$MessengText,$_POST["Tel1"]);//添加元素
}
?>
xinge
require_once ('XingeApp.php');
//单个设备下发通知消息
function DemoPushSingleDeviceNotification($CID,$PlatForm,$FcName,$UserText)
{
$push = new XingeApp(2104563460, '01536b093fafb86bbe92b8095582692f');
$mess = new Message();
$mess->setType(Message::TYPE_NOTIFICATION);
$mess->setTitle($FcName);
$mess->setContent($UserText);
$mess->setExpireTime(86400);
//$style = new Style(0);
#含义:样式编号0,响铃,震动,不可从通知栏清除,不影响先前通知
$style = new Style(0,1,1,0,0);
$action = new ClickAction();
$action->setActionType(ClickAction::TYPE_URL);
$action->setUrl("http://www.qiyeim.com");
#打开url需要用户确认
$action->setComfirmOnUrl(1);
$custom = array('key1'=>'value1', 'key2'=>'value2');
$mess->setStyle($style);
$mess->setAction($action);
$mess->setCustom($custom);
$acceptTime1 = new TimeInterval(0, 0, 23, 59);
$mess->addAcceptTime($acceptTime1);
$ret = $push->PushSingleDevice($CID, $mess);
return($ret);
}
//大批量下发给设备 android
//iOS 请构建MessageIOS 消息
function DemoPushDeviceListMultipleNotification($deviceList,$PlatForm,$FcName,$UserText)
{
$push = new XingeApp(2104563460, '01536b093fafb86bbe92b8095582692f');
$mess = new Message();
$mess->setType(Message::TYPE_NOTIFICATION);
$mess->setExpireTime(86400);
$mess->setTitle($FcName);
$mess->setContent($UserText);
$mess->setType(Message::TYPE_NOTIFICATION);
$ret = $push->CreateMultipush($mess);
if (!($ret['ret_code'] === 0))
return $ret;
else
{
$result=array();
array_push($result, $push->PushDeviceListMultiple($ret['result']['push_id'], $deviceList));
return ($result);
}