/// <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> /// <param name="v"></param> /// <returns></returns> public bool IsDown(Lebi_Version v) { string ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/"); string Path = ServerPath + v.Path_rar; if (System.IO.File.Exists(Path)) //如果路径不存在,则创建 { return(true); } else { return(false); } }
/// <summary> /// 下载一个版本的升级文件 /// </summary> public void Version_DownLoad() { if (!EX_Admin.Power("version", "版本管理")) { AjaxNoPower(); return; } //if (!Shop.LebiAPI.Service.Instanse.Check("zaixianshengji")) //{ // Response.Write("{\"msg\":\"" + Tag("权限不足") + "\"}"); // return; //} int id = RequestTool.RequestInt("id"); Lebi_Version model = B_Lebi_Version.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (model.Path_rar == "") { Response.Write("{\"msg\":\"OK\"}"); return; } string remoteUri = Shop.LebiAPI.Service.Instanse.downurl; string fileName = model.Path_rar; string myStringWebResource = null; try { System.Net.WebClient myWebClient = new System.Net.WebClient(); myStringWebResource = remoteUri + fileName; string ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/"); string Path = ServerPath + "/update/"; if (!System.IO.File.Exists(Path)) //如果路径不存在,则创建 { System.IO.Directory.CreateDirectory(Path); } myWebClient.DownloadFile(myStringWebResource, (Path + model.Version + "_" + model.Version_Son.ToString("0.00").Replace(".", "_") + ".rar")); } catch (System.Net.WebException) { } Response.Write("{\"msg\":\"OK\"}"); }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id"); model = B_Lebi_Version.GetModel(id); if (model == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } string ServerPath = System.Web.HttpContext.Current.Server.MapPath("~/"); string Path = ServerPath + model.Path_rar; if (System.IO.File.Exists(Path)) { IsDown = true; } }
public void Version_DBUpdate() { 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; } if (model.IsTypeUpdate == 1) { //更新type表 Shop.LebiAPI.Service.Instanse.UpdateType(); } if (model.IsDBStructUpdate == 1) { //更新数据库结构 Shop.LebiAPI.Service.Instanse.UpdateDBBody(); } if (model.IsSystemMenuUpdate == 1) { //更新系统菜单 Shop.LebiAPI.Service.Instanse.UpdateMenu(); } if (model.IsThemePageUpdate == 1) { //更新系统页面 Shop.LebiAPI.Service.Instanse.UpdateThemePage(); } if (model.IsNodeUpdate == 1) { //更新系统结点 Shop.LebiAPI.Service.Instanse.UpdateNode(); } 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\"}"); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Version model) { D_Lebi_Version.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Version model) { return(D_Lebi_Version.Instance.Add(model)); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Version SafeBindForm(Lebi_Version model) { return(D_Lebi_Version.Instance.SafeBindForm(model)); }