增加升级 ,增加 新版本的日志推送

This commit is contained in:
2026-01-30 09:52:17 +08:00
parent 3a5ace4817
commit e4610f1ffa
11 changed files with 413 additions and 47 deletions

View File

@@ -345,12 +345,31 @@ namespace WebSite.Controllers
return Json(new { IsSuccess = false, Message = "升级文件不合法!" });
}
string fileHref = "Uploads/room_type/" + hosts[hosts.Count - 1].RoomType.ID + "/" + fileName;//升级文件相对路径
//string fileMd5 = "";
//using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open))
//{
// fileMd5 = Tools.ComputeFileHash(stream);
// stream.Close();
//}
string fileMd5 = "";
using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open))
string FileKey = "FileMD5_" + fileHref;
string kkka = CSRedisCacheHelper.Get_Partition<string>(FileKey, 3);
if (!string.IsNullOrEmpty(kkka))
{
fileMd5 = Tools.ComputeFileHash(stream);
stream.Close();
fileMd5 = kkka;
}
else
{
using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
fileMd5 = Tools.ComputeFileHash(stream);
CSRedisCacheHelper.Set_PartitionWithTime<string>(FileKey, fileMd5, 5, 3);
stream.Close();
}
}
//HostUpdate hostUpdate = HostUpdateManager.Get(fileMd5, CurrentHotelID);
//if (null == hostUpdate)
//{
@@ -423,7 +442,7 @@ namespace WebSite.Controllers
using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
fileMd5 = Tools.ComputeFileHash(stream);
CSRedisCacheHelper.Set_PartitionWithTime<string>(FileKey, fileMd5, 60 * 60, 3);
CSRedisCacheHelper.Set_PartitionWithTime<string>(FileKey, fileMd5, 5, 3);
stream.Close();
}
}
@@ -472,12 +491,30 @@ namespace WebSite.Controllers
}
//string fileHref = "Uploads/room_type/" + hosts[hosts.Count - 1].RoomType.ID + "/" + fileName;//升级文件相对路径
string fileHref = "Uploads/room_type/" + RoomTypeID + "/" + fileName;//升级文件相对路径
//string fileMd5 = "";
//using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open))
//{
// fileMd5 = Tools.ComputeFileHash(stream);
// stream.Close();
//}
string fileMd5 = "";
using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open))
string FileKey = "FileMD5_" + fileHref;
string kkka = CSRedisCacheHelper.Get_Partition<string>(FileKey, 3);
if (!string.IsNullOrEmpty(kkka))
{
fileMd5 = Tools.ComputeFileHash(stream);
stream.Close();
fileMd5 = kkka;
}
else
{
using (Stream stream = System.IO.File.Open(Tools.GetApplicationPath() + fileHref, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
fileMd5 = Tools.ComputeFileHash(stream);
CSRedisCacheHelper.Set_PartitionWithTime<string>(FileKey, fileMd5, 6, 3);
stream.Close();
}
}
HostManager1.UpdateHostC(null, fileType, fileHref, fileMd5, hosts);
IList<string> hostNumberList = new List<string>();
foreach (Host h in hosts)

View File

@@ -7433,6 +7433,7 @@ namespace WebSite.Controllers
{
var action = item.action;
var name = item.applianceName;
//var area = item.area;
List<HostModal> q1 = new List<HostModal>();
if (name.Equals("灯"))
{
@@ -7440,6 +7441,10 @@ namespace WebSite.Controllers
}
else
{
//if (!string.IsNullOrEmpty(area))
//{
// name = area+ name;
//}
q1 = hostModals.Where(A => A.Modal.Name.Equals(name) || A.Modal.AliasName.Equals(name)).ToList();
}
if (q1 != null && q1.Count > 0)
@@ -7473,8 +7478,14 @@ namespace WebSite.Controllers
{
var action = item.action;
var name = item.applianceName;
//var area = item.area;
var value = item.value;
var q1 = hostModals.Where(A => A.Modal.Type == DeviceType.AirConditioner && (A.Modal.Name.Equals(name)||A.Modal.AliasName.Equals(name)));
//if (!string.IsNullOrEmpty(area))
//{
// name = area + name;
//}
var q1 = hostModals.Where(A => A.Modal.Type == DeviceType.AirConditioner && (A.Modal.Name.Equals(name) || A.Modal.AliasName.Equals(name)));
foreach (var item_inter in q1)
{
int status = 0;
@@ -7553,7 +7564,12 @@ namespace WebSite.Controllers
{
var action = item.action;
var name = item.applianceName;
//var area = item.area;
int hid = int.Parse(hotelid);
//if (!string.IsNullOrEmpty(area))
//{
// name = area + name;
//}
var scene = RoomTypeSceneManager.LoadAll().Where(A => A.HotelID == hid && A.Name.Equals(name)).FirstOrDefault();
if (scene != null)
{
@@ -7581,7 +7597,7 @@ namespace WebSite.Controllers
i.RequestId = msgid;
i.Platform = "ETV";
i.CommandDescription = "success: 控制设备"+JsonConvert.SerializeObject(lla);
i.CommandDescription = "success: 控制设备" + JsonConvert.SerializeObject(lla);
SendMQTTData.Send(i);
}
return Json(new { code = 200, msg = "控制成功" }, JsonRequestBehavior.AllowGet);
@@ -7607,6 +7623,7 @@ namespace WebSite.Controllers
public string action { get; set; }
public string applianceName { get; set; }
public string value { get; set; }
//public string area { get; set; }
}
public class TV_ResponseData
{