diff --git a/server/CoreCms.Net.IServices/SQ/ISQReservationsServices.cs b/server/CoreCms.Net.IServices/SQ/ISQReservationsServices.cs
index 08f11d2..ee2ef9f 100644
--- a/server/CoreCms.Net.IServices/SQ/ISQReservationsServices.cs
+++ b/server/CoreCms.Net.IServices/SQ/ISQReservationsServices.cs
@@ -1,4 +1,4 @@
-/***********************************************************************
+/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
diff --git a/server/CoreCms.Net.IServices/SQ/ISQRoomPricingServices.cs b/server/CoreCms.Net.IServices/SQ/ISQRoomPricingServices.cs
index a4b796e..5d6d885 100644
--- a/server/CoreCms.Net.IServices/SQ/ISQRoomPricingServices.cs
+++ b/server/CoreCms.Net.IServices/SQ/ISQRoomPricingServices.cs
@@ -1,4 +1,4 @@
-using CoreCms.Net.IServices;
+using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.SQ;
using System;
@@ -56,6 +56,12 @@ namespace CoreCms.Net.IServices
/// 节假日定价DTO
/// 是否成功
Task SetHolidayPricingAsync(SetHolidayPricingDto dto);
+
+ Task> GetHolidayPricingByDateAsync(int roomId, DateTime date);
+
+ Task DeleteHolidayPricingAsync(int roomId, DateTime date);
+
+ Task HasHolidayPricingAsync(int roomId, DateTime date);
}
}
diff --git a/server/CoreCms.Net.Services/SQ/SQRoomPricingServices.cs b/server/CoreCms.Net.Services/SQ/SQRoomPricingServices.cs
index 70a4b6e..545437c 100644
--- a/server/CoreCms.Net.Services/SQ/SQRoomPricingServices.cs
+++ b/server/CoreCms.Net.Services/SQ/SQRoomPricingServices.cs
@@ -242,6 +242,64 @@ namespace CoreCms.Net.Services
return false;
}
}
+
+ ///
+ /// 查询某房间某日期的节假日价格列表
+ ///
+ public async Task> GetHolidayPricingByDateAsync(int roomId, DateTime date)
+ {
+ var queryDate = date.Date;
+
+ // 查询该日期的节假日价格(有日期范围的价格配置)
+ var holidayPricing = await _pricingRepository.QueryListByClauseAsync(
+ p => p.room_id == roomId &&
+ p.effective_date_start != null &&
+ p.effective_date_end != null &&
+ p.effective_date_start <= queryDate &&
+ p.effective_date_end >= queryDate &&
+ p.is_active == true,
+ p => p.time_slot_type,
+ OrderByType.Asc
+ );
+
+ return holidayPricing ?? new List();
+ }
+
+ ///
+ /// 删除某房间某日期的节假日价格
+ ///
+ public async Task DeleteHolidayPricingAsync(int roomId, DateTime date)
+ {
+ try
+ {
+ var queryDate = date.Date;
+
+ // 查询该日期的节假日价格
+ var holidayPricing = await GetHolidayPricingByDateAsync(roomId, queryDate);
+
+ if (holidayPricing == null || holidayPricing.Count == 0)
+ {
+ return true; // 没有数据,直接返回成功
+ }
+
+ // 删除所有节假日价格记录
+ var ids = holidayPricing.Select(p => p.id).ToArray();
+ return await _pricingRepository.DeleteByIdsAsync(ids);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// 检查某房间某日期是否设置了节假日价格
+ ///
+ public async Task HasHolidayPricingAsync(int roomId, DateTime date)
+ {
+ var holidayPricing = await GetHolidayPricingByDateAsync(roomId, date);
+ return holidayPricing != null && holidayPricing.Count > 0;
+ }
}
}
diff --git a/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs b/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs
index 73f68e6..71e92f5 100644
--- a/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs
+++ b/server/CoreCms.Net.Web.Admin/Controllers/SQ/SQRoomPricingController.cs
@@ -1,4 +1,4 @@
-/***********************************************************************
+/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
@@ -1564,6 +1564,306 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
+ #region 节假日价格管理============================================================
+ // GET: Api/SQRoomPricing/GetHolidayPricing
+ ///
+ /// 获取某日期的节假日价格(用于弹窗回显)
+ ///
+ /// 日期
+ /// 房间ID
+ ///
+ [HttpGet]
+ [Description("获取节假日价格")]
+ public async Task GetHolidayPricing([FromQuery] string date, [FromQuery] int roomId)
+ {
+ var jm = new AdminUiCallBack();
+
+ try
+ {
+ // 参数验证
+ if (roomId <= 0)
+ {
+ jm.msg = "请选择房间";
+ return jm;
+ }
+
+ if (string.IsNullOrEmpty(date))
+ {
+ jm.msg = "请选择日期";
+ return jm;
+ }
+
+ if (!DateTime.TryParse(date, out DateTime dateValue))
+ {
+ jm.msg = "日期格式不正确";
+ return jm;
+ }
+
+ // 检查房间是否存在
+ var room = await _SQRoomsServices.QueryByIdAsync(roomId);
+ if (room == null)
+ {
+ jm.msg = "房间不存在";
+ return jm;
+ }
+
+ // 查询节假日价格
+ var holidayPricing = await _SQRoomPricingServices.GetHolidayPricingByDateAsync(roomId, dateValue);
+
+ // 查询默认价格(用于对比)
+ var defaultPricing = await _SQRoomPricingServices.GetRoomAllPricingAsync(roomId, null);
+
+ // 时段名称映射
+ var slotNames = new[] { "凌晨", "上午", "下午", "晚上" };
+
+ // 构建返回数据(包含所有4个时段)
+ var result = new List