소스 검색

邀请公务相关接口更改
group/UploadProjects 上传多个文件 新增API
group/OpInvitationOfficialActivities 更改 “Attachment”字段 类型 string数组
group/InvitationOfficialActivitiesById 新增字段 string 数组Attachments
group/InvitationOfficialActivitiesList 新增字段 string 数组Attachments
group/DelFile 更改接口删除逻辑

LEIYI 8 달 전
부모
커밋
3ce5a1ca85
1개의 변경된 파일35개의 추가작업 그리고 4개의 파일을 삭제
  1. 35 4
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 35 - 4
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -2,6 +2,7 @@
 using Aspose.Words;
 using Aspose.Words.Drawing;
 using Aspose.Words.Tables;
+using EyeSoft.Collections.Generic;
 using EyeSoft.IO;
 using Microsoft.AspNetCore.SignalR;
 using MySqlX.XDevAPI.Relational;
@@ -3821,10 +3822,40 @@ FROM
                     filePath = fileDir + "/商邀相关文件/" + dto.fileName;
                     // 删除该文件
                     System.IO.File.Delete(filePath);
-                    id = await _sqlSugar.Updateable<Grp_InvitationOfficialActivities>()
-                        .Where(a => a.Id == dto.Id)
-                        .SetColumns(a => new Grp_InvitationOfficialActivities { Attachment = "" })
-                        .ExecuteCommandAsync();
+
+                    var info = await _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().Where(x => x.Id == dto.Id && x.IsDel == 0).FirstAsync();
+                    if (info != null)
+                    {
+                        string[] files = new string[] { };
+                        if (!string.IsNullOrEmpty(info.Attachment))
+                        {
+                            try
+                            {
+                                files = JsonConvert.DeserializeObject<string[]>(info.Attachment);
+                            }
+                            catch (Exception)
+                            {
+
+                                files.AddRange(new string[] { info.Attachment });
+                            }
+                        }
+                        if (files.Length > 0)
+                        {
+                            var files1 = files.Where(x => !x.Equals(dto.fileName)).ToArray();
+
+                            string filePath2 = string.Empty;
+                            if (files1.Length > 0)
+                            {
+                                filePath2 = JsonConvert.SerializeObject( files1);
+                            }
+
+
+                            id = await _sqlSugar.Updateable<Grp_InvitationOfficialActivities>()
+                                                .Where(a => a.Id == dto.Id)
+                                                .SetColumns(a => new Grp_InvitationOfficialActivities { Attachment = filePath2 })
+                                                .ExecuteCommandAsync();
+                        }
+                    }
                 }
                 if (id != 0)
                 {