using System; using System.Collections.Generic; using System.Linq; using System.Web; /// /// 网站配置 /// namespace Basic.BLL { public class siteconfig { private readonly Basic.DAL.siteconfig dal = new Basic.DAL.siteconfig(); /// /// 读取配置文件 /// public Basic.Model.siteconfig loadConfig(string configFilePath) { Basic.Model.siteconfig model = CacheHelper.Get(Keys.CACHE_SITE_CONFIG); if (model == null) { CacheHelper.Insert(Keys.CACHE_SITE_CONFIG, dal.loadConfig(configFilePath), configFilePath); model = CacheHelper.Get(Keys.CACHE_SITE_CONFIG); } return model; } /// /// 读取客户端站点配置信息 /// public Basic.Model.siteconfig loadConfig(string configFilePath, bool isClient) { Basic.Model.siteconfig model = CacheHelper.Get(Keys.CACHE_SITE_CONFIG_CLIENT); if (model == null) { model = dal.loadConfig(configFilePath); model.templateskin = model.webpath + "templates/" + model.templateskin; CacheHelper.Insert(Keys.CACHE_SITE_CONFIG_CLIENT, model, configFilePath); } return model; } public static string getConfig(string valueName) { Basic.BLL.siteconfig bll = new Basic.BLL.siteconfig(); Basic.Model.siteconfig model = bll.loadConfig(Basic.Tools.Utils.GetXmlMapPath(Basic.Keys.FILE_SITE_XML_CONFING)); string strResult = ""; if (model != null) { switch (valueName) { case "appid": strResult = model.Wechat_appid; break; case "appsecret": strResult = model.Wechat_appsecret; break; case "mchid": strResult = model.Wechat_hchid; break; case "key": strResult = model.Wechat_key; break; } } return strResult; } /// /// 保存配置文件 /// public Basic.Model.siteconfig saveConifg(Basic.Model.siteconfig model, string configFilePath) { return dal.saveConifg(model, configFilePath); } } }