Exemplo n.º 1
0
 public function ajaxSetUserAction()
 {
     // 获取参数
     $globalId = Request::getPOST('global-id');
     $username = trim(Request::getPOST('username', ''));
     // 校验用户
     $userInfo = UserCommonInterface::getByLoginName(array('login_name' => $username));
     if (empty($userInfo)) {
         $this->renderError('用户不存在!');
     }
     // 校验problem
     $problemInfo = OjProblemInterface::getById(array('id' => $globalId));
     if (empty($problemInfo)) {
         $this->renderError('题目不存在!');
     }
     OjProblemInterface::setUser(array('id' => $globalId, 'username' => $username));
     $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '设置成功!');
     $this->renderAjax(0);
 }