public function ajaxChangeStatusAction() { $applyId = Request::getPOST('apply-id'); $op = Request::getPOST('op'); if (!in_array($op, array(1, 2)) || empty($applyId)) { $this->renderError('参数错误!'); } $applyInfo = OjContestApplyInterface::getById(array('id' => $applyId)); if (empty($applyInfo)) { $this->renderError('报名信息不存在!'); } // 只能处理自己竞赛下的报名 $where = array(array('user_id', '=', $this->loginUserInfo['id']), array('is_diy', '=', 1)); $contestHash = OjContestInterface::getList(array('where' => $where)); $contestHash = Arr::listToHash('id', $contestHash); $contestIds = array_keys($contestHash); if (!in_array($applyInfo['contest_id'], $contestIds)) { $this->renderError('你没有权限操作!'); } if ($op == 1 && $applyInfo['status'] == ContestVars::APPLY_ACCEPTED || $op == 2 && $applyInfo['status'] == ContestVars::APPLY_REJECTED) { $msg = $op == 1 ? '已经通过!' : '已经拒绝!'; $this->renderError($msg); } if ($op == 1) { OjContestApplyInterface::accept(array('id' => $applyId)); } else { OjContestApplyInterface::reject(array('id' => $applyId)); } $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '操作成功!'); $this->renderAjax(0); }
public function ajaxChangeStatusAction() { $applyId = Request::getPOST('apply-id'); $op = Request::getPOST('op'); if (!in_array($op, array(1, 2)) || empty($applyId)) { $this->renderError('参数错误!'); } $applyInfo = OjContestApplyInterface::getById(array('id' => $applyId)); if (empty($applyInfo)) { $this->renderError('报名信息不存在!'); } if ($op == 1 && $applyInfo['status'] == ContestVars::APPLY_ACCEPTED || $op == 2 && $applyInfo['status'] == ContestVars::APPLY_REJECTED) { $msg = $op == 1 ? '已经通过!' : '已经拒绝!'; $this->renderError($msg); } if ($op == 1) { OjContestApplyInterface::accept(array('id' => $applyId)); } else { OjContestApplyInterface::reject(array('id' => $applyId)); } $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '操作成功!'); $this->renderAjax(0); }