diff --git a/CRICS_V3_1124.suo b/CRICS_V3_1124.suo index 4407d5e..75a686d 100644 Binary files a/CRICS_V3_1124.suo and b/CRICS_V3_1124.suo differ diff --git a/Common/Tools.cs b/Common/Tools.cs index 36b22fc..d63917a 100644 --- a/Common/Tools.cs +++ b/Common/Tools.cs @@ -497,6 +497,22 @@ namespace Common arry[1] = (byte)(data & 0xFF); return arry; } + + // 方法B:自定义字符数组判断 + public static bool ContainsSpecialChars(string input) + { + // 定义特殊字符数组 + char[] specialChars = { + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', + '+', '=', '[', ']', '{', '}', '|', '\\', ':', ';', + '"', '\'', '<', '>', ',', '.', '?', '/', '`', '~' + }; + + // 判断是否包含空白字符(空格、制表符、换行符等) + bool hasWhiteSpace = input.Any(char.IsWhiteSpace); + return input.Any(c => specialChars.Contains(c))&&hasWhiteSpace; + } + /// /// 把int32类型的数据转存到2个字节的byte数组中:小端 /// diff --git a/CommonEntity/Kafka_XinTiao.cs b/CommonEntity/Kafka_XinTiao.cs index d66fd5e..7f76023 100644 --- a/CommonEntity/Kafka_XinTiao.cs +++ b/CommonEntity/Kafka_XinTiao.cs @@ -13,4 +13,24 @@ namespace CommonEntity public string device_id { get; set; } public string room_id { get; set; } } + public struct ShengJi_Log + { + public string hotel_id { get; set; } + public string device_id { get; set; } + public string room_id { get; set; } + public long ts_ms { get; set; } + + public int is_send { get; set; } + public byte[] udp_raw { get; set; } + public object extra { get; set; } + + public string remote_endpoint { get; set; } + + public string md5 { get; set; } + public int partition { get; set; } + public int file_type { get; set; } + public string file_path { get; set; } + public int upgrade_state { get; set; } + public string app_version { get; set; } + } } diff --git a/RCUHost/Implement/UpdateHostCompletedReceiver.cs b/RCUHost/Implement/UpdateHostCompletedReceiver.cs index 3282635..77db855 100644 --- a/RCUHost/Implement/UpdateHostCompletedReceiver.cs +++ b/RCUHost/Implement/UpdateHostCompletedReceiver.cs @@ -10,6 +10,7 @@ using Common; using Dao; using Domain; using RCUHost.Protocols; +using CommonEntity; namespace RCUHost.Implement { @@ -30,6 +31,7 @@ namespace RCUHost.Implement public override void Process(ReceiverContext context) { int startIndex = StructConverter.SizeOf(context.SystemHeader); + var endpoint = context.RemoteEndPoint.ToString(); UpdateHostPacketReply? reply = DecodeUpdateHostPacketReply(context.Data, startIndex); if (reply.HasValue) { @@ -67,6 +69,25 @@ namespace RCUHost.Implement break; } + var host = updateHostWorker.Host; + ShengJi_Log s1 = new ShengJi_Log(); + s1.hotel_id = host.SysHotel.Code; + s1.room_id = host.RoomNumber; + s1.device_id = host.HostNumber; + + s1.is_send = 0; + s1.udp_raw = context.Data; + s1.remote_endpoint = endpoint; + s1.md5 = ""; + s1.partition = 0; + s1.file_type = 0; + s1.file_path = ""; + s1.upgrade_state = reply.Value.Status; + s1.app_version = reply.Value.Version; + + CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1)); + + BarData bbb = new BarData(); bbb.HostID = updateHostWorker.Host.ID; bbb.Upgrade_status = Upgrade_Status; @@ -97,6 +118,24 @@ namespace RCUHost.Implement Upgrade_Status = "升级失败"; break; } + + + ShengJi_Log s1 = new ShengJi_Log(); + s1.hotel_id = host.SysHotel.Code; + s1.room_id = host.RoomNumber; + s1.device_id = host.HostNumber; + + s1.is_send = 0; + s1.udp_raw = context.Data; + s1.remote_endpoint = endpoint; + s1.md5 = ""; + s1.partition = 0; + s1.file_type = 0; + s1.file_path = ""; + s1.upgrade_state = reply.Value.Status; + s1.app_version = reply.Value.Version; + CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1)); + BarData bbb = new BarData(); bbb.HostID = host.ID; bbb.Upgrade_status = Upgrade_Status; diff --git a/RCUHost/Implement/UpdateHostReceiver.cs b/RCUHost/Implement/UpdateHostReceiver.cs index 76d1715..278dca2 100644 --- a/RCUHost/Implement/UpdateHostReceiver.cs +++ b/RCUHost/Implement/UpdateHostReceiver.cs @@ -10,6 +10,7 @@ using Common; using Dao; using Domain; using RCUHost.Protocols; +using CommonEntity; namespace RCUHost.Implement { @@ -221,6 +222,28 @@ namespace RCUHost.Implement byte[] data = CreateUpdateRequestPacket(updateFileMd5, blockNum, fileType, fileName); logger.Error("升级HostNumber为:" + host.HostNumber); logger.Error("升级指令为:" + Tools.ByteToString(data)); + + + ShengJi_Log s1 = new ShengJi_Log(); + s1.hotel_id = host.SysHotel.Code; + s1.room_id = host.RoomNumber; + s1.device_id = host.HostNumber; + + s1.is_send = 1; + s1.udp_raw = data; + string ipAndPort = CSRedisCacheHelper.Get(host.HostNumber, host.MAC); + if (!string.IsNullOrEmpty(ipAndPort)) + { + s1.remote_endpoint = ipAndPort; + } + s1.md5 = updateFileMd5; + s1.partition = blockNum; + s1.file_type = fileType; + s1.file_path = fileName; + s1.upgrade_state = 0; + s1.app_version = host.Version; + CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1)); + Send(data, host.HostNumber, host.MAC);// host.IP, host.Port); } /// diff --git a/WebSite/Controllers/RoomTypeController.cs b/WebSite/Controllers/RoomTypeController.cs index 0a9ffd5..5726fb8 100644 --- a/WebSite/Controllers/RoomTypeController.cs +++ b/WebSite/Controllers/RoomTypeController.cs @@ -1086,6 +1086,11 @@ namespace WebSite.Controllers public ActionResult Save(string jsonData) { RoomType entity = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonData); + + if (Tools.ContainsSpecialChars(entity.Name) || Tools.ContainsSpecialChars(entity.HostName)) + { + return Json(new { IsSuccess = false, Message = "房型名称不得包含特殊符号、空格,命名字数不得超过 N 个文字"}); + } RoomType existRoomType = RoomTypeManager.GetByCode(entity.Code, CurrentHotelID); if (existRoomType != null) { diff --git a/WebSite/Scripts/room-type-index.js b/WebSite/Scripts/room-type-index.js index fcc7718..3bcfc98 100644 --- a/WebSite/Scripts/room-type-index.js +++ b/WebSite/Scripts/room-type-index.js @@ -104,6 +104,9 @@ function delProgramFile() { } //保存房型 function save() { + var a1= $("#txtHostName").val(); + var a2 = $("#txtName").val(); + console.log(a1+"#########"+a2); var form = $('#dialog').find('form'); if (form.form('enableValidation').form('validate')) { var entry = form.serializeJson(); diff --git a/WebSite/Views/RoomType/Edit.ascx b/WebSite/Views/RoomType/Edit.ascx index a0e594f..67caff8 100644 --- a/WebSite/Views/RoomType/Edit.ascx +++ b/WebSite/Views/RoomType/Edit.ascx @@ -32,13 +32,13 @@ - + - + <%--