标签:notify over not extra _id sage als err tle
require ‘./data/jpush/autoload.php‘;
$master_secret = ‘5d561fe4042e4fe3ccc06a4e‘;
$app_key=‘6089a3bc7cb29c8b72b4e21d‘;
$client = new \JPush\Client($app_key, $master_secret);
$message = "请支付货款";
try {
$tmp = $client->push()
->setPlatform(‘all‘)
->addAlias($res["uid"])
->setNotificationAlert($message)
->addAndroidNotification($message, $message, 1,array("ty"=>10,"type"=>$res["type"],"uid"=>$res["uid"],"order_id"=>$res["order_id"]))
->addIosNotification($message, ‘default‘, ‘+1‘, true, ‘iOS category‘,array("ty"=>10,"type"=>$res["type"],"uid"=>$res["uid"],"order_id"=>$res["order_id"]))
->setOptions($sendno = 12, $time_to_live = null, $override_msg_id = null, $apns_production = false, $big_push_duration = null)
->send();
$data["tongzhi_time"] = time();
$data["ctime"] = time();
$data["is_tongzhi"] = 1;
$data["static"] = 6;
M("order")->where("order_id=‘$order‘")->save($data);
$dat["type"] = 1;
$dat["u_type"] = 1;
$dat["m_type"] = 3;
$dat["uid"] = $res["uid"];
$dat["title"] = $message;
$dat["d_id"] = $res["order_id"];
$dat["ctime"] = time();
M("message")->add($dat);
} catch (\JPush\Exceptions\APIConnectionException $e) {
// try something here
print $e;
} catch (\JPush\Exceptions\APIRequestException $e) {
// try something here
print $e;
}
json(200);
//安卓 和demo中一样
->androidNotification($message, array(
‘title‘ => $message,
‘sound‘ => "./public/jpush/notify.mp3",
‘o_id‘ => $o_id,
// ‘build_id‘ => 2,
// ‘extras‘ => array(
// ‘key‘ => ‘value‘,
// ‘jiguang‘
// ),
))
标签:notify over not extra _id sage als err tle
原文地址:http://www.cnblogs.com/jhy-ocean/p/6178818.html