升级 ,以及修复一些BUG
This commit is contained in:
@@ -3856,8 +3856,6 @@ namespace WebSite.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ReallyUpgrade(string 房型ID, string host_list_str, string fileName)
|
||||
{
|
||||
int roomTypeID = 0;
|
||||
@@ -3937,6 +3935,23 @@ namespace WebSite.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPost()]
|
||||
public ActionResult Upgrade_V2(string roomtype_id, string host_list_str, string fileName)
|
||||
{
|
||||
int roomTypeID = 0;
|
||||
int.TryParse(roomtype_id, out roomTypeID);
|
||||
|
||||
logger.Error("微信端开始升级: " + fileName + " " + roomTypeID + " host_list: " + host_list_str);
|
||||
var host_list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<int>>(host_list_str);
|
||||
|
||||
//不用获取,直接在本地使用
|
||||
string lll = JsonConvert.SerializeObject(host_list);
|
||||
HostUpdateController hh = new HostUpdateController();
|
||||
logger.Error("开始升级: " + fileName + " host_list: " + lll);
|
||||
//升级
|
||||
return hh.新改造(host_list, fileName,roomTypeID,HostManager);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -7474,7 +7474,7 @@ namespace WebSite.Controllers
|
||||
var action = item.action;
|
||||
var name = item.applianceName;
|
||||
var value = item.value;
|
||||
var q1 = hostModals.Where(A => A.Modal.Type == DeviceType.AirConditioner && A.Modal.Name.Equals(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;
|
||||
|
||||
Reference in New Issue
Block a user