Kaynağa Gözat

优化航班数据返回结构和类型

在 `GroupsController.cs` 中,修改 `airData` 的返回值类型,直接返回 `airData` 对象。
新增 `EntryAndExitTipsView` 类以表示航班相关信息。
在 `TicketBlackCodeRepository.cs` 中,调整 `EntryAndExitTips` 方法的返回类型为 `EntryAndExitTipsView[]`,并简化返回逻辑,确保在没有数据时返回空数组。
LEIYI 1 hafta önce
ebeveyn
işleme
e166ff656d

+ 2 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -6691,7 +6691,7 @@ FROM
             {
                 //GroupNameData = groupNameData.Data,
                 visaData = visaData.Data,
-                airData = airData.Data,
+                airData = airData,
                 reteInfos = reteInfos
             }));
         }
@@ -10551,7 +10551,7 @@ FROM
             else if (dto.TipsType == 3)
             {
                 var airData = await _ticketBlackCodeRep.EntryAndExitTips(dto.GroupId);
-                return Ok(JsonView(true, "查询成功!", airData.Data));
+                return Ok(JsonView(true, "查询成功!", airData));
             }
             return Ok(JsonView(false));
         }

+ 7 - 0
OASystem/OASystem.Domain/ViewModels/Groups/AirTicketReservationsView.cs

@@ -241,4 +241,11 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public string LandingTerminal { get; set; }
     }
+
+    public class EntryAndExitTipsView
+    {
+        public decimal jjcCurrentRate { get; set; }
+        public decimal gwcCurrentRate { get; set; }
+        public string remark { get; set; }
+    }
 }

+ 8 - 13
OASystem/OASystem.Infrastructure/Repositories/Resource/TicketBlackCodeRepository.cs

@@ -179,28 +179,23 @@ namespace OASystem.Infrastructure.Repositories.Resource
         /// </summary>
         /// <param name="diId"></param>
         /// <returns></returns>
-        public async Task<Result> EntryAndExitTips(int diId)
+        public async Task<EntryAndExitTipsView[]> EntryAndExitTips(int diId)
         {
-            if (diId < 1) return new Result() { Code = -1, Msg = "请输入有效的DiId参数!" };
+            if (diId < 1) return  Array.Empty<EntryAndExitTipsView>();
 
             var airFees = await _sqlSugar.Queryable<Air_TicketBlackCode>().Where(a => a.IsDel == 0 && a.DiId == diId).ToListAsync();
 
             if (airFees.Any())
             {
-                return new Result()
+                return airFees.OrderByDescending(x => x.ECPrice + x.BCPrice).Select(x => new EntryAndExitTipsView
                 {
-                    Code = 0,
-                    Msg = "操作成功!",
-                    Data = airFees.OrderByDescending(x => x.ECPrice + x.BCPrice).Select(x => new
-                    {
-                        jjcCurrentRate = x.ECPrice,
-                        gwcCurrentRate = x.BCPrice,
-                        remark = $"经济舱全价:{x.ECPrice.ToString("#0.00")} 元/人 公务舱全价:{x.BCPrice.ToString("#0.00")} 元/人"
-                    })
-                };
+                    jjcCurrentRate = x.ECPrice,
+                    gwcCurrentRate = x.BCPrice,
+                    remark = $"经济舱全价:{x.ECPrice.ToString("#0.00")} 元/人 公务舱全价:{x.BCPrice.ToString("#0.00")} 元/人"
+                }).ToArray();
             }
 
-            return new Result() { Code = -1,Msg="操作失败" };
+            return Array.Empty<EntryAndExitTipsView>();
         }
 
         public Result DescBlackToVisa(int diid)