分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

PHP--极光推送

发布时间:2023-09-06 02:27责任编辑:彭小芳关键词:PHP
 ?/* ????* @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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved