增加升级 ,增加 新版本的日志推送
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user