/// <summary> /// 已经手动更新时调用 /// </summary> public void Version_UpdateOK() { if (!EX_Admin.Power("version", "版本管理")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id"); Lebi_Version model = B_Lebi_Version.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //更新版本号 BaseConfig cf = new BaseConfig(); cf.Version_Son = model.Version_Son.ToString(); cf.Version = model.Version.ToString(); B_BaseConfig bcf = new B_BaseConfig(); bcf.SaveConfig(cf); model.IsUpdate = 1; model.Time_Update = System.DateTime.Now; B_Lebi_Version.Update(model); //同步版本号 Shop.LebiAPI.Service.Instanse.UpdateVersionCode(); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 解压部署文件 /// </summary> public void Version_FileUpdate() { if (!EX_Admin.Power("version", "版本管理")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id"); int IsUpdated = RequestTool.RequestInt("IsUpdated", 0); Lebi_Version model = B_Lebi_Version.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (!Shop.LebiAPI.Service.Instanse.ISRightVersion(SYS, model)) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //if (IsUpdated == 0) //{ if (model.Path_rar != "") { //文件解包+部署文件 string nistring = HtmlEngine.ReadTxt("/config/noupdate.txt"); UpDate.DecompressFile(model.Path_rar, "/", nistring); //执行更新程序 try { string url = "http://" + HttpContext.Current.Request.Url.Authority + "/update/update.aspx"; string res = HtmlEngine.CetHtml(url); if (res.Contains("OK")) { string ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/"); string fileUrl = ServerPath + "/update/update.aspx"; if (File.Exists(fileUrl)) { File.Delete(fileUrl); } //fileUrl = ServerPath + "/update.aspx.cs"; //if (File.Exists(fileUrl)) //{ // File.Delete(fileUrl); //} } } catch { } //执行sql string sqlfile = WebPath + "/update/update.sql"; if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "access") { sqlfile = WebPath + "/update/update_access.sql"; } //string sql = HtmlEngine.ReadTxt(sqlfile); //if (sql != null) //{ // if (sql != "") // Common.ExecuteSql(sql); //} string fileName = HttpContext.Current.Server.MapPath(@"~/" + sqlfile); if (File.Exists(fileName)) { using (FileStream fs = new FileStream(fileName, FileMode.Open)) { using (StreamReader reader = new StreamReader(fs, Encoding.UTF8)) { string text = string.Empty; while (!reader.EndOfStream) { try { text = reader.ReadLine(); if (text != "") { Common.ExecuteSql(text); } } catch { } } } } } } //} //if (model.IsTypeUpdate == 1) //{ // //更新type表 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateType)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsDBStructUpdate == 1) //{ // //更新数据库结构 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateDBBody)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsSystemMenuUpdate == 1) //{ // //更新系统菜单 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateMenu)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsThemePageUpdate == 1) //{ // //更新系统页面 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateThemePage)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsNodeUpdate == 1) //{ // //更新系统结点 // Thread thread = new Thread(new ThreadStart(Shop.LebiAPI.Service.Instanse.UpdateNode)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsSystemPageUpdate == 1) //{ // //更新系统页面 // Thread thread = new Thread(new ThreadStart(SystemTheme.CreateSystemPage)); // thread.IsBackground = true; // thread.Start(); //} //if (model.IsPageUpdate == 1) //{ // //更新所有前台页面 // Thread thread = new Thread(new ThreadStart(Shop.Bussiness.Theme.CreateThemeALL)); // thread.IsBackground = true; // thread.Start(); //} //更新版本号 BaseConfig cf = new BaseConfig(); cf.Version_Son = model.Version_Son.ToString(); cf.Version = model.Version.ToString(); B_BaseConfig bcf = new B_BaseConfig(); bcf.SaveConfig(cf); model.IsUpdate = 1; model.Time_Update = System.DateTime.Now; B_Lebi_Version.Update(model); //同步版本号 Shop.LebiAPI.Service.Instanse.UpdateVersionCode(); Response.Write("{\"msg\":\"OK\"}"); }