|
@@ -193,7 +193,7 @@ namespace TEAMModelOS.Controllers
|
|
/// <param name="request"></param>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[ProducesDefaultResponseType]
|
|
[ProducesDefaultResponseType]
|
|
- //[AuthToken(Roles = "teacher,admin")]
|
|
|
|
|
|
+ [AuthToken(Roles = "teacher,admin")]
|
|
[HttpPost("save-study")]
|
|
[HttpPost("save-study")]
|
|
public async Task<IActionResult> SaveStudy(JsonElement request)
|
|
public async Task<IActionResult> SaveStudy(JsonElement request)
|
|
{
|
|
{
|
|
@@ -204,6 +204,7 @@ namespace TEAMModelOS.Controllers
|
|
if (!request.TryGetProperty("study", out JsonElement stu)) return BadRequest();
|
|
if (!request.TryGetProperty("study", out JsonElement stu)) return BadRequest();
|
|
List<parameter> parameters = para.ToObject<List<parameter>>();
|
|
List<parameter> parameters = para.ToObject<List<parameter>>();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
|
+ var (userid, _, _, school) = HttpContext.GetAuthTokenInfo();
|
|
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
List<Study> studies = new();
|
|
List<Study> studies = new();
|
|
Study areaStudy = stu.ToObject<Study>();
|
|
Study areaStudy = stu.ToObject<Study>();
|
|
@@ -212,6 +213,7 @@ namespace TEAMModelOS.Controllers
|
|
areaStudy.scope = "school";
|
|
areaStudy.scope = "school";
|
|
areaStudy.code = "Study-" + id.GetString();
|
|
areaStudy.code = "Study-" + id.GetString();
|
|
areaStudy.createTime = now;
|
|
areaStudy.createTime = now;
|
|
|
|
+ areaStudy.creatorId = userid;
|
|
if (areaStudy.startTime > now)
|
|
if (areaStudy.startTime > now)
|
|
{
|
|
{
|
|
areaStudy.progress = "pending";
|
|
areaStudy.progress = "pending";
|
|
@@ -235,7 +237,7 @@ namespace TEAMModelOS.Controllers
|
|
study.ttl = -1;
|
|
study.ttl = -1;
|
|
study.code = "Study-" + pa.sId;
|
|
study.code = "Study-" + pa.sId;
|
|
study.createTime = now;
|
|
study.createTime = now;
|
|
-
|
|
|
|
|
|
+ study.creatorId = userid;
|
|
if (study.startTime > now)
|
|
if (study.startTime > now)
|
|
{
|
|
{
|
|
study.progress = "pending";
|
|
study.progress = "pending";
|
|
@@ -281,6 +283,7 @@ namespace TEAMModelOS.Controllers
|
|
trExam.school = pa.sId;
|
|
trExam.school = pa.sId;
|
|
trExam.areaId = id.GetString();
|
|
trExam.areaId = id.GetString();
|
|
trExam.tchLists = pa.gId;
|
|
trExam.tchLists = pa.gId;
|
|
|
|
+ trExam.creatorId = userid;
|
|
trExam.targetType = "research";
|
|
trExam.targetType = "research";
|
|
trExam.blob = $"/{trExam.areaId}/exam/{study.pId}/index.json";
|
|
trExam.blob = $"/{trExam.areaId}/exam/{study.pId}/index.json";
|
|
//处理发布对象
|
|
//处理发布对象
|
|
@@ -305,6 +308,7 @@ namespace TEAMModelOS.Controllers
|
|
trSurvey.areaId = id.GetString();
|
|
trSurvey.areaId = id.GetString();
|
|
trSurvey.tchLists = pa.gId;
|
|
trSurvey.tchLists = pa.gId;
|
|
trSurvey.scope = "school";
|
|
trSurvey.scope = "school";
|
|
|
|
+ trSurvey.creatorId = userid;
|
|
trSurvey.targetType = "research";
|
|
trSurvey.targetType = "research";
|
|
trSurvey.blob = $"/{trSurvey.areaId}/survey/{study.pId}/index.json";
|
|
trSurvey.blob = $"/{trSurvey.areaId}/survey/{study.pId}/index.json";
|
|
await getMoreSurvey(pa, trSurvey);
|
|
await getMoreSurvey(pa, trSurvey);
|
|
@@ -327,10 +331,11 @@ namespace TEAMModelOS.Controllers
|
|
homework.areaId = id.GetString();
|
|
homework.areaId = id.GetString();
|
|
homework.tchLists = pa.gId;
|
|
homework.tchLists = pa.gId;
|
|
homework.scope = "school";
|
|
homework.scope = "school";
|
|
|
|
+ homework.creatorId = userid;
|
|
homework.targetType = "research";
|
|
homework.targetType = "research";
|
|
//homework.blob = $"/{homework.areaId}/survey/{study.pId}/index.json";
|
|
//homework.blob = $"/{homework.areaId}/survey/{study.pId}/index.json";
|
|
await getMoreWork(pa, homework);
|
|
await getMoreWork(pa, homework);
|
|
- string workId = await HomeworkService.saveMoreAsync(client, _dingDing, homework);
|
|
|
|
|
|
+ string workId = await HomeworkService.saveMoreAsync(client, _dingDing, homework,_serviceBus,_azureStorage,_configuration);
|
|
if (string.IsNullOrEmpty(workId))
|
|
if (string.IsNullOrEmpty(workId))
|
|
{
|
|
{
|
|
return Ok(new { code = (int)HttpStatusCode.BadRequest, msg = "作业活动异常" });
|
|
return Ok(new { code = (int)HttpStatusCode.BadRequest, msg = "作业活动异常" });
|