|
@@ -418,28 +418,42 @@ namespace TEAMModelOS.Controllers
|
|
OAnswerUp oAnswer = _answer.ToObject<OAnswerUp>();
|
|
OAnswerUp oAnswer = _answer.ToObject<OAnswerUp>();
|
|
StudentArtResult studentArtResult = new();
|
|
StudentArtResult studentArtResult = new();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
- var resArt = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReadItemStreamAsync($"{school}-{oAnswer.studentId}", new PartitionKey($"ArtResult-{oAnswer.artId}"));
|
|
|
|
- if (resArt.Status == 200)
|
|
|
|
|
|
+ var ids = oAnswer.thirdAnswerId.Split("::");
|
|
|
|
+ if (ids.Length == 3)
|
|
{
|
|
{
|
|
- JsonDocument jsonD = JsonDocument.Parse(resArt.Content);
|
|
|
|
- studentArtResult = jsonD.RootElement.ToObject<StudentArtResult>();
|
|
|
|
- var temp = studentArtResult.results.Find(f => f.taskId.Equals(oAnswer.thirdAnswerId));
|
|
|
|
- temp.score = oAnswer.score;
|
|
|
|
- temp.source = 1;
|
|
|
|
- studentArtResult.oAnswer.questionId = oAnswer.questionId;
|
|
|
|
- studentArtResult.oAnswer.thirdAnswerId = oAnswer.thirdAnswerId;
|
|
|
|
- studentArtResult.oAnswer.score = oAnswer.score;
|
|
|
|
- studentArtResult.oAnswer.detail = oAnswer.detail;
|
|
|
|
-
|
|
|
|
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StudentArtResult>(studentArtResult, studentArtResult.id, new PartitionKey(studentArtResult.code));
|
|
|
|
|
|
+ string artId = ids[0];
|
|
|
|
+ string taskId = ids[1];
|
|
|
|
+ string studentId = ids[2];
|
|
|
|
+ var resArt = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReadItemStreamAsync($"{school}-{studentId}", new PartitionKey($"ArtResult-{artId}"));
|
|
|
|
+ if (resArt.Status == 200)
|
|
|
|
+ {
|
|
|
|
+ JsonDocument jsonD = JsonDocument.Parse(resArt.Content);
|
|
|
|
+ studentArtResult = jsonD.RootElement.ToObject<StudentArtResult>();
|
|
|
|
+ var temp = studentArtResult.results.Find(f => f.taskId.Equals(taskId));
|
|
|
|
+ if (temp == null) {
|
|
|
|
+ temp = new ArtQuotaResult();
|
|
|
|
+ temp.subjectId = "subject_music";
|
|
|
|
+ temp.subjectName = "音乐";
|
|
|
|
+ temp.taskId = taskId;
|
|
|
|
+ }
|
|
|
|
+ temp.score = oAnswer.score;
|
|
|
|
+ temp.source = 1;
|
|
|
|
+ studentArtResult.zyanswer.questionId = oAnswer.questionId;
|
|
|
|
+ studentArtResult.zyanswer.thirdAnswerId = oAnswer.thirdAnswerId;
|
|
|
|
+ studentArtResult.zyanswer.score = oAnswer.score;
|
|
|
|
+ studentArtResult.zyanswer.detail = oAnswer.detail;
|
|
|
|
+ await cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StudentArtResult>(studentArtResult, studentArtResult.id, new PartitionKey(studentArtResult.code));
|
|
|
|
+ return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = oAnswer } });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //初始化。
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return Ok(new { responseDate = new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "第三方id错误。", data = null } });
|
|
}
|
|
}
|
|
- else
|
|
|
|
- return Ok(new { responseDate = new ResponseData<dynamic>() { code = RespondCode.NotFound, msg = "未找到活动相关学生答题信息", data = null } });
|
|
|
|
-
|
|
|
|
- return Ok(new { responseData = new ResponseData<dynamic>() { code = RespondCode.Ok, msg = "成功", data = oAnswer } });
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|