|
@@ -1652,7 +1652,7 @@ namespace TEAMModelOS.Controllers
|
|
|
Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).ReadItemStreamAsync(_activityId.GetString(), new PartitionKey("Activity"));
|
|
|
if (response.Status==200)
|
|
|
{
|
|
|
- Activity activity = JsonDocument.Parse(response.Content).RootElement.ToObject<Activity>();
|
|
|
+ ActivityDto activity = JsonDocument.Parse(response.Content).RootElement.ToObject<ActivityDto>();
|
|
|
if (activity.publish!=1 && activity.publish!=2)
|
|
|
{
|
|
|
return Ok(new { code = 1, msg = "活动未发布!" });
|
|
@@ -1684,6 +1684,8 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
Training training = null;
|
|
|
TEAMModelOS.SDK.Models.Research research = null;
|
|
|
+ var (blob_uri, blob_sas) = _azureStorage.GetBlobContainerSAS(activity.owner, BlobContainerSasPermissions.Read | BlobContainerSasPermissions.List);
|
|
|
+ activity.sas=blob_sas;
|
|
|
return Ok(new {code =200, activity,contest,reviewRule, training, research});
|
|
|
}
|
|
|
else
|
|
@@ -1930,7 +1932,14 @@ namespace TEAMModelOS.Controllers
|
|
|
enroll= JsonDocument.Parse(responseActivityEnroll.Content).RootElement.ToObject<ActivityEnroll>();
|
|
|
if (enroll.contest!=null && enroll.contest.leader==1)
|
|
|
{
|
|
|
- return Ok(new { code = 3, msg = "请移交队长后再退出参赛!" });
|
|
|
+ // 如果没有其他队员,则可以直接退出
|
|
|
+ //检查是否还有其他成员
|
|
|
+ string cipherSQL = $"select value c.id from c where c.contest!=null and c.activityId='{_activityId.GetString()}' and c.contest.type=1 and c.contest.cipher='{enroll.contest.cipher}' and c.id<>'{tmdid}' ";
|
|
|
+ var cipherResult = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetList<string>(cipherSQL, $"ActivityEnroll-{_activityId}");
|
|
|
+ if (cipherResult.list.Count>0)
|
|
|
+ {
|
|
|
+ return Ok(new { code = 3, msg = "队伍中还有其他参赛队员,请移交队长后或移除队员后再退出参赛!" });
|
|
|
+ }
|
|
|
}
|
|
|
Azure.Response responseActivityEnrollDel = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).DeleteItemStreamAsync(enroll.id, new PartitionKey($"ActivityEnroll-{_activityId.GetString()}"));
|
|
|
if (responseActivityEnrollDel.Status==201)
|
|
@@ -2166,7 +2175,7 @@ namespace TEAMModelOS.Controllers
|
|
|
//队长
|
|
|
if (cipherResult.list.IsNotEmpty())
|
|
|
{
|
|
|
- //组队口令已被其他团队使用
|
|
|
+ //组队口令已被其他团队使用,此处已顺便处理成员篡位的逻辑
|
|
|
var otherTeam = cipherResult.list.FindAll(z => !z.id.Equals(tmdid));
|
|
|
if (otherTeam.IsNotEmpty())
|
|
|
{
|
|
@@ -2196,6 +2205,11 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ //队长跑路
|
|
|
+ if (enroll!=null && enroll.contest!=null && enroll.contest.leader==1 && enrollData.leader==0) {
|
|
|
+ return Ok(new { code = 17, msg = "你是队长,不能变更身份!" });
|
|
|
+ }
|
|
|
+
|
|
|
//队员
|
|
|
if (cipherResult.list.IsNotEmpty())
|
|
|
{
|
|
@@ -2494,7 +2508,8 @@ namespace TEAMModelOS.Controllers
|
|
|
foreach (var z in cipherResult.list)
|
|
|
{
|
|
|
z.upload=enroll.upload;
|
|
|
- z.upload.uploadId=Guid.NewGuid().ToString();
|
|
|
+ //队长统一上传的作品不需要单独生成作品id.
|
|
|
+ // z.upload.uploadId=Guid.NewGuid().ToString();
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(z, new PartitionKey(z.code));
|
|
|
}
|
|
|
}
|