|
@@ -171,49 +171,7 @@ namespace TEAMModelOS.Controllers
|
|
|
await _dingDing.SendBotMsg($"OS,{_option.Location},common/vote/save()\n{e.Message}", GroupNames.醍摩豆服務運維群組);
|
|
|
return BadRequest(e.StackTrace);
|
|
|
}
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 保存考试信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="request"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [ProducesDefaultResponseType]
|
|
|
- [AuthToken(Roles = "teacher,admin")]
|
|
|
- [HttpPost("update-end-time")]
|
|
|
- [Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> updateTime(JsonElement request)
|
|
|
- {
|
|
|
- if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- //if (!request.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
- try
|
|
|
- {
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
- var response = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id.GetString(), new PartitionKey($"{code}"));
|
|
|
- if (response.Status == 200)
|
|
|
- {
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
- //long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
- Dictionary<string, object> dy = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(json.RootElement.ToString());
|
|
|
- if (request.TryGetProperty("time", out JsonElement time))
|
|
|
- {
|
|
|
- dy["endTime"] = time.GetInt64();
|
|
|
-
|
|
|
- }
|
|
|
- if (request.TryGetProperty("name", out JsonElement name))
|
|
|
- {
|
|
|
- dy["name"] = name.GetString();
|
|
|
- }
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<Dictionary<string, object>>(dy, dy["id"].ToString(), new PartitionKey(dy["code"].ToString()));
|
|
|
- }
|
|
|
- return Ok(new { code = 200 });
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- await _dingDing.SendBotMsg($"OS,{_option.Location},{code}/update-end-time()\n{e.Message}\n{e.StackTrace}", GroupNames.醍摩豆服務運維群組);
|
|
|
- }
|
|
|
- return Ok(new { id = id.GetString()});
|
|
|
- }
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 查询投票活动,用于列表,编辑,查看
|
|
|
/// </summary>
|