FcshsslBll.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using CP.Cache;
  7. using CP.Model;
  8. namespace CP.Business
  9. {
  10. public class FcshsslBll
  11. {
  12. /// <summary>
  13. /// 缓存
  14. /// </summary>
  15. static WMCache cache = WMCache.GetCacheService();
  16. /// <summary>
  17. /// 获取最近多少天数据
  18. /// </summary>
  19. /// <param name="gpenum">高频枚举类型</param>
  20. /// <param name="pagesize">每天的开奖期数</param>
  21. /// <param name="n">多少天</param>
  22. /// <returns></returns>
  23. public static List<FcshsslInfo> GetList(int pagesize,int n = 30)
  24. {
  25. string key = $"DATA-{GPEnum.fcshssl.ToString()}-{pagesize*n}";
  26. List<FcshsslInfo> list = cache.GetObject<List<FcshsslInfo>>(key);
  27. if (list == null)
  28. {
  29. list = FcshsslData.GetList(pagesize * n);
  30. cache.AddObject(key, list, (int)CacheTime.Mintime);
  31. }
  32. return list;
  33. }
  34. /// <summary>
  35. /// 获取指定时间内的数据
  36. /// </summary>
  37. /// <param name="gpenum">枚举</param>
  38. /// <param name="sqi">开始时间</param>
  39. /// <param name="eqi">结束时间</param>
  40. /// <returns></returns>
  41. public static List<FcshsslInfo> GetDayKjList(DateTime sqi, DateTime eqi)
  42. {
  43. string key = $"DATA-{GPEnum.fcshssl.ToString()}-{sqi}-{eqi}";
  44. List<FcshsslInfo> list = cache.GetObject<List<FcshsslInfo>>(key);
  45. if (list == null)
  46. {
  47. list = FcshsslData.GetOneDayKjList(sqi,eqi);
  48. cache.AddObject(key, list, (int)CacheTime.Expert);
  49. }
  50. return list;
  51. }
  52. }
  53. }