|
@@ -56,7 +56,7 @@ namespace TEAMModelAPI.Controllers
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpGet("get-school-info")]
|
|
|
- [ApiToken(Auth = "1",Name = "学校基础信息", Limit=false)]
|
|
|
+ [ApiToken(Auth = "2",Name = "学校基础信息", RW = "R", Limit =false)]
|
|
|
public async Task<IActionResult> GetSchoolInfo()
|
|
|
{
|
|
|
var (id, school) = HttpContext.GetApiTokenInfo();
|
|
@@ -78,7 +78,7 @@ namespace TEAMModelAPI.Controllers
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpGet("get-teacher-list")]
|
|
|
- [ApiToken(Auth = "2", Name = "学校教师列表", Limit = false)]
|
|
|
+ [ApiToken(Auth = "3", Name = "学校教师列表", RW = "R", Limit = false)]
|
|
|
public async Task<IActionResult> GetTeacherList()
|
|
|
{
|
|
|
var (id, school) = HttpContext.GetApiTokenInfo();
|
|
@@ -93,6 +93,48 @@ namespace TEAMModelAPI.Controllers
|
|
|
teachers
|
|
|
});
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 获取学校教师信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ [HttpPost("get-teacher-info")]
|
|
|
+ [ApiToken(Auth = "4", Name = "学校教师信息", RW = "R", Limit = false)]
|
|
|
+ public async Task<IActionResult> GetTeacherInfo(JsonElement json )
|
|
|
+ {
|
|
|
+ json.TryGetProperty("tmdid", out JsonElement _tmdid);
|
|
|
+ var (id, school) = HttpContext.GetApiTokenInfo();
|
|
|
+ Azure.Response responseSchoolTch =await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School")
|
|
|
+ .ReadItemStreamAsync($"{_tmdid}", new PartitionKey($"Teacher-{school}"));
|
|
|
+ Azure.Response responseTch = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher")
|
|
|
+ .ReadItemStreamAsync($"{_tmdid}", new PartitionKey($"Base"));
|
|
|
+ Teacher teacher = null;
|
|
|
+ if (responseTch.Status == 200)
|
|
|
+ {
|
|
|
+ teacher = JsonDocument.Parse(responseTch.Content).RootElement.Deserialize<Teacher>();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { error = 3, msg = "账号未创建!" });
|
|
|
+ }
|
|
|
+ if (responseSchoolTch.Status == 200 && teacher!= null )
|
|
|
+ {
|
|
|
+ SchoolTeacher schoolTeacher= JsonDocument.Parse(responseSchoolTch.Content).RootElement.Deserialize<SchoolTeacher>();
|
|
|
+ if (schoolTeacher.status.Equals("join"))
|
|
|
+ {
|
|
|
+ return Ok(new {teacher.id,teacher.name,teacher.picture,schoolTeacher.job,schoolTeacher.status,schoolTeacher.roles,schoolTeacher.subjectIds, school=teacher.schools?.Find(x=>x.schoolId.Equals(school)) } );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { error = 2, msg = "教师未加入学校!" });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return Ok(new { error = 1, msg = "教师未就职该学校!" });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
"periodId":"学段(选填)"
|
|
|
*/
|
|
@@ -103,7 +145,7 @@ namespace TEAMModelAPI.Controllers
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-group-list")]
|
|
|
- [ApiToken(Auth = "3", Name = "学校教师列表", Limit = false)]
|
|
|
+ [ApiToken(Auth = "5", Name = "学校教师列表", RW = "R", Limit = false)]
|
|
|
public async Task<IActionResult> GetGroupList(JsonElement json)
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
@@ -200,7 +242,7 @@ namespace TEAMModelAPI.Controllers
|
|
|
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-group-members")]
|
|
|
- [ApiToken(Auth = "4", Name = "获取名单详细信息和成员信息", Limit = false)]
|
|
|
+ [ApiToken(Auth = "6", Name = "获取名单详细信息和成员信息", RW = "R", Limit = false)]
|
|
|
public async Task<IActionResult> GetGroupMembers(JsonElement json)
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
@@ -210,9 +252,10 @@ namespace TEAMModelAPI.Controllers
|
|
|
(List<RMember> members, List<RGroupList> groups) = await GroupListService.GetStutmdidListids(client, _dingDing, listids, $"{school}");
|
|
|
return Ok(new { groups = groups.Select(x => new { x.name, x.no, x.periodId, x.school, x.type, x.year, x.tcount, x.scount, x.leader, x.members, x.id }), members });
|
|
|
}
|
|
|
+
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-course-list")]
|
|
|
- [ApiToken(Auth = "5", Name = "获取课程列表信息", Limit = false)]
|
|
|
+ [ApiToken(Auth = "7", Name = "获取课程列表信息",RW ="R", Limit = false)]
|
|
|
public async Task<IActionResult> GetCourseList(JsonElement json) {
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var (id, school) = HttpContext.GetApiTokenInfo();
|
|
@@ -234,5 +277,24 @@ namespace TEAMModelAPI.Controllers
|
|
|
}
|
|
|
return Ok(new { courses });
|
|
|
}
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ [HttpPost("get-course-info")]
|
|
|
+ [ApiToken(Auth = "8", Name = "课程详细信息", RW = "R", Limit = false)]
|
|
|
+ public async Task<IActionResult> GetCourseInfo(JsonElement json)
|
|
|
+ {
|
|
|
+ var (id, school) = HttpContext.GetApiTokenInfo();
|
|
|
+ json.TryGetProperty("courseId", out JsonElement courseId);
|
|
|
+ Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School")
|
|
|
+ .ReadItemStreamAsync($"{courseId}", new PartitionKey($"Course-{school}"));
|
|
|
+ if (response.Status == 200)
|
|
|
+ {
|
|
|
+ JsonDocument document= JsonDocument.Parse(response.Content);
|
|
|
+ Course course= document.RootElement.Deserialize<Course>();
|
|
|
+ return Ok(new { course.name,course.id, course.subject, course .period, course .scope, course.school, course .no, course .desc, course.schedule});
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return Ok(new { error=1,msg="课程不存在!"});
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|