|
@@ -872,5 +872,32 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //查询学生活动列表
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ //[AuthToken(Roles = "Student")]
|
|
|
+ [HttpPost("finish")]
|
|
|
+ public async Task<IActionResult> finish(JsonElement requert)
|
|
|
+ {
|
|
|
+ //ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
+ //var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
+ ExamInfo info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
+ info.progress = "finish";
|
|
|
+ info = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(info, info.id, new PartitionKey($"Exam-{code}"));
|
|
|
+ return Ok(info);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"OS,{_option.Location},exam/finish\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
|
|
|
+ return BadRequest();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|