?/* ????* @param ????* @param 系统通知type为1 ????* @param 聊天消息 type为2 ????* @param 提醒付款 接单者确认订单 接单者取消订单 接单 type 为3 ????* @param 发单者确认完成 ?发单者支付订单 发单者取消订单 type 为4 ????* @param 充值成功 提现成功 退款成功 type为5 ????*/ ???public function ceshi_jpush(){ ???????$datas = input(‘post.‘); ???????$app_key = config("app_key"); ???????$master_secret = config("master_secret"); ???????$perinfoData = Db::table(‘shfw_member‘)->where("id",$datas["uid"])->field("re_id,token,nickname")->find(); ???????$client = new \JPush\Client($app_key, $master_secret); ???????$pusher = $client->push(); ???????if(!$perinfoData["re_id"]){ ???????????return_msg("100","re_id为空"); ???????} ???????try{ ???????????$response = $client->push() ??????????->setPlatform(array(‘ios‘, ‘android‘)) ???????????->addRegistrationId($perinfoData["re_id"]) ???????????->iosNotification($datas["content"],array( ???????????????????‘sound‘=>‘default‘, ???????????????????‘badge‘ => 2, ???????????????????‘content-available‘ => true, ???????????????????‘category‘ => ‘jiguang‘, ???????????????????"content_type"=>"1", ???????????????????‘extras‘ => [‘user_id‘=>$datas["uid"],‘type‘=>2,"nickname"=>$perinfoData["nickname"]] ???????????????) ???????????) ???????????->androidNotification($datas["content"],array( ???????????????????‘title‘ => $datas["content"], ???????????????????‘builder_id‘ => 1, ???????????????????‘extras‘ => array( ???????????????????????"user_id"=>$datas["uid"],‘type‘=>2,"nickname"=>$perinfoData["nickname"]), ???????????????) ???????????) ???????????->options([ ???????????????‘time_to_live‘ => 86400, ???????????????‘apns_production‘ => false, ???????????????‘big_push_duration‘ => 0 ???????????]) ???????????->send();// ???????return 1; ???????????return_msg("200","推送成功!"); ???}catch (APIRequestException $e) {return 2;} catch (APIConnectionException $e) { ???return 3;} ???}
PHP--极光推送
原文地址:https://www.cnblogs.com/yuancr/p/10153837.html