public async Task <dynamic> OnJoinGroupAsync([FromForm] int courseID, [FromForm] int groupID, [FromForm] string token) { try { var t = await tokenService.GetTokenAsync(token); if (t == null) { throw new Exception("请先登录"); } if (t.Role != UserRole.Admin) { var uc = await courseService.GetUserCourseAsync(t.UserID, courseID); if (uc == null || uc.UserRole != UserRole.Student) { throw new Exception("权限不足"); } } await courseService.AddStuToGroup(t.UserID, courseID, groupID); return(new { Res = true }); } catch (Exception e) { return(new { Res = false, Error = e.Message }); } }