public async Task <dynamic> OnSetScoreAsync([FromForm] string stuID, [FromForm] int examID, [FromForm] int questionID, [FromForm] int score, [FromForm] string token) { try { var t = await tokenService.GetTokenAsync(token); if (t == null) { throw new Exception("请先登录"); } if (t.Role != UserRole.Admin) { var courseRole = await examService.GetExamRoleAsync(examID, t.UserID); if (courseRole == UserRole.Student) { throw new Exception("权限不足"); } } await examService.SetExamScore(stuID, examID, questionID, score); return(new { Res = true }); } catch (Exception e) { return(new { Res = false, Error = e.Message }); } }