From 6749e1e88233e9013ffd56e1585ebfb6f9c64a84 Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 7 Dec 2025 17:15:13 +0800 Subject: [PATCH] 321 --- .../SQ/ISQReservationsServices.cs | 2 +- .../SQ/ISQRoomPricingServices.cs | 8 +- .../SQ/SQRoomPricingServices.cs | 58 +++ .../Controllers/SQ/SQRoomPricingController.cs | 365 +++++++++++++++++- server/CoreCms.Net.Web.Admin/Doc.xml | 88 +++++ .../views/sq/sqroompricing/holiday-price.html | 280 ++++++++++++++ .../wwwroot/views/sq/sqroompricing/index.html | 191 ++++++++- 7 files changed, 973 insertions(+), 19 deletions(-) create mode 100644 server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/holiday-price.html 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(); + for (int slotType = 0; slotType <= 3; slotType++) + { + var holidaySlot = holidayPricing.FirstOrDefault(p => p.time_slot_type == slotType); + var defaultSlot = defaultPricing.FirstOrDefault(p => p.time_slot_type == slotType); + + result.Add(new + { + time_slot_type = slotType, + slot_name = slotNames[slotType], + has_holiday_price = holidaySlot != null, + // 节假日价格描述 + holiday_price_desc_standard = holidaySlot?.price_desc_standard ?? "", + holiday_price_desc_member = holidaySlot?.price_desc_member ?? "", + // 默认价格描述(用于前端显示对比) + default_price_desc_standard = defaultSlot?.price_desc_standard ?? "", + default_price_desc_member = defaultSlot?.price_desc_member ?? "" + }); + } + + jm.code = 0; + jm.msg = "获取成功"; + jm.data = new + { + date = date, + room_id = roomId, + room_name = room.name, + slots = result + }; + } + catch (Exception ex) + { + jm.msg = "获取失败:" + ex.Message; + NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "获取节假日价格", "GetHolidayPricing", ex); + } + + return jm; + } + + // POST: Api/SQRoomPricing/DoSetHolidayPricing + /// + /// 设置节假日价格(保存) + /// + /// + [HttpPost] + [Description("设置节假日价格")] + public async Task DoSetHolidayPricing([FromBody] SetHolidayPricingRequest request) + { + var jm = new AdminUiCallBack(); + + try + { + // 参数验证 + if (string.IsNullOrEmpty(request.date)) + { + jm.msg = "请选择日期"; + return jm; + } + + if (!DateTime.TryParse(request.date, out DateTime dateValue)) + { + jm.msg = "日期格式不正确"; + return jm; + } + + if (request.roomIds == null || request.roomIds.Length == 0) + { + jm.msg = "请选择房间"; + return jm; + } + + if (request.slots == null || request.slots.Length == 0) + { + jm.msg = "请至少启用一个时段"; + return jm; + } + + var successCount = 0; + var errorMsg = ""; + + // 遍历房间 + foreach (var roomId in request.roomIds) + { + // 检查房间是否存在 + var room = await _SQRoomsServices.QueryByIdAsync(roomId); + if (room == null) + { + errorMsg = $"房间ID {roomId} 不存在"; + continue; + } + + // 先删除该房间该日期已有的节假日价格 + await _SQRoomPricingServices.DeleteHolidayPricingAsync(roomId, dateValue); + + // 保存新的节假日价格 + foreach (var slot in request.slots) + { + if (!slot.enabled) + { + continue; // 未启用的时段不保存 + } + + var pricing = new SQRoomPricing + { + room_id = roomId, + time_slot_type = slot.time_slot_type, + standard_price = 0, // 不使用此字段,但数据库要求非空,设为0 + member_price = 0, // 不使用此字段,但数据库要求非空,设为0 + price_desc_standard = slot.price_desc_standard, + price_desc_member = slot.price_desc_member, + effective_date_start = dateValue.Date, + effective_date_end = dateValue.Date, + is_active = true, + created_at = DateTime.Now, + updated_at = DateTime.Now + }; + + await _SQRoomPricingServices.InsertAsync(pricing); + } + + successCount++; + } + + if (successCount > 0) + { + jm.code = 0; + jm.msg = $"设置成功,共设置 {successCount} 个房间的节假日价格"; + } + else + { + jm.msg = errorMsg ?? "设置失败"; + } + } + catch (Exception ex) + { + jm.msg = "设置失败:" + ex.Message; + NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "设置节假日价格", "DoSetHolidayPricing", ex); + } + + return jm; + } + + // POST: Api/SQRoomPricing/DoCancelHolidayPricing + /// + /// 取消节假日价格(删除该日期的特殊价格) + /// + /// + [HttpPost] + [Description("取消节假日价格")] + public async Task DoCancelHolidayPricing([FromBody] CancelHolidayPricingRequest request) + { + var jm = new AdminUiCallBack(); + + try + { + // 参数验证 + if (string.IsNullOrEmpty(request.date)) + { + jm.msg = "请选择日期"; + return jm; + } + + if (!DateTime.TryParse(request.date, out DateTime dateValue)) + { + jm.msg = "日期格式不正确"; + return jm; + } + + if (request.roomIds == null || request.roomIds.Length == 0) + { + jm.msg = "请选择房间"; + return jm; + } + + var successCount = 0; + + // 遍历房间,删除节假日价格 + foreach (var roomId in request.roomIds) + { + var result = await _SQRoomPricingServices.DeleteHolidayPricingAsync(roomId, dateValue); + if (result) + { + successCount++; + } + } + + if (successCount > 0) + { + jm.code = 0; + jm.msg = $"取消成功,共取消 {successCount} 个房间的节假日价格"; + } + else + { + jm.msg = "取消失败或该日期没有节假日价格"; + } + } + catch (Exception ex) + { + jm.msg = "取消失败:" + ex.Message; + NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "取消节假日价格", "DoCancelHolidayPricing", ex); + } + + return jm; + } + + // GET: Api/SQRoomPricing/HasHolidayPricing + /// + /// 查询某日期是否设置了节假日价格(用于右键菜单显示) + /// + /// 日期 + /// 房间ID + /// + [HttpGet] + [Description("检查是否有节假日价格")] + public async Task HasHolidayPricing([FromQuery] string date, [FromQuery] int roomId) + { + var jm = new AdminUiCallBack(); + + try + { + if (roomId <= 0 || string.IsNullOrEmpty(date)) + { + jm.msg = "参数错误"; + return jm; + } + + if (!DateTime.TryParse(date, out DateTime dateValue)) + { + jm.msg = "日期格式不正确"; + return jm; + } + + var hasHolidayPrice = await _SQRoomPricingServices.HasHolidayPricingAsync(roomId, dateValue); + + jm.code = 0; + jm.msg = "查询成功"; + jm.data = new { has_holiday_price = hasHolidayPrice }; + } + catch (Exception ex) + { + jm.msg = "查询失败:" + ex.Message; + NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "检查节假日价格", "HasHolidayPricing", ex); + } + + return jm; + } + #endregion } @@ -1641,5 +1941,68 @@ namespace CoreCms.Net.Web.Admin.Controllers /// public string date { get; set; } } + + /// + /// 设置节假日价格请求参数 + /// + public class SetHolidayPricingRequest + { + /// + /// 日期 (YYYY-MM-DD) + /// + public string date { get; set; } + + /// + /// 房间ID数组 + /// + public int[] roomIds { get; set; } + + /// + /// 时段价格列表 + /// + public HolidaySlotPrice[] slots { get; set; } + } + + /// + /// 节假日时段价格 + /// + public class HolidaySlotPrice + { + /// + /// 时段类型(0=凌晨,1=上午,2=下午,3=晚上) + /// + public int time_slot_type { get; set; } + + /// + /// 是否启用该时段节假日价格 + /// + public bool enabled { get; set; } + + /// + /// 标准价格描述(文本,如:"150元/时段") + /// + public string price_desc_standard { get; set; } + + /// + /// 会员价格描述(文本,如:"120元/时段") + /// + public string price_desc_member { get; set; } + } + + /// + /// 取消节假日价格请求参数 + /// + public class CancelHolidayPricingRequest + { + /// + /// 日期 (YYYY-MM-DD) + /// + public string date { get; set; } + + /// + /// 房间ID数组 + /// + public int[] roomIds { get; set; } + } #endregion } diff --git a/server/CoreCms.Net.Web.Admin/Doc.xml b/server/CoreCms.Net.Web.Admin/Doc.xml index cd9bb01..1637011 100644 --- a/server/CoreCms.Net.Web.Admin/Doc.xml +++ b/server/CoreCms.Net.Web.Admin/Doc.xml @@ -4167,6 +4167,34 @@ 日期 + + + 获取某日期的节假日价格(用于弹窗回显) + + 日期 + 房间ID + + + + + 设置节假日价格(保存) + + + + + + 取消节假日价格(删除该日期的特殊价格) + + + + + + 查询某日期是否设置了节假日价格(用于右键菜单显示) + + 日期 + 房间ID + + 设置房间不可用请求参数 @@ -4237,6 +4265,66 @@ 日期 (YYYY-MM-DD) + + + 设置节假日价格请求参数 + + + + + 日期 (YYYY-MM-DD) + + + + + 房间ID数组 + + + + + 时段价格列表 + + + + + 节假日时段价格 + + + + + 时段类型(0=凌晨,1=上午,2=下午,3=晚上) + + + + + 是否启用该时段节假日价格 + + + + + 标准价格描述(文本,如:"150元/时段") + + + + + 会员价格描述(文本,如:"120元/时段") + + + + + 取消节假日价格请求参数 + + + + + 日期 (YYYY-MM-DD) + + + + + 房间ID数组 + + 房间表 diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/holiday-price.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/holiday-price.html new file mode 100644 index 0000000..829e2ba --- /dev/null +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/holiday-price.html @@ -0,0 +1,280 @@ + + diff --git a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html index bfc071e..34f91f1 100644 --- a/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html +++ b/server/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqroompricing/index.html @@ -82,11 +82,32 @@ background: #f0fffe; } + /* 有节假日价格的日期标识 */ + .calendar-day.has-holiday-price { + border-color: #ff9800; + background: #fff8e1; + position: relative; + } + + .calendar-day.has-holiday-price .calendar-day-header::after { + content: "节"; + position: absolute; + top: 8px; + right: 8px; + background: #ff9800; + color: #fff; + padding: 2px 6px; + border-radius: 3px; + font-size: 10px; + font-weight: bold; + } + .calendar-day-header { font-weight: bold; margin-bottom: 8px; font-size: 16px; color: #333; + position: relative; } .calendar-day-price { @@ -810,6 +831,12 @@ case 'view': showDateDetails(dateStr); break; + case 'setHolidayPrice': + showSetHolidayPriceDialog(dateStr); + break; + case 'cancelHolidayPrice': + showCancelHolidayPriceConfirm(dateStr); + break; case 'setUnavailable': showSetUnavailableDialog(dateStr); break; @@ -830,6 +857,15 @@ icon: "fa-eye" }, "sep1": "---------", + "setHolidayPrice": { + name: "设置节假日价格", + icon: "fa-calendar-plus-o" + }, + "cancelHolidayPrice": { + name: "取消节假日价格", + icon: "fa-calendar-minus-o" + }, + "sep2": "---------", "setUnavailable": { name: "设置预约状态", icon: "fa-ban" @@ -838,7 +874,7 @@ name: "取消预约状态", icon: "fa-check-circle" }, - "sep2": "---------", + "sep3": "---------", "disableAllDay": { name: "禁用整天", icon: "fa-calendar-times" @@ -883,6 +919,93 @@ }); } + // 设置节假日价格弹窗 + function showSetHolidayPriceDialog(dateStr) { + if (!selectedRoomId) { + layer.msg('请先选择房间'); + return; + } + + var selectedRoom = roomOptions.find(function (r) { + return r.id == selectedRoomId; + }); + var roomName = selectedRoom ? selectedRoom.name : '未知房间'; + + admin.popup({ + shadeClose: false, + title: '设置节假日价格 - ' + roomName + ' - ' + dateStr, + area: ['1200px', '800px'], + id: 'LAY-popup-SQRoomPricing-holiday-price', + btn: ['确定', '取消'], + success: function (layero, index) { + view(this.id).render('sq/sqroompricing/holiday-price', { + data: { + dateStr: dateStr, + roomName: roomName, + selectedRoomId: selectedRoomId, + roomOptions: roomOptions, + refreshSingleDay: refreshSingleDay + } + }).done(function () { + form.render('checkbox', 'setHolidayPriceForm'); + }); + }, + yes: function (index, layero) { + // 调用模板中保存的提交处理函数 + if (typeof window._setHolidayPriceSubmitHandler === 'function') { + window._setHolidayPriceSubmitHandler(layero, index); + } else { + layer.msg('提交处理函数未初始化'); + } + } + }); + } + + // 取消节假日价格确认 + function showCancelHolidayPriceConfirm(dateStr) { + if (!selectedRoomId) { + layer.msg('请先选择房间'); + return; + } + + var selectedRoom = roomOptions.find(function (r) { + return r.id == selectedRoomId; + }); + var roomName = selectedRoom ? selectedRoom.name : '未知房间'; + + // 先检查是否设置了节假日价格 + coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + selectedRoomId + "&date=" + encodeURIComponent(dateStr), function (e) { + if (e.code === 0 && e.data) { + if (!e.data.has_holiday_price) { + layer.msg('该日期没有设置节假日价格'); + return; + } + + // 确认取消 + layer.confirm('确定要取消 ' + roomName + ' 在 ' + dateStr + ' 的节假日价格吗?
取消后将使用普通价格。', { + icon: 3, + title: '取消节假日价格确认' + }, function (confirmIndex) { + // 调用取消节假日价格接口 + coreHelper.Post("Api/SQRoomPricing/DoCancelHolidayPricing", { + date: dateStr, + roomIds: [selectedRoomId] + }, function (e) { + layer.close(confirmIndex); + if (e.code === 0) { + layer.msg(e.msg); + refreshSingleDay(dateStr); // 只刷新当前日期 + } else { + layer.msg(e.msg); + } + }); + }); + } else { + layer.msg(e.msg || '查询失败'); + } + }); + } + // 禁用整天确认 function showDisableAllDayConfirm(dateStr) { if (!selectedRoomId) { @@ -1058,26 +1181,44 @@ // 显示加载中 dayElement.append('
加载中...
'); - coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function (e) { + // 同时加载房间数据和节假日价格标识 + $.when( + $.Deferred(function(dfd) { + coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function(e) { + dfd.resolve(e); + }); + }), + $.Deferred(function(dfd) { + coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + selectedRoomId + "&date=" + encodeURIComponent(dateStr), function(e) { + dfd.resolve(e); + }); + }) + ).done(function(roomResult, holidayResult) { // 再次清空内容(包括加载提示) dayElement.find('div:not(.calendar-day-header)').remove(); - if (e.code === 0 && e.data && Array.isArray(e.data)) { - // 注意:roomId 可能是字符串,需要类型转换比较 - var roomData = e.data.find(function (r) { + // 移除旧的节假日标识 + dayElement.removeClass('has-holiday-price'); + + // 添加节假日标识 + if (holidayResult.code === 0 && holidayResult.data && holidayResult.data.has_holiday_price) { + dayElement.addClass('has-holiday-price'); + } + + // 渲染房间数据 + if (roomResult.code === 0 && roomResult.data && Array.isArray(roomResult.data)) { + var roomData = roomResult.data.find(function (r) { return r.id == selectedRoomId || r.id == parseInt(selectedRoomId); }); - // 使用统一的模板渲染函数 var dayContentHtml = renderDayContent(roomData, null); dayElement.append(dayContentHtml); } else { - var errorMsg = e.msg || '加载失败'; + var errorMsg = roomResult.msg || '加载失败'; var errorHtml = renderDayContent(null, errorMsg); dayElement.append(errorHtml); } }); - } // 加载月度数据 @@ -1103,9 +1244,21 @@ console.log('请求日期:', dateStr); } - coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function (e) { + // 同时加载房间数据和节假日价格标识 + $.when( + $.Deferred(function(dfd) { + coreHelper.Get("Api/SQRoomPricing/GetRoomListWithSlots?date=" + encodeURIComponent(dateStr) + "&showOnlyAvailable=false", function(e) { + dfd.resolve(e); + }); + }), + $.Deferred(function(dfd) { + coreHelper.Get("Api/SQRoomPricing/HasHolidayPricing?roomId=" + roomId + "&date=" + encodeURIComponent(dateStr), function(e) { + dfd.resolve(e); + }); + }) + ).done(function(roomResult, holidayResult) { if (debug) { - console.log('日期:', dateStr, '返回数据:', e); + console.log('日期:', dateStr, '房间数据:', roomResult, '节假日:', holidayResult); } var dayElement = $('#calendarGrid').find('.calendar-day[data-date="' + dateStr + '"]'); @@ -1122,9 +1275,17 @@ // 清空加载提示(保留日期标题) dayElement.find('div:not(.calendar-day-header)').remove(); - if (e.code === 0 && e.data && Array.isArray(e.data)) { - // 注意:roomId 可能是字符串,需要类型转换比较 - var roomData = e.data.find(function (r) { + // 移除旧的节假日标识 + dayElement.removeClass('has-holiday-price'); + + // 添加节假日标识 + if (holidayResult.code === 0 && holidayResult.data && holidayResult.data.has_holiday_price) { + dayElement.addClass('has-holiday-price'); + } + + // 渲染房间数据 + if (roomResult.code === 0 && roomResult.data && Array.isArray(roomResult.data)) { + var roomData = roomResult.data.find(function (r) { return r.id == roomId || r.id == parseInt(roomId); }); @@ -1132,16 +1293,14 @@ console.log('查找房间:', roomId, '找到:', roomData ? '是' : '否'); } - // 使用统一的模板渲染函数 var dayContentHtml = renderDayContent(roomData, null); dayElement.append(dayContentHtml); } else { - var errorMsg = e.msg || '加载失败'; + var errorMsg = roomResult.msg || '加载失败'; var errorHtml = renderDayContent(null, errorMsg); dayElement.append(errorHtml); } }); - }); }