public function ajaxRejudgeAction()
 {
     // 获取参数
     $judgeId = Request::getPOST('judge-id');
     // 只能重判自己的solution
     $judgeInfo = OjJudgeInterface::getById(array('id' => $judgeId));
     if (empty($judgeInfo)) {
         $this->renderError('judgeInfo不存在!');
     }
     // rejudge
     OjJudgeInterface::rejudge(array('id' => $judgeId));
     $this->renderAjax(0);
 }
 public function ajaxRejudgeAction()
 {
     // 获取参数
     $judgeId = Request::getPOST('judge-id');
     // 只能重判自己的solution
     $judgeInfo = OjJudgeInterface::getById(array('id' => $judgeId));
     if (empty($judgeInfo)) {
         $this->renderError('judgeInfo不存在!');
     }
     if ($judgeInfo['solution_id'] > 0 || $judgeInfo['user_id'] != $this->loginUserInfo['id']) {
         $this->renderError('你没有权限重判!');
     }
     // 获取题目
     $problemInfo = OjProblemInterface::getDetail(array('remote' => StatusVars::REMOTE_HQU, 'problem_id' => $judgeInfo['problem_id']));
     if ($problemInfo['user_id'] != $this->loginUserInfo['id']) {
         $this->renderError('你没有权限重判他人的题目!');
     }
     // rejudge
     OjJudgeInterface::rejudge(array('id' => $judgeId));
     $this->renderAjax(0);
 }
Ejemplo n.º 3
0
 public static function rejudge($id)
 {
     $solutionInfo = self::getById($id);
     if (empty($solutionInfo)) {
         throw new InterfaceException('solution不存在!');
     }
     $trans = new Trans(DbConfig::$SERVER_TRANS);
     $trans->begin();
     $solutionModel = new OjSolutionModel($trans);
     $solutionModel->updateById($id, array('time_cost' => 0, 'memory_cost' => 0));
     $affects = self::updateResult($id, StatusVars::REJUDGE, $trans);
     // 调用HQOJ重判接口
     if ($solutionInfo['remote'] == StatusVars::REMOTE_HQU) {
         OjJudgeInterface::rejudge(array('trans' => $trans, 'id' => $solutionInfo['run_id']));
     }
     $trans->commit();
     return $affects;
 }