public function run(&$params)
 {
     if (C('UPGRADE_NOTICE_ON') && (!S('think_upgrade_interval') || C('UPGRADE_NOTICE_DEBUG'))) {
         if (IS_SAE && C('UPGRADE_NOTICE_QUEUE') && !isset($_POST['think_upgrade_queque'])) {
             $queue = new SaeTaskQueue(C('UPGRADE_NOTICE_QUEUE'));
             $queue->addTask('http://' . $_SERVER['HTTP_HOST'] . __APP__, 'think_upgrade_queque=1');
             if (!$queue->push()) {
                 trace('升级提醒队列执行失败,错误原因:' . $queue->errmsg(), '升级通知出错', 'NOTIC', true);
             }
             return;
         }
         $akey = C('UPGRADE_NOTICE_AKEY', null, '');
         $skey = C('UPGRADE_NOTICE_SKEY', null, '');
         $this->accesskey_ = $akey ? $akey : (defined('SAE_ACCESSKEY') ? SAE_ACCESSKEY : '');
         $this->secretkey_ = $skey ? $skey : (defined('SAE_SECRETKEY') ? SAE_SECRETKEY : '');
         $current_version = C('UPGRADE_CURRENT_VERSION', null, 0);
         //读取接口
         $info = $this->send('http://sinaclouds.sinaapp.com/thinkapi/upgrade.php?v=' . $current_version);
         if ($info['version'] != $current_version) {
             if ($this->send_sms($info['msg'])) {
                 trace($info['msg'], '升级通知成功', 'NOTIC', true);
             }
             //发送升级短信
         }
         S('think_upgrade_interval', true, C('UPGRADE_NOTICE_CHECK_INTERVAL', null, 604800));
     }
 }
示例#2
0
function TimingTask()
{
    // load urls
    $mysql = new SaeMysql();
    $sql = "SELECT url FROM `url`";
    $data = $mysql->getData( $sql );
    $mysql->closeDb();

    $queue = new SaeTaskQueue('task_queue_0_2');
    $array = array();
    for($i = 0; $i < sizeof($data); ++$i)
    {
        //$array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php", "postdata"=>"target=".$data[$i], "prior"=>true);
        $array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php?target=" . $data[$i]["url"], "postdata"=>NULL, "prior"=>true);
    }
    
    $queue->addTask($array);

    $ret = $queue->push();
    if ($ret === false)
    {
        var_dump($queue->errno(), $queue->errmsg());
        echo "Failed.";
    }
    else
    {    
        echo "Success.";
        print_r($array);
    }
}
 public function CookieReload($cookieid)
 {
     $queue = new \SaeTaskQueue('NewSign');
     $queue->addTask("/index.php/Home/Queue/LoadTb", "cookieid=" . $cookieid);
     $queue->push();
     echo json_encode(array('info' => '操作完毕,队列加载中', 'status' => true));
 }
示例#4
0
 public function addMessage(Pub_entity $message)
 {
     $message->pub_id = null;
     $this->db->insert('pub', $message);
     if ($this->db->insert_id() > 0) {
         if (class_exists('SaeTaskQueue')) {
             $queue = new SaeTaskQueue('push');
             $queue->addTask("/index.php/pubsub_channel/rowPush?id=" . $this->db->insert_id());
             $queue->push();
         }
     }
 }
 public function CronInterface()
 {
     $db = M('SignList');
     $queue = new \SaeTaskQueue('NewSign');
     // 统计剩余未签到
     $leftCount = $db->where('issign!=1')->count();
     $queueLeftLength = $queue->leftLength();
     $workArr = array();
     if ($leftCount == 0) {
         echo 'Left UnSign Tieba is empty';
         return;
     }
     // 剩余未签到是否大于队列长度
     if ($leftCount > $queueLeftLength) {
         $workArr = $db->where('issign!=1')->limit($queueLeftLength)->select();
     } else {
         $workArr = $db->where('issign!=1')->select();
     }
     // 分发至队列
     foreach ($workArr as $value) {
         $queue->addTask("/index.php/Home/Queue/TbSign", "cookieid=" . $value['cookieid'] . '&tiebaname=' . $value['tiebaname'] . '&fid=' . $value['fid'] . '&urlname=' . $value['urlname'] . '&signlistid=' . $value['id']);
     }
     $queue->push();
 }
示例#6
0
 public function tq()
 {
     $t = new SaeTaskQueue("test");
     $t->addTask("http://" . $_SERVER['HTTP_HOST'] . __URL__ . "/tq_test1");
     //添加列队任务1
     $t->addTask("http://" . $_SERVER['HTTP_HOST'] . __URL__ . "/tq_test2", "k1=v1&k2=v2", true);
     //添加列队任务2
     if (!$t->push()) {
         echo '出错:' . $t->errmsg();
     } else {
         if (IS_SAE) {
             echo '请查看SAE的日志中心执行,选择类型为debug';
         } else {
             echo '执行成功!请查看[' . LOG_PATH . 'sae_debug.log' . ']文件中的日志';
         }
     }
 }
示例#7
0
                                        $sendresult = "发送成功";
                                    } else {
                                        $flag = 0;
                                        $sendresult = "发送失败" . $res;
                                    }
                                    saveMailLog($maillogsid, $userid, "自己", $email1, $subject, $content, $flag, $sendresult, $currenttime);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
$queue->addTask($array);
//将任务推入队列
$queue->push();
function getIntervar($userid)
{
    global $adb;
    $query = "select interval from ec_systems where server_type='email' and smownerid='" . $userid . "' ";
    $row = $adb->getFirstLine($query);
    if (!empty($row)) {
        return $row['interval'];
    } else {
        return '';
    }
}
function send_webmail($mail, $to_email, $subject, $contents, $smownerid, $callback)
{
    $qiandao = json_decode($qiandao, 1);
    if (!is_array($qiandao)) {
        echo '<font color="#999999">' . $row['id'] . '</font><br>';
    } elseif (isset($qiandao['status']) && $qiandao['status'] == 401) {
        //删除失效cookie
        $tmp = $db->prepare('DELETE FROM `' . $dbpre . 'cookie` WHERE id = ?');
        $tmp->bindValue(1, $row['id']);
        $tmp->execute();
        echo '<font color="red">' . $row['id'] . '</font><br>';
    } elseif ($qiandao['success'] == TRUE || $qiandao['result'] == '您今天已签到过') {
        //成功
        $tmp = $db->prepare('UPDATE `' . $dbpre . 'cookie` SET last_sign = \'' . $date . '\' WHERE id = ?');
        $tmp->bindValue(1, $row['id']);
        $tmp->execute();
        echo '<font color="green">' . $row['id'] . '</font><br>';
    } else {
        //未知
        echo '<font color="black">' . $row['id'] . '</font><br>';
    }
}
$tmp = $db->prepare('SELECT count(*) as num FROM `' . $dbpre . 'cookie` WHERE last_sign <> ?');
$tmp->bindValue(1, $date);
$tmp->execute();
//查询
$tmp->setFetchMode(PDO::FETCH_ASSOC);
$tmp = $tmp->fetch();
if ($tmp['num'] != 0) {
    //还有没有签到的
    $queue = new SaeTaskQueue($task);
    $queue->addTask($self);
}
示例#9
0
 function api()
 {
     $request = array('source' => v('source'), 'data' => v('data'), 'ckeys' => v('ckeys'));
     $queue = new SaeTaskQueue('nowboard');
     $queue->addTask("http://" . c('site_domain') . "/?a=apido", "request=" . serialize($request));
     $ret = $queue->push();
     return ajax_echo('sent.' . print_r($ret, 1));
 }
示例#10
0
 if ($mentions && count($mentions) <= 10) {
     foreach ($mentions as $m_name) {
         if (intval($m_name)) {
             $DBM->unbuffered_query("UPDATE `yunbbs_users` SET `notic` =  concat('{$tid},', `notic`) WHERE `id`='{$m_name}'");
             $MMC->delete('u_' . $m_name);
         } else {
             if (strlen($m_name) > 3) {
                 $DBM->unbuffered_query("UPDATE `yunbbs_users` SET `notic` =  concat('{$tid},', `notic`) WHERE `name`='{$m_name}'");
             }
         }
     }
 }
 // send to weibo
 if ($send2wb && $cur_user['expires'] > $timestamp) {
     $queue = new SaeTaskQueue('default');
     $queue->addTask("http://" . $_SERVER['HTTP_HOST'] . "/task/sendmsg/reply/" . $cur_uid . "/" . $new_rid);
     $queue->push();
 }
 // 保存内容md5值
 $MMC->set('cm_' . $conmd5, '1', 0, 3600);
 // 跳到评论最后一页
 if ($page < $new_taltol_page) {
     $c_content = '';
     header('location: /t/' . $tid . '/' . $new_taltol_page);
     exit;
 } else {
     $cur_ucode = $new_ucode;
     $formhash = formhash();
 }
 // 若不转向
 $c_content = '';
示例#11
0
文件: Ysu.php 项目: yang22t/ysu
 public function timerAction()
 {
     $tasks = array();
     $list = Ysu_LibraryModel::select_all();
     if (empty($list)) {
         echo 'no task';
         exit;
     }
     $queue = new SaeTaskQueue('ysulibrary');
     foreach ($list as $v) {
         $tasks[] = array('url' => '/ysu/task', 'postdata' => 'param=' . json_encode($v));
     }
     $queue->addTask($tasks);
     $ret = $queue->push();
     if ($ret === false) {
         var_dump($queue->errno(), $queue->errmsg());
     } else {
         echo 'total task: ' . count($list);
     }
 }
示例#12
0
                             $DBM->unbuffered_query("UPDATE `yunbbs_users` SET `notic` =  concat('{$new_aid},', `notic`) WHERE `name`='{$m_name}'");
                         }
                     }
                 }
             }
             // send to weibo
             if ($send2wb && $cur_user['expires'] > $timestamp) {
                 $queue = new SaeTaskQueue('default');
                 $queue->addTask("http://" . $_SERVER['HTTP_HOST'] . "/task/sendmsg/topic/" . $cur_uid . "/" . $new_aid);
                 $queue->push();
             }
             // set tags
             if (!isset($queue)) {
                 $queue = new SaeTaskQueue('default');
             }
             $queue->addTask("http://" . $_SERVER['HTTP_HOST'] . "/task/fenci/" . $new_aid);
             $queue->push();
             // auto ping google & baidu
             $queue->addTask("http://" . $_SERVER['HTTP_HOST'] . "/task/atping/" . $new_aid);
             $queue->push();
             // 保存内容md5值
             $MMC->set('cm_' . $conmd5, '1', 0, 3600);
             $p_title = $p_content = '';
             header('location: /t/' . $new_aid);
             exit;
         }
     } else {
         $tip = '标题' . mb_strlen($p_title, 'utf-8') . ' 或 内容' . mb_strlen($p_content, 'utf-8') . ' 太长了';
     }
 } else {
     $tip = '标题 不能留空';