public function iframeShowAction()
 {
     $judgeId = (int) Request::getGET('judge-id');
     // 获取judgeInfo
     $judgeInfo = OjJudgeInterface::getRow(array('id' => $judgeId));
     if (empty($judgeInfo)) {
         $this->renderError();
     }
     $this->renderIframe(array('judgeInfo' => $judgeInfo), 'problem/iframe/judge_log.php');
 }
 public function iframeShowAction()
 {
     $judgeId = (int) Request::getGET('judge-id');
     // 获取judgeInfo
     $where = array(array('id', '=', $judgeId), array('solution_id', '=', 0), array('user_id', '=', $this->loginUserInfo['id']));
     $judgeInfo = OjJudgeInterface::getRow(array('where' => $where));
     if (empty($judgeInfo)) {
         $this->renderError();
     }
     $this->renderIframe(array('judgeInfo' => $judgeInfo), 'setup/problem/iframe/judge_log.php');
 }
Пример #3
0
 public function defaultAction()
 {
     $judgeId = (int) Request::getGET('judge-id');
     if (empty($judgeId)) {
         $this->renderError();
     }
     // 获取judgeInfo
     $where = array(array('id', '=', $judgeId), array('solution_id', '=', 0), array('user_id', '=', $this->loginUserInfo['id']));
     $judgeInfo = OjJudgeInterface::getRow(array('where' => $where));
     if (empty($judgeInfo)) {
         $this->renderError();
     }
     // 格式化
     $text = StatusVars::$RESULT_FORMAT[$judgeInfo['result']];
     $class = StatusVars::$RESULT_CLASS[$judgeInfo['result']];
     $judgeInfo['result_html'] = sprintf('<span class="%s">%s</span>', $class, $text);
     $judgeInfo['source_format'] = htmlspecialchars($judgeInfo['source'], ENT_COMPAT, 'UTF-8');
     $this->renderFramework(array('judgeInfo' => $judgeInfo), 'setup/problem/code.php');
 }
Пример #4
0
<?php

/**
 * 同步当前的solution
 */
require_once __DIR__ . '/../../../bootstrap.php';
// 获取命令行参数
$solutionId = $argv[1];
if (empty($solutionId)) {
    Logger::error('judge', '缺少参数:$solutionId');
    exit(1);
}
// 从评判队列中获取该条信息
$queueInfo = OjJudgeInterface::getRow(array('where' => array(array('solution_id', '=', $solutionId))));
if (empty($queueInfo)) {
    Logger::error('judge', "评判队列中不存在Solution!solutionId={$solutionId}");
    exit(1);
}
$trans = new Trans(DbConfig::$SERVER_TRANS);
$trans->begin();
// 保存result
try {
    OjSolutionInterface::save(array('id' => $solutionId, 'time_cost' => $queueInfo['time_cost'], 'memory_cost' => $queueInfo['memory_cost'], 'judge_time' => $queueInfo['judge_time'], 'run_id' => $queueInfo['id'], 'result' => $queueInfo['result'], 'trans' => $trans));
} catch (Exception $e) {
    Logger::error('judge', "solutionId={$solutionId},保存solution失败," . $e->getMessage());
    $trans->rollback();
    throw $e;
}
// 保存log
try {
    OjSolutionLogInterface::save(array('trans' => $trans, 'solution_id' => $solutionId, 'ce' => $queueInfo['ce'], 're' => $queueInfo['re'], 'detail' => $queueInfo['detail']));