public async Task <dynamic> OnGetExamAsync(int examID, string token) { try { var t = await tokenService.GetTokenAsync(token); if (t == null) { throw new Exception("请先登录"); } var role = t.Role; if (role != UserRole.Admin) { role = await examService.GetExamRoleAsync(examID, t.UserID); } if (role == UserRole.Student) { return(new { Res = true, ExamDetail = await examService.GetStuExamDetailAsync(t.UserID, examID) }); } else { return(new { Res = true, ExamDetail = await examService.GetExamDetailAsync(examID) }); } } catch (Exception e) { return(new { Res = false, Error = e.Message }); } }