yuanrf 14 horas atrás
pai
commit
fca8327e53
1 arquivos alterados com 40 adições e 17 exclusões
  1. 40 17
      OASystem/OASystem.Api/Controllers/GroupsController.cs

+ 40 - 17
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -32101,24 +32101,24 @@ ORDER BY
 
             var result = new
             {
-                index = queryList.Count + 1,  
-                priceType = "",               
-                priceName = "",               
-                costPrice = 0m,               
-                currency = 836,               
-                rate = 1m,                    
-                count = 0,                    
-                unit = "",                    
-                coefficient = 0m,             
-                baoJiaPrice = 0m,             
-                addedValue = 0m,              
-                details = "",                 
-                reviewStatus = 0,             
-                diid = Dto.diid,          
-                imgs = "",                    
+                index = queryList.Count + 1,
+                priceType = "",
+                priceName = "",
+                costPrice = 0m,
+                currency = 836,
+                rate = 1m,
+                count = 0,
+                unit = "",
+                coefficient = 0m,
+                baoJiaPrice = 0m,
+                addedValue = 0m,
+                details = "",
+                reviewStatus = 0,
+                diid = Dto.diid,
+                imgs = "",
                 imgsList = new List<string>(),
-                id = child.Id,                
-                remark = ""                   
+                id = child.Id,
+                remark = ""
             };
 
             return Ok(JsonView(true, "新增成功!", result));
@@ -33018,6 +33018,29 @@ ORDER BY
                 .Any(x => x.ReviewStatus == 1);
             if (isAudit) return Ok(JsonView(false, "包含已审核数据无法删除!"));
 
+            var queryData = _sqlSugar.Queryable<Grp_ConferenceAffairsCostChild>()
+            .Where(x => x.IsDel == 0 && Dto.ids.Contains(x.Id))
+            .ToList();
+
+            //删除图片
+            foreach (var item in queryData)
+            {
+                if (!string.IsNullOrEmpty(item.Imgs))
+                {
+                    var imgList = item.Imgs.Split(',');
+                    foreach (var img in imgList)
+                    {
+                        //http路径转本地文件路径
+                        var localPath = img.Replace(AppSettingsHelper.Get("ConferenceCostImageBaseUrl"), AppSettingsHelper.Get("ConferenceCostImageBasePath"));
+                        if (System.IO.File.Exists(localPath))
+                        {
+                            _logger.LogInformation($"删除图片: {localPath}");
+                            System.IO.File.Delete(localPath);
+                        }
+                    }
+                }
+            }
+
             var count = _sqlSugar.Updateable<Grp_ConferenceAffairsCostChild>()
                        .Where(x => Dto.ids.Contains(x.Id) && x.IsDel == 0)
                        .SetColumns(x => new Grp_ConferenceAffairsCostChild