zoukankan      html  css  js  c++  java
  • 极光推送

    require './data/jpush/autoload.php';
                 $master_secret = '5d561fe4042e4fe3ccc06a4e';
                 $app_key='6089a3bc7cb29c8b72b4e21d';
                 $client = new JPushClient($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 (JPushExceptionsAPIConnectionException $e) {
                    // try something here
                    print $e;
                } catch (JPushExceptionsAPIRequestException $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'
                                // ),
                            ))

  • 相关阅读:
    问卷调查
    20145104张家明 《Java程序设计》第6周学习总结
    20145104张家明 《Java程序设计》第2周学习总结
    20145104张家明 《Java程序设计》第一周学习总结
    20145104张家明 《Java程序设计》第3周学习总结
    socketserver OSError:[Errno 98] Address already in use
    psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"
    nginx 配置nginx.conf
    css 一些常用属性总结
    在ie中用滤镜 (filter:progid:DXImageTransform.Microsoft.gradient)会触发overflow:hidden?
  • 原文地址:https://www.cnblogs.com/jhy-ocean/p/6178818.html
Copyright © 2011-2022 走看看