升级 ,以及修复一些BUG

This commit is contained in:
2026-01-23 09:01:50 +08:00
parent f038ca3260
commit 3a5ace4817
20 changed files with 1218 additions and 25 deletions

View File

@@ -384,7 +384,67 @@ namespace WebSite.Controllers
}
public ActionResult ShengJI_NEW(IList<int> idList, string fileName, IHostManager HostManager1,int RoomTypeID)
public ActionResult (IList<int> idList, string fileName, int RoomTypeID, IHostManager HostManager1)
{
try
{
IList<Host> hosts = new List<Host>();
foreach (int id in idList)
{
Host host = HostManager1.Get(id);
if (host != null)
{
hosts.Add(host);
}
}
FileType fileType = FileType.Config;
switch (fileName.Substring(fileName.Length - 3).ToLower())
{
case "bin":
case "hex":
fileType = FileType.Firmware;
break;
case "dat":
fileType = FileType.Config;
break;
default:
return Json(new { IsSuccess = false, Message = "升级文件不合法!" });
}
string fileHref = "Uploads/V2/room_type/" + RoomTypeID + "/" + fileName;//升级文件相对路径
string fileMd5 = "";
string FileKey = "FileMD5_" + fileHref;
string kkka = CSRedisCacheHelper.Get_Partition<string>(FileKey, 3);
if (!string.IsNullOrEmpty(kkka))
{
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, 60 * 60, 3);
stream.Close();
}
}
HostManager1.UpdateHostC(null, fileType, fileHref, fileMd5, hosts);
//IList<string> hostNumberList = new List<string>();
//foreach (Host h in hosts)
//{
// hostNumberList.Add(h.RoomNumber);
//}
return Json(new { IsSuccess = true, Message = "shengji" });
}
catch (Exception ex)
{
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
return Json(new { IsSuccess = false, Message = ex.Message });
}
}
public ActionResult ShengJI_NEW(IList<int> idList, string fileName, IHostManager HostManager1, int RoomTypeID)
{
try
{