1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * 消息推送监听脚本
- * @author >
- */
- class PushListenerCommand extends CConsoleCommand{
- public function run($args) {
- error_reporting(E_ERROR);
- ini_set('memory_limit', '512M');
- ignore_user_abort(true);
- set_time_limit(0);
- $time_H = time();
- while (true) {
- sleep(2);
- $time = time();
- if($time - $time_H > 3600){
- exit();
- }
- //信鸽消息推送队列,
- $list = new ARedisList('xinge_push');
- $z_push = new ZPush();
- echo $list->getCount();
- while ($list->getCount() > 0) {
- try {
- $res = $list->pop();
- $data = unserialize($res);
- $result = $z_push->PushSingleAccountIOS($data['ios_data']);
- $result2 = $z_push->PushSingleAccountAndroid($data['android_data']);
- } catch (Exception $e) {
- continue;
- }
- }
- }
- }
- }
|