/// <summary> /// 获得会员对应的属性选项列表 /// </summary> /// <param name="attrName"></param> /// <returns></returns> public static List <string> GetCustomerAttributeList(string attrName) { string key = "root_CustomerAttribute_" + attrName; var data = DataCacheCommon.GetCache(key) as List <string>; if (data == null) { XmlCommon xc = new XmlCommon(); string nodeName = "root/CustomerAttribute/" + attrName; data = xc.GetNodesText(nodeName); DataCacheCommon.SaveCacheValue(key, data, 30); } return(data); }
/// <summary> /// 城市表Id找名字 /// </summary> /// <param name="mr"></param> /// <param name="reset"></param> /// <returns></returns> public static string GetNameByCityId(int id, bool reset = false) { string key = "sysCity_" + id.ToString(); string name = ""; if (DataCacheCommon.GetCacheValue(key) == null || reset) { name = GetCityList(reset).Where(c => c.Id == id).FirstOrDefault().Name; DataCacheCommon.SaveCacheValue(key, name, Convert.ToDouble(30)); } else { name = (string)DataCacheCommon.GetCacheValue(key); } return(name); }
static object LockDirectoryMessageClassify = new object(); //目录查询对应分类编号 #region 客户业务缓存 #endregion #region 常用对象缓存 /// <summary> /// 城市表 /// </summary> /// <param name="mr"></param> /// <param name="reset"></param> /// <returns></returns> public static List <SysCity> GetCityList(bool reset) { string key = "sysCityCache"; List <SysCity> list = new List <SysCity>(); if (DataCacheCommon.GetCacheValue(key) == null || reset) { SysCityMan scMan = new SysCityMan(); list = scMan.GetList(); DataCacheCommon.SaveCacheValue(key, list, Convert.ToDouble(30)); } else { list = (List <SysCity>)DataCacheCommon.GetCacheValue(key); } return(list); }
/// <summary> /// 从缓存中获得人工客服一天中开始时间 /// </summary> /// <param name="reset">是否重置</param> /// <returns>开始时间列表</returns> /// Author:fredjiang /// Created:2016-02-23 public static List <string> GetCustomerServiceStartTime(bool reset) { lock (LockCustomerServiceConfigCache) { string key = "customer_service_start_time"; List <string> list = new List <string>(); if (DataCacheCommon.GetCacheValue(key) == null || reset) { list = XmlTools.GetCustomerServiceStartTime(); if (list.Count > 0) { DataCacheCommon.SaveCacheValue(key, list, 30); } } else { list = (List <string>)DataCacheCommon.GetCacheValue(key); } return(list); } }
/// <summary> /// 从缓存中获得人工客服一周中服务的天 /// </summary> /// <param name="reset">是否重置</param> /// <returns>周的天列表</returns> /// Author:fredjiang /// Created:2016-02-23 public static List <int> GetCustomerServiceWeekDay(bool reset) { lock (LockCustomerServiceConfigCache) { string key = "customer_service_week_day"; List <int> list = new List <int>(); if (DataCacheCommon.GetCacheValue(key) == null || reset) { list = XmlTools.GetCustomerServiceWeekDay(); if (list.Count > 0) { DataCacheCommon.SaveCacheValue(key, list, 30); } } else { list = (List <int>)DataCacheCommon.GetCacheValue(key); } return(list); } }
/// <summary> /// 从缓存中获得人工客服聊天空闲时间 /// </summary> /// <param name="reset">是否重置</param> /// <returns>空闲时间(分钟)</returns> /// Author:fredjiang /// Created:2016-02-23 public static int GetCustomerServiceWaitingTime(bool reset) { lock (LockCustomerServiceConfigCache) { string key = "customer_service_waiting_time"; int result = 0; if (DataCacheCommon.GetCacheValue(key) == null || reset) { result = XmlTools.GetCustomerServiceWaitingTime(); if (result <= 0) { result = 5; } DataCacheCommon.SaveCacheValue(key, result, 30); } else { result = (int)DataCacheCommon.GetCacheValue(key); } return(result); } }