EnumFunctionType.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Cache.Entity
  8. {
  9. public static class EnumFunctionType
  10. {
  11. private static Dictionary<string, string> Fundict = new Dictionary<string, string>() {
  12. { "QGC_SSQ","GetFCSSQList"},{ "QGC_FC3D","GetFC3DList"},{ "QGC_DLT","GetTCDLTList"},{ "QGC_PL3","GetTCP3List"},
  13. { " QGC_QXC","GetTCQXCList"},{"QGC_QLC","GetFCQLCList" },{ "DFC_HC1","GetGDHC1List"},{ "DFC_DF6J1","GetFCDF6J1List"},
  14. { "DFC_ZJTC6J1","GetTCZJ6J1List"},{ "DFC_HD15X5","GetFCHD11X5List"},{ "DFC_JSTC7WS","GetTCJS7WSList"},{ "DFC_HB30X5","GetFCHB30X5List"},
  15. { "DFC_HN22X5","GetFCHN22X5List"},{ "DFC_XJ35X7","GetFCXJ35X7List"},{ "DFC_FJ36X7","GetTCFJ36X7List"},{ "DFC_NYFC36X7","GetFCNY36X7List"},
  16. { "DFC_FJ31X7","GetTCFJ31X7List"}
  17. };
  18. private static Dictionary<string, string> Classdict = new Dictionary<string, string>() {
  19. { "QGC_SSQ","CB.Entity.FCSSQInfo"},{ "QGC_FC3D","CB.Entity.FC3DInfo"},{ "QGC_DLT","CB.Entity.TCDLTInfo"},{ "QGC_PL3","CB.Entity.TCP3Info"},
  20. { " QGC_QXC","CB.Entity.TCQXCInfo"},{"QGC_QLC","CB.Entity.FCQLCInfo" },{ "DFC_HC1","CB.Entity.HC1Info"},{ "DFC_DF6J1","CB.Entity.FCDF6J1Info"},
  21. { "DFC_ZJTC6J1","CB.Entity.TCZJ6J1Info"},{ "DFC_HD15X5","CB.Entity.FCHD11X5Info"},{ "DFC_JSTC7WS","CB.Entity.TCJS7WSInfo"},{ "DFC_HB30X5","CB.Entity.FCHB30X5Info"},{ "DFC_HN22X5","CB.Entity.FCHN22X5Info"},{ "DFC_XJ35X7","CB.Entity.FCXJ35X7Info"},{ "DFC_FJ36X7","CB.Entity.TCFJ36X7Info"},{ "DFC_NYFC36X7","CB.Entity.FCNY36X7Info"},{ "DFC_FJ31X7","CB.Entity.TCFJ31X7Info"}
  22. };
  23. /// <summary>
  24. /// 第一位,总数,第二位 红球,第三位蓝球,不在这的是全红或者其他格式
  25. /// </summary>
  26. private static Dictionary<string, int[]> LotteryBallTypeDict = new Dictionary<string, int[]>() {
  27. { "QGC_SSQ",new int[3] {7,6,1 }},{ "QGC_FC3D",new int[3] {3,3,0}},{ "QGC_DLT",new int[3]{7,5,2 }},{ "QGC_PL3",new int[3]{ 3,3,0}},
  28. { "QGC_PL5",new int[3]{ 5,5,0} },{ "QGC_QXC",new int[3]{ 7,7,0}},{"QGC_QLC",new int[3]{8,7,1 } },{ "DFC_HC1",new int[3]{1,1,0 } },
  29. { "DFC_DF6J1",new int[3]{ 7,6,1}},{ "DFC_ZJTC6J1",new int[3]{7,6,1 }},{ "DFC_HD15X5",new int[3]{5,5,0 } },{ "DFC_JSTC7WS",new int[3]{7,7,0 }},{ "DFC_HB30X5",new int[3]{ 5,5,0} }, { "DFC_HN22X5",new int[3]{ 5,5,0} },{ "DFC_XJ35X7",new int[3]{8,7,1 } },{ "DFC_FJ36X7",new int[3]{8,7,1 } },{ "DFC_NYFC36X7",new int[3]{7,6,1 } },{ "DFC_FJ31X7",new int[3]{ 8,7,1} },{"GPC_BJKL8",new int[]{21,20,1 } }
  30. };
  31. /// <summary>
  32. /// 要三区比的彩种
  33. /// </summary>
  34. public static string[] Sanqu = new string[] {
  35. "QGC_SSQ"
  36. };
  37. /// <summary>
  38. /// 要大小比的彩种
  39. /// </summary>
  40. public static string[] DaxiaoType = new string[] {
  41. "QGC_FC3D","QGC_DLT","QGC_PL3","QGC_PL5"," QGC_QXC","QGC_QLC","DFC_DF6J1","DFC_ZJTC6J1","DFC_HD15X5","DFC_JSTC7WS","DFC_HB30X5","DFC_HN22X5","DFC_FJ36X7","DFC_NYFC36X7","DFC_FJ31X7"
  42. };
  43. /// <summary>
  44. /// 彩票大小比的中间值
  45. /// </summary>
  46. public static Dictionary<string, int> DaXiaoZJZ = new Dictionary<string, int>() {
  47. { "QGC_FC3D",5 },{"QGC_DLT",18 },{ "QGC_PL3",4},{ "QGC_PL5",4},{ " QGC_QXC",5},{ "QGC_QLC",16},{ "QGC_SSQ",17},{ "DFC_DF6J1",6},{"DFC_HD15X5",6 },
  48. { "DFC_JSTC7WS",6},{ "DFC_HB30X5",6},{ "DFC_HN22X5",6},{ "DFC_FJ36X7",6},{ "DFC_NYFC36X7",6},{ "DFC_FJ31X7",6}
  49. };
  50. /// <summary>
  51. /// 中间值计算个数
  52. /// </summary>
  53. private static Dictionary<string, int> DaxiaoCount = new Dictionary<string, int>() {
  54. {"QGC_FC3D",0},{ "QGC_DLT",5},{ "QGC_PL3",0},{ "QGC_PL5",0},{ " QGC_QXC",0},{ "QGC_QLC",0},{ "DFC_DF6J1",7},{ "DFC_ZJTC6J1",7},{"DFC_HD15X5",5 },
  55. { "DFC_JSTC7WS",7},{ "DFC_HB30X5",5},{ "DFC_HN22X5",5},{ "DFC_FJ36X7",8},{ "DFC_NYFC36X7",7},{"DFC_FJ31X7",8 }
  56. };
  57. /// <summary>
  58. /// opencode需要take的数量
  59. /// </summary>
  60. private static Dictionary<string, int> DaxiaoTake = new Dictionary<string, int>() {
  61. {"QGC_PL3",3},{ "QGC_QLC",7}
  62. };
  63. /// <summary>
  64. /// 彩票名字和简写对应
  65. /// </summary>
  66. private static Dictionary<string, string> TypeOfNameDict = new Dictionary<string, string>() {
  67. {"QGC_SSQ","双色球" },{ "QGC_FC3D","福彩3D"},{ "QGC_DLT","大乐透"},{ "QGC_PL3","排列三"},{ "QGC_PL5","排列五"},
  68. { "QGC_QXC","七星彩"},{ "QGC_QLC","七乐彩"},{ "DFC_HC1","好彩1"},{ "DFC_DF6J1","东方6+1"},{ "DFC_ZJTC6J1","浙江6+1"},
  69. { "DFC_HD15X5","华东15选5"},{ "DFC_JSTC7WS","江苏7位数"},{ "DFC_HB30X5","湖北30选5"},{ "DFC_HN22X5","河南22选5"},{"DFC_XJ35X7","新疆35选7" },
  70. { "DFC_FJ36X7","福建36选7"},{ "DFC_NYFC36X7","南粤36选7"},{ "DFC_FJ31X7","福建31选7"},{ "GPC_HLJ11X5","黑龙江11选5"},{ "GPC_JS11X5","江苏11选5"}
  71. ,{ "GPC_HEB11X5","河北11选5"},{ "GPC_GD11X5","广东11选5"},{ "GPC_ZJ11X5","浙江11选5"},{ "GPC_YN11X5","云南11选5"},{ "GPC_JL11X5","吉林11选5"},{ "GPC_JX11X5","江西11选5"},{ "GPC_LN11X5","辽宁11选5"},{ "GPC_SD11X5","山东11选5"},{"GPC_HUB11X5","湖北11选5"},{"GPC_NMG11X5","内蒙古11选5" },{ "GPC_GS11X5","甘肃11选5"},{ "GPC_FJ11X5","福建11选5"},{ "GPC_XJ11X5","新疆11选5"},{ "GPC_SHANX11X5","陕西11选5"},{ "GPC_SX11X5","山西11选5"},
  72. { "GPC_JSK3","江苏快3"},{ "GPC_HBK3","河北快3"},{ "GPC_AHK3","安徽快3"},{ "GPC_NMGK3","内蒙古快3"},{ "GPC_JLK3","吉林快3"},
  73. { "GPC_HUBK3","湖北快3"},{ "GPC_SCKL12","四川快乐12"}, { "GPC_LNKL12","辽宁快乐12"},{ "GPC_ZJKLC","浙江快乐彩"},{ "GPC_SDQYH","山东群英会"},
  74. { "GPC_GDKLSF","广东快乐十分"},{ "GPC_GXKLSF","广西快乐十分"}, {"GPC_SXKLSF","山西快乐十分" },{ "GPC_TJKLSF","天津快乐十分"},{ "GPC_CQKLSF","重庆快乐十分(幸运农场)"},
  75. { "GPC_HNKLSF","湖南快乐十分(动物总动员)"}, { "GPC_BJKL8","北京快乐8"},{ "GPC_BJSCPK10","北京赛车pk10"},{ "GPC_SHSSL","上海时时乐"},{ "GPC_SDKLPK3","快乐扑克3"},
  76. { "GPC_HNXYSC","幸运赛车"},{ "GPC_HNYTDJ","泳坛夺金" }
  77. };
  78. /// <summary>
  79. /// 如果类型在其中就采用不同规则解析详情
  80. /// </summary>
  81. public static string[] ContainDetailType = new string[] {
  82. "QGC_FC3D","QGC_PL3","QGC_PL5"
  83. };
  84. public class LotteryBallType
  85. {
  86. public int Count { get; set; }
  87. public int RedCount { get; set; }
  88. public int BlueCount { get; set; }
  89. }
  90. /// <summary>
  91. /// 根据彩票类型取得彩票名字
  92. /// </summary>
  93. /// <param name="key"></param>
  94. /// <returns></returns>
  95. public static string GetLotteryName(string key)
  96. {
  97. if (TypeOfNameDict.Keys.Contains(key))
  98. {
  99. return TypeOfNameDict[key];
  100. }
  101. else
  102. {
  103. return null;
  104. }
  105. }
  106. /// <summary>
  107. /// 拆解detail字段返回开奖结果
  108. /// </summary>
  109. /// <param name="detail"></param>
  110. /// <returns></returns>
  111. public static List<LotteryResults> GetLotteryResults(string detail, int takenum)
  112. {
  113. try
  114. {
  115. List<LotteryResults> resultsList = new List<LotteryResults>();
  116. string[] results = detail.Split(new char[] { '^', '|', ',' });//前面两个是投注总额和奖池奖金
  117. string[] ary = results.Skip(takenum).ToArray();
  118. for (int i = 0; i < ary.Length / 3; i++)
  119. {
  120. LotteryResults tmplr = new LotteryResults()
  121. {
  122. LevelName = ary[i * 3],
  123. Count = int.Parse(ary[i * 3 + 1]),
  124. Money = ary[i * 3 + 2]
  125. };
  126. resultsList.Add(tmplr);
  127. }
  128. return resultsList;
  129. }
  130. catch (Exception ee)
  131. {
  132. return new List<LotteryResults>();
  133. }
  134. }
  135. /// <summary>
  136. /// 获取p3开奖详情
  137. /// </summary>
  138. /// <param name="detail"></param>
  139. /// <param name="takenum"></param>
  140. /// <returns></returns>
  141. public static List<LotteryResults> GetLotteryResultsP3(string detail)
  142. {
  143. List<LotteryResults> resultsList = new List<LotteryResults>();
  144. try
  145. {
  146. string[] results = detail.Split(new char[] { '^', '|', ',' });//前面1个是投注总额
  147. string[] ary = results.Skip(1).ToArray();
  148. string[] ary2 = ary.Take(ary.Length - 3).ToArray();
  149. for (int i = 0; i < ary2.Length / 3; i++)
  150. {
  151. LotteryResults tmplr = new LotteryResults()
  152. {
  153. LevelName = ary2[i * 3],
  154. Count = int.Parse(ary2[i * 3 + 1]),
  155. Money = ary2[i * 3 + 2]
  156. };
  157. resultsList.Add(tmplr);
  158. }
  159. }
  160. catch (Exception ee)
  161. {
  162. return null;
  163. }
  164. return resultsList;
  165. }
  166. /// <summary>
  167. /// 获取p5开奖详情
  168. /// </summary>
  169. /// <param name="detail"></param>
  170. /// <param name="takenum"></param>
  171. /// <returns></returns>
  172. public static List<LotteryResults> GetLotteryResultsP5(string detail)
  173. {
  174. List<LotteryResults> resultsList = new List<LotteryResults>();
  175. try
  176. {
  177. string[] results = detail.Split(new char[] { '^', '|', ',' });//前面1个是投注总额
  178. string[] ary = results.Skip(results.Length - 3).ToArray();
  179. //string[] ary2 = ary.Take(ary.Length - 3).ToArray();
  180. for (int i = 0; i < ary.Length / 3; i++)
  181. {
  182. LotteryResults tmplr = new LotteryResults()
  183. {
  184. LevelName = ary[i * 3],
  185. Count = int.Parse(ary[i * 3 + 1]),
  186. Money = ary[i * 3 + 2]
  187. };
  188. resultsList.Add(tmplr);
  189. }
  190. }
  191. catch (Exception ee)
  192. {
  193. throw;
  194. }
  195. return resultsList;
  196. }
  197. /// <summary>
  198. /// 根据类名获取take个数
  199. /// </summary>
  200. /// <param name="key"></param>
  201. /// <returns></returns>
  202. public static int GetDaXiaoTake(string key)
  203. {
  204. if (DaxiaoTake.Keys.Contains(key))
  205. {
  206. return DaxiaoTake[key];
  207. }
  208. else
  209. {
  210. return 0;
  211. }
  212. }
  213. /// <summary>
  214. /// 跟据类名获取要计算大小的中间值
  215. /// </summary>
  216. /// <param name="key"></param>
  217. /// <returns></returns>
  218. public static int GetDaXiaoZJZ(string key)
  219. {
  220. if (DaXiaoZJZ.Keys.Contains(key))
  221. {
  222. return DaXiaoZJZ[key];
  223. }
  224. else
  225. {
  226. return 0;
  227. }
  228. }
  229. /// <summary>
  230. /// 根据类型名获取用来计算大小比的个数
  231. /// </summary>
  232. /// <param name="key"></param>
  233. /// <returns></returns>
  234. public static int GetDaxiaoCount(string key)
  235. {
  236. if (DaxiaoCount.Keys.Contains(key))
  237. {
  238. return DaxiaoCount[key];
  239. }
  240. else
  241. {
  242. return 0;
  243. }
  244. }
  245. /// <summary>
  246. /// 跟据类型名获取球类型
  247. /// </summary>
  248. /// <param name="key"></param>
  249. /// <returns></returns>
  250. public static LotteryBallType GetBallType(string key)
  251. {
  252. try
  253. {
  254. if (LotteryBallTypeDict.Keys.Contains(key))
  255. {
  256. int[] value = LotteryBallTypeDict[key];
  257. LotteryBallType rttype = new LotteryBallType()
  258. {
  259. Count = value[0],
  260. RedCount = value[1],
  261. BlueCount = value[2]
  262. };
  263. return rttype;
  264. }
  265. return null;
  266. }
  267. catch (Exception)
  268. {
  269. throw;
  270. }
  271. }
  272. /// <summary>
  273. /// 根据彩票种类获取需要调用的方法名
  274. /// </summary>
  275. /// <param name="key"></param>
  276. /// <returns></returns>
  277. public static string GetFunctionValue(string key)
  278. {
  279. try
  280. {
  281. string value = Fundict[key];
  282. return value;
  283. }
  284. catch (Exception ee)
  285. {
  286. throw;
  287. }
  288. }
  289. public static string GetClassValue(string key)
  290. {
  291. try
  292. {
  293. string value = Classdict[key];
  294. return value;
  295. }
  296. catch (Exception)
  297. {
  298. throw;
  299. }
  300. }
  301. }
  302. }