Beispiel #1
0
 function send_customized_notification($uid, $title = "优惠券承兑完成", $text = "您的快券已使用,更多优惠在等着你哦!")
 {
     try {
         $customizedcast = new AndroidCustomizedcast();
         $customizedcast->setPredefinedKeyValue("appkey", $this->appkey);
         $customizedcast->setPredefinedKeyValue("timestamp", $this->timestamp);
         $customizedcast->setPredefinedKeyValue("validation_token", $this->validation_token);
         // Set your alias here, and use comma to split them if there are multiple alias.
         // And if you have many alias, you can also upload a file containing these alias, then
         // use file_id to send customized notification.
         $customizedcast->setPredefinedKeyValue("alias", $uid);
         // Set your alias_type here
         $customizedcast->setPredefinedKeyValue("alias_type", "QuickQuan");
         $customizedcast->setPredefinedKeyValue("ticker", "快券推送");
         $customizedcast->setPredefinedKeyValue("title", $title);
         $customizedcast->setPredefinedKeyValue("text", $text);
         $customizedcast->setPredefinedKeyValue("after_open", "go_app");
         //			print("Sending customizedcast notification, please wait...\r\n");
         $customizedcast->send();
         //			print("Sent SUCCESS\r\n");
     } catch (Exception $e) {
         //			print("Caught exception: " . $e->getMessage());
     }
 }
Beispiel #2
0
 function sendAndroidCustomizedcast()
 {
     try {
         $customizedcast = new AndroidCustomizedcast();
         $customizedcast->setAppMasterSecret($this->appMasterSecret);
         $customizedcast->setPredefinedKeyValue("appkey", $this->appkey);
         $customizedcast->setPredefinedKeyValue("timestamp", $this->timestamp);
         // Set your alias here, and use comma to split them if there are multiple alias.
         // And if you have many alias, you can also upload a file containing these alias, then
         // use file_id to send customized notification.
         $customizedcast->setPredefinedKeyValue("alias", "xx");
         // Set your alias_type here
         $customizedcast->setPredefinedKeyValue("alias_type", "xx");
         $customizedcast->setPredefinedKeyValue("ticker", "Android customizedcast ticker");
         $customizedcast->setPredefinedKeyValue("title", "Android customizedcast title");
         $customizedcast->setPredefinedKeyValue("text", "Android customizedcast text");
         $customizedcast->setPredefinedKeyValue("after_open", "go_app");
         print "Sending customizedcast notification, please wait...\r\n";
         $customizedcast->send();
         print "Sent SUCCESS\r\n";
     } catch (Exception $e) {
         print "Caught exception: " . $e->getMessage();
     }
 }
Beispiel #3
0
 private static function sendAndroidCustomizedcast($uid, $ex, $test_model = 1)
 {
     $appMasterSecret = "iieluvg1vpv5on6cerjwwzn5ztnhgzjy";
     $appkey = "55f0ee86e0f55acbfd002371";
     try {
         $customizedcast = new \AndroidCustomizedcast();
         $customizedcast->setAppMasterSecret($appMasterSecret);
         $customizedcast->setPredefinedKeyValue("appkey", $appkey);
         $customizedcast->setPredefinedKeyValue("timestamp", strval(time()));
         // Set your alias here, and use comma to split them if there are multiple alias.
         // And if you have many alias, you can also upload a file containing these alias, then
         // use file_id to send customized notification.
         $customizedcast->setPredefinedKeyValue("alias", $uid);
         // Set your alias_type here
         $customizedcast->setPredefinedKeyValue("alias_type", "UID");
         $customizedcast->setPredefinedKeyValue('display_type', 'message');
         // Set 'production_mode' to 'false' if it's a test device.
         // For how to register a test device, please see the developer doc.
         if ($test_model) {
             $customizedcast->setPredefinedKeyValue("production_mode", "false");
         } else {
             $customizedcast->setPredefinedKeyValue("production_mode", "true");
         }
         $customizedcast->setPredefinedKeyValue("custom", json_encode($ex));
         // [optional]Set extra fields
         $customizedcast->setPredefinedKeyValue('description', 'V1.3' . date("Y-m-d H:i:s"));
         //            foreach ($ex as $key => $value) {
         //                // var_dump($key);
         //                //  echo "<br/>";
         //                //  var_dump($value);
         //                //  echo "<br/>";
         //                $customizedcast->setExtraField((string) $key, $value);
         //            }
         //            print("Sending customizedcast notification, please wait...\r\n");
         $customizedcast->send();
         //            print("Sent SUCCESS\r\n");
     } catch (\Exception $e) {
         //             print("Caught exception: " . $e->getMessage());
     }
 }