public async Task <dynamic> OnStartExamAsync([FromForm] int examID, [FromForm] string token) { try { var t = await tokenService.GetTokenAsync(token); if (t == null) { throw new Exception("请先登录"); } if (await examService.GetExamRoleAsync(examID, t.UserID) != UserRole.Student) { throw new Exception("无效操作"); } await examService.StuStartExamAsync(examID, t.UserID); return(new { Res = true }); } catch (Exception e) { return(new { Res = false, Error = e.Message }); } }