thinkphp实现极光推送

Posted wpfphp

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了thinkphp实现极光推送相关的知识,希望对你有一定的参考价值。

function tuis($con,$uid,$ty,$type,$order_id)
   $registrationid = registrationid($uid);
   if(empty($registrationid))
      return false;
   require './data/jpush/autoload.php';
   $master_secret = C("master_secret");
   $app_key=C("app_key");
    $client = new \\JPush\\Client($app_key, $master_secret);
   $tmp = $client->push()
   ->setPlatform('all')
   ->addRegistrationId($registrationid)
//    ->addAlias($uid)
   ->setNotificationAlert($con)
   ->addandroidNotification($con, $con, 1, array("type"=>$ty,"order_type"=>$type,"uid"=>$uid,"order_id"=>$order_id))
   ->addiosNotification($con, 'default', 0, true, 'iOS category', array("type"=>$ty,"order_type"=>$type,"uid"=>$uid,"order_id"=>$order_id))
   ->setOptions($sendno = 10, $time_to_live = null, $override_msg_id = null, $apns_production = true, $big_push_duration = null)
   ->send();
   $data["type"] = 1;
   $data["u_type"] = 1;
   $data["m_type"] = 3;
   $data["uid"] = $uid;
    $data["title"]="订单推送";
   $data["content"] = $con;
   $data["d_id"] = $order_id;
   $data["ctime"] = time();
   M("message")->add($data);

以上是关于thinkphp实现极光推送的主要内容,如果未能解决你的问题,请参考以下文章

APP的消息推送(极光推送)

极光PHP SDK 3.5.1版本,在Thinkphp3.2.3中集成使用

TP5中使用极光推送3.5.12

#yyds干货盘点#手机APP消息推送极光推送jpush-php实例

极光推送_总结_01_Java实现极光推送

极光征文 如何实现Emoji表情的推送😆