/// <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\"}"); }
public void AgentConfig_Set() { if (!EX_Admin.Power("agent_config", "代理-参数设置")) { AjaxNoPower(); return; } B_BaseConfig dob = new B_BaseConfig(); BaseConfig model = new BaseConfig(); model.Angent_Commission = RequestTool.RequestString("Angent_Commission"); model.Angent_Commission_require = RequestTool.RequestString("Angent_Commission_require"); model.Angent1_Commission = RequestTool.RequestString("Angent1_Commission"); model.Angent2_Commission = RequestTool.RequestString("Angent2_Commission"); model.Angent3_Commission = RequestTool.RequestString("Angent3_Commission"); model.IsUsedAgent = RequestTool.RequestString("IsUsedAgent"); model.IsUsedAgent_Area = RequestTool.RequestString("IsUsedAgent_Area"); model.IsUsedAgent_Product = RequestTool.RequestString("IsUsedAgent_Product"); model.CommissionMoneyDays = RequestTool.RequestString("CommissionMoneyDays"); model.AgentEndDays = RequestTool.RequestString("AgentEndDays"); dob.SaveConfig(model); Log.Add("代理-参数设置", "Config", "", CurrentAdmin, ""); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 设置授权 /// </summary> public void Licence_Set() { if (!EX_Admin.Power("License_set", "账户设置")) { AjaxNoPower(); return; } string LicenseUserName = RequestTool.RequestString("LicenseUserName"); string LicensePWD = RequestTool.RequestString("LicensePWD"); if (LicensePWD == "******") { LicensePWD = SYS.LicensePWD; } string LicenseDomain = RequestTool.RequestString("LicenseDomain").ToLower(); BaseConfig cf = new BaseConfig(); cf.LicensePWD = LicensePWD; cf.LicenseUserName = LicenseUserName; cf.LicenseDomain = LicenseDomain; B_BaseConfig dob = new B_BaseConfig(); //============================================ //获取服务端权限 LBAPI_Licencse api; try { string res = Shop.LebiAPI.Service.Instanse.License_Set("SetUser", "username="******"&pwd=" + LicensePWD + "&domain=" + LicenseDomain + "&Version=" + ShopCache.GetBaseConfig().Version + "&Version_Son=" + ShopCache.GetBaseConfig().Version_Son + "&code=" + cf.InstallCode); JavaScriptSerializer jss = new JavaScriptSerializer(); api = jss.Deserialize <LBAPI_Licencse>(res); cf.LicenseMD5 = api.md5 == null ? "" : api.md5; cf.LicenseString = api.data == null ? "" : api.data; cf.LicenseDomain = api.domain; cf.SpreadCode = api.spreadcode == null ? "" : api.spreadcode; cf.LicensePackage = api.servicepackage == null ? "" : api.servicepackage; dob.SaveConfig(cf); ////<-{修改Web.config文件让授权即时生效 by lebi.kingdge 2018.10.12 //string path = base.Server.MapPath("../../Web.config"); //try //{ // string contents = string.Empty; // contents = File.ReadAllText(path) + "\r\n"; // File.WriteAllText(path, contents); //} //catch (Exception e) { } ////}-> ShopCache.SetLicense(); Response.Write("{\"msg\":\"" + api.msg + "\"}"); } catch (Exception ex) { Response.Write("{\"msg\":\"" + ex.Message + "\"}"); } }
/// <summary> /// 设置授权 /// </summary> public void Licence_Set() { if (!EX_Admin.Power("License_set", "账户设置")) { AjaxNoPower(); return; } string LicenseUserName = RequestTool.RequestString("LicenseUserName"); string LicensePWD = RequestTool.RequestString("LicensePWD"); if (LicensePWD == "******") { LicensePWD = SYS.LicensePWD; } string LicenseDomain = RequestTool.RequestString("LicenseDomain").ToLower(); BaseConfig cf = new BaseConfig(); cf.LicensePWD = LicensePWD; cf.LicenseUserName = LicenseUserName; cf.LicenseDomain = LicenseDomain; B_BaseConfig dob = new B_BaseConfig(); //============================================ //获取服务端权限 LBAPI_Licencse api; try { string res = Shop.LebiAPI.Service.Instanse.License_Set("SetUser", "username="******"&pwd=" + LicensePWD + "&domain=" + LicenseDomain + "&Version=" + ShopCache.GetBaseConfig().Version + "&Version_Son=" + ShopCache.GetBaseConfig().Version_Son + "&code=" + cf.InstallCode); JavaScriptSerializer jss = new JavaScriptSerializer(); api = jss.Deserialize <LBAPI_Licencse>(res); cf.LicenseMD5 = api.md5 == null ? "" : api.md5; cf.LicenseString = api.data == null ? "" : api.data; cf.LicenseDomain = api.domain; cf.SpreadCode = api.spreadcode == null ? "" : api.spreadcode; cf.LicensePackage = api.servicepackage == null ? "" : api.servicepackage; dob.SaveConfig(cf); ShopCache.SetLicense(); Response.Write("{\"msg\":\"" + api.msg + "\"}"); } catch (Exception ex) { Response.Write("{\"msg\":\"" + ex.Message + "\"}"); } }
/// <summary> /// 设置授权 /// 未登录系统时 /// 为保证安全,此方法只能在未设置时才能使用 /// </summary> public void Licence_Set() { BaseConfig bcf = ShopCache.GetBaseConfig(); if (bcf.LicenseUserName != "" && bcf.LicensePWD != "") { Response.Write("{\"msg\":\"" + Language.Tag("请登录后操作", CurrentLanguage.Code) + "\"}"); return; } string LicenseUserName = RequestTool.RequestString("LicenseUserName"); string LicensePWD = RequestTool.RequestString("LicensePWD"); string LicenseDomain = RequestTool.RequestString("LicenseDomain").ToLower(); BaseConfig cf = new BaseConfig(); cf.LicensePWD = LicensePWD; cf.LicenseUserName = LicenseUserName; cf.LicenseDomain = LicenseDomain; B_BaseConfig dob = new B_BaseConfig(); //============================================ //获取服务端权限 LBAPI_Licencse api; try { string res = Shop.LebiAPI.Service.Instanse.License_Set("SetUser", "username="******"&pwd=" + LicensePWD + "&domain=" + LicenseDomain + "&Version=" + ShopCache.GetBaseConfig().Version + "&Version_Son=" + ShopCache.GetBaseConfig().Version_Son); JavaScriptSerializer jss = new JavaScriptSerializer(); api = jss.Deserialize <LBAPI_Licencse>(res); } catch (Exception) { api = new LBAPI_Licencse(); } if (api.msg == "OK") { cf.LicenseMD5 = api.md5 == null ? "" : api.md5; cf.LicenseString = api.data == null ? "" : api.data; cf.LicensePackage = api.servicepackage == null ? "" : api.servicepackage; dob.SaveConfig(cf); } Response.Write("{\"msg\":\"" + api.msg + "\"}"); }
/// <summary> /// 更新插件状态 /// </summary> public void Plugin_updatestatus() { if (!EX_Admin.Power("pluginconfig_edit", "插件设置")) { AjaxNoPower(); return; } string name = RequestTool.RequestString("id"); string status = ""; string[] arr = SYS.PluginUsed.Split(','); bool ishave = false; foreach (string aname in arr) { if (aname == name) { ishave = true; continue; } if (aname != "") { status += "," + aname; } } if (!ishave) { //启用一个插件 status += "," + name; } B_BaseConfig dob = new B_BaseConfig(); BaseConfig model = new BaseConfig(); model.PluginUsed = status; dob.SaveConfig(model); 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\"}"); }