public function delete()
 {
     $queueRuntimeDB = new QueueRuntimeModelDB();
     $whereArr = array();
     $whereArr['key'] = $_GET['key'];
     $sql = "SELECT * FROM `" . $queueRuntimeDB->getTableName() . "` WHERE `key` = ?";
     $row = $queueRuntimeDB->getRow($sql, array_values($whereArr));
     $rs = $queueRuntimeDB->delete($whereArr);
     Log::write($this->adminUserName, $this->ip, $_GET['key'], self::$state . "__" . self::$action, $rs, Log::arrayToLog($row));
     $rs ? Message::showSucc('删除成功') : Message::showError('删除失败:' . implode(" ", $queueRuntimeDB->getErrorInfo()));
 }
Пример #2
0
    $_GET[DEBUG_ARG_NAME] = 'DEBUG;all_info';
}
$argv = array_merge(array($scriptName), $argv);
define('PATH_ROOT', rtrim(dirname(__FILE__), '/') . '/../');
require PATH_ROOT . 'config/SysInitConfig.php';
//用户配置
require PATH_ROOT . 'libs/DaggerSysInitConfig.php';
//系统配置
require PATH_LIBS . 'basics.php';
//__autoload函数
require PATH_ROOT . 'config/DBConfig.php';
//载入数据库配置
//==========取代global.php功能==========//
$time = time();
$db = new QueueRuntimeModelDB();
$sql = "SELECT * FROM " . $db->getTableName() . " WHERE `begin_time` < ?";
$data = $db->getData($sql, array($time - 60 * 50));
if (!empty($data)) {
    $ndb = new ProjectModelDB();
    $queueConfigDB = new QueueConfigModelDB();
    foreach ($data as $v) {
        $row = $ndb->getRow("SELECT `id`,`key`,`name` FROM `" . $ndb->getTableName() . "` WHERE `id` = ?", array($v['project_id']));
        $task = trim(array_shift(explode(' ', $v['task'])));
        $runTimeConfig = $queueConfigDB->getFirst("SELECT `time` FROM `" . $queueConfigDB->getTableName() . "` WHERE `project_id` = ? AND `task` = ?", array($v['project_id'], $task));
        if (empty($runTimeConfig)) {
            $runTimeConfig = 50;
        }
        $runTime = intval(($time - $v['begin_time']) / 60);
        if ($runTime >= $runTimeConfig) {
            $message = "[{$row['name']}]的队列[{$v['task']}]于[" . date("Y-m-d H:i:s", $v['begin_time']) . "]在[{$v['ip']}]开始运行,目前已超过{$runTime}分钟!";
            // 多个监控点,同一次错误只提醒一次