Fchb30x5.cs 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CP.Cache;
  6. using CP.Common;
  7. using CP.Model;
  8. namespace CP.Business
  9. {
  10. /// <summary>
  11. /// 湖北30选5
  12. /// </summary>
  13. public class Fchb30x5
  14. {
  15. /// <summary>
  16. /// 缓存
  17. /// </summary>
  18. static WMCache cache = WMCache.GetCacheService();
  19. #region 所有湖北30选5数据
  20. /// <summary>
  21. /// 所有湖北30选5数据 即中原风采30选5
  22. /// </summary>
  23. /// <returns></returns>
  24. public static List<Fchb30x5Info> GetFchb30x5List()
  25. {
  26. string key = string.Format(CacheKeys.Fchb30x5_DATALIST);
  27. List<Fchb30x5Info> list = cache.GetObject<List<Fchb30x5Info>>(key) as List<Fchb30x5Info>;
  28. if (list == null)
  29. {
  30. list = Fchb30x5Data.GetFchb30x5List();
  31. cache.AddObject(key, list, (int)CacheTime.Data);
  32. }
  33. return list;
  34. }
  35. /// <summary>
  36. /// 数据筛选
  37. /// </summary>
  38. /// <param name="pagesize">最近n条</param>
  39. /// <param name="year">某年</param>
  40. /// <param name="sqi">开始期</param>
  41. /// <param name="eqi">结束期</param>
  42. /// <param name="week">星期n(最近120期)</param>
  43. /// <param name="ds">单双期.1=单;2=双(最近120期)</param>
  44. /// <returns></returns>
  45. public static List<Fchb30x5Info> GetFchb30x5List(ref List<Fchb30x5Info> list, int pagesize, int year, int sqi, int eqi, int week = 0, int ds = 0)
  46. {
  47. List<Fchb30x5Info> rlist = new List<Fchb30x5Info>();
  48. if (list == null || list.Count == 0)
  49. return rlist;
  50. int size = list.Count;
  51. if (pagesize > 0)
  52. {
  53. int temp = size - pagesize;
  54. if (temp < 0)
  55. temp = 0;
  56. for (int i = temp; i < size; i++)
  57. {
  58. rlist.Add(list[i]);
  59. }
  60. return rlist;
  61. }
  62. if (year > 0)
  63. {
  64. rlist.Clear();
  65. for (int i = 0; i < size; i++)
  66. {
  67. if (TypeConverter.StrToInt(list[i].qi.ToString().Substring(0, 4), 0) == year)
  68. rlist.Add(list[i]);
  69. }
  70. return rlist;
  71. }
  72. if (week > 0)
  73. {
  74. rlist.Clear();
  75. List<Fchb30x5Info> temp = new List<Fchb30x5Info>();
  76. for (int i = 0; i < size; i++)
  77. {
  78. if (list[i].week == week)
  79. temp.Add(list[i]);
  80. }
  81. int start = 0;
  82. if (temp.Count - 120 > 0)
  83. start = temp.Count - 120;
  84. for (int i = start; i < temp.Count; i++)
  85. {
  86. rlist.Add(temp[i]);
  87. }
  88. return rlist;
  89. }
  90. if (ds > 0)
  91. {
  92. rlist.Clear();
  93. List<Fchb30x5Info> temp = new List<Fchb30x5Info>();
  94. for (int i = 0; i < size; i++)
  95. {
  96. if (ds == 1)
  97. {
  98. if (list[i].qi % 2 != 0)
  99. temp.Add(list[i]);
  100. }
  101. else if (ds == 2)
  102. {
  103. if (list[i].qi % 2 == 0)
  104. temp.Add(list[i]);
  105. }
  106. }
  107. for (int i = (temp.Count - 120); i < temp.Count; i++)
  108. {
  109. rlist.Add(temp[i]);
  110. }
  111. return rlist;
  112. }
  113. if (sqi > 0 && eqi > 0)
  114. {
  115. rlist.Clear();
  116. int srank = GetFchb30x5Info(ref list,sqi).rank;
  117. int erank = GetFchb30x5Info(ref list,eqi).rank;
  118. if (erank != 0 && srank != 0 && erank > srank)
  119. {
  120. for (int i = srank - 1; i < erank && i < size; i++)
  121. {
  122. rlist.Add(list[i]);
  123. }
  124. }
  125. return rlist;
  126. }
  127. ///无参数条件时,返回所有数据
  128. if (pagesize == 0 && year == 0 && sqi == 0 && eqi == 0 && week == 0)
  129. return list;
  130. return rlist;
  131. }
  132. /// <summary>
  133. /// 根据期数获取期一期的数据...
  134. /// </summary>
  135. /// <param name="qi"></param>
  136. /// <returns></returns>
  137. public static Fchb30x5Info GetFchb30x5Info(ref List<Fchb30x5Info> list, int qi)
  138. {
  139. Fchb30x5Info info = new Fchb30x5Info();
  140. int size = list.Count;
  141. for (int i = 0; i < size; i++)
  142. {
  143. if (list[i].qi == qi)
  144. {
  145. info = list[i];
  146. break;
  147. }
  148. }
  149. return info;
  150. }
  151. #endregion
  152. #region 某个排名的上一次数据
  153. /// <summary>
  154. /// 某个排列的上一排名数据
  155. /// </summary>
  156. /// <param name="rank"></param>
  157. /// <returns></returns>
  158. public static Fchb30x5Info GetLastFchb30x5Info(ref List<Fchb30x5Info> list, int rank)
  159. {
  160. Fchb30x5Info info = new Fchb30x5Info();
  161. if (list != null && list.Count > 0)
  162. {
  163. for (int i = rank - 2; i >= 0; i--)
  164. {
  165. if (list[i].rank == rank - 1)
  166. {
  167. info = list[i];
  168. return info;
  169. }
  170. }
  171. }
  172. return info;
  173. }
  174. /// <summary>
  175. /// 上一次大小比=val的数据
  176. /// </summary>
  177. /// <param name="val"></param>
  178. /// <param name="rank"></param>
  179. /// <returns></returns>
  180. public static Fchb30x5Info GetLastDxbFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
  181. {
  182. Fchb30x5Info info = new Fchb30x5Info();
  183. if (list != null && list.Count > 0)
  184. {
  185. for (int i = rank - 2; i >= 0; i--)
  186. {
  187. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  188. if (ZstUtils.GetDxb(kjh,16).Equals(val))
  189. {
  190. return list[i];
  191. }
  192. }
  193. }
  194. return info;
  195. }
  196. /// <summary>
  197. /// 一次大个数=val的数据
  198. /// </summary>
  199. /// <param name="val"></param>
  200. /// <param name="rank"></param>
  201. /// <returns></returns>
  202. public static Fchb30x5Info GetLastDxgsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
  203. {
  204. Fchb30x5Info info = new Fchb30x5Info();
  205. if (list != null && list.Count > 0)
  206. {
  207. for (int i = rank - 2; i >= 0; i--)
  208. {
  209. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  210. string dxb = ZstUtils.GetDxb(kjh,16);
  211. string[] dxs = dxb.Split(':');
  212. int d = 0;
  213. int x = 0;
  214. if (dxs != null && dxs.Length > 0)
  215. {
  216. d = TypeConverter.ObjectToInt(dxs[0], 0);
  217. x = TypeConverter.ObjectToInt(dxs[1], 0);
  218. }
  219. if (type == 1)
  220. {
  221. if (d == val)
  222. return list[i];
  223. }
  224. if (type == 2)
  225. {
  226. if (x == val)
  227. return list[i];
  228. }
  229. }
  230. }
  231. return info;
  232. }
  233. /// <summary>
  234. /// 跨度=val的上一次情况
  235. /// </summary>
  236. /// <param name="val"></param>
  237. /// <param name="rank"></param>
  238. /// <returns></returns>
  239. public static Fchb30x5Info GetLastKdFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  240. {
  241. Fchb30x5Info info = new Fchb30x5Info();
  242. if (list != null && list.Count > 0)
  243. {
  244. for (int i = rank - 2; i >= 0; i--)
  245. {
  246. if (list[i].kd == val)
  247. {
  248. return list[i];
  249. }
  250. }
  251. }
  252. return info;
  253. }
  254. /// <summary>
  255. /// 跨度大小的上一次数据
  256. /// </summary>
  257. /// <param name="val"></param>
  258. /// <param name="rank"></param>
  259. /// <returns></returns>
  260. public static Fchb30x5Info GetLastKdDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  261. {
  262. Fchb30x5Info info = new Fchb30x5Info();
  263. if (list != null && list.Count > 0)
  264. {
  265. int size = list.Count;
  266. for (int i = rank - 2; i >= 0; i--)
  267. {
  268. if (ZstUtils.GetDxBymiddle(list[i].kd, 16) == val)
  269. {
  270. return list[i];
  271. }
  272. }
  273. }
  274. return info;
  275. }
  276. /// <summary>
  277. /// 跨度奇偶的上一次数据
  278. /// </summary>
  279. /// <param name="val"></param>
  280. /// <param name="rank"></param>
  281. /// <returns></returns>
  282. public static Fchb30x5Info GetLastKdJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  283. {
  284. Fchb30x5Info info = new Fchb30x5Info();
  285. if (list != null && list.Count > 0)
  286. {
  287. int size = list.Count;
  288. for (int i = rank - 2; i >= 0; i--)
  289. {
  290. if (ZstUtils.GetJo(list[i].kd) == val)
  291. {
  292. return list[i];
  293. }
  294. }
  295. }
  296. return info;
  297. }
  298. /// <summary>
  299. /// 跨度质合
  300. /// </summary>
  301. /// <param name="val"></param>
  302. /// <param name="rank"></param>
  303. /// <returns></returns>
  304. public static Fchb30x5Info GetLastKdZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  305. {
  306. Fchb30x5Info info = new Fchb30x5Info();
  307. if (list != null && list.Count > 0)
  308. {
  309. int size = list.Count;
  310. for (int i = rank - 2; i >= 0; i--)
  311. {
  312. if (ZstUtils.GetZh(list[i].kd) == val)
  313. {
  314. return list[i];
  315. }
  316. }
  317. }
  318. return info;
  319. }
  320. /// <summary>
  321. /// 跨度012路的上一次数据
  322. /// </summary>
  323. /// <param name="val"></param>
  324. /// <param name="rank"></param>
  325. /// <returns></returns>
  326. public static Fchb30x5Info GetLastKd012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  327. {
  328. Fchb30x5Info info = new Fchb30x5Info();
  329. if (list != null && list.Count > 0)
  330. {
  331. int size = list.Count;
  332. for (int i = rank - 2; i >= 0; i--)
  333. {
  334. if (ZstUtils.Get012(list[i].ac) == val)
  335. {
  336. return list[i];
  337. }
  338. }
  339. }
  340. return info;
  341. }
  342. /// <summary>
  343. /// 河南22x5每位号的大小情况的上一次数据
  344. /// </summary>
  345. /// <param name="val"></param>
  346. /// <param name="site"></param>
  347. /// <param name="rank"></param>
  348. /// <returns></returns>
  349. public static Fchb30x5Info GetLastNumDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
  350. {
  351. Fchb30x5Info info = new Fchb30x5Info();
  352. if (list != null && list.Count > 0)
  353. {
  354. for (int i = rank - 2; i >= 0; i--)
  355. {
  356. if (site == 1)
  357. {
  358. if (ZstUtils.GetDxBymiddle(list[i].n1, 16) == val)
  359. {
  360. return list[i];
  361. }
  362. }
  363. if (site == 2)
  364. {
  365. if (ZstUtils.GetDxBymiddle(list[i].n2, 16) == val)
  366. {
  367. return list[i];
  368. }
  369. }
  370. if (site == 3)
  371. {
  372. if (ZstUtils.GetDxBymiddle(list[i].n3, 16) == val)
  373. {
  374. return list[i];
  375. }
  376. }
  377. if (site == 4)
  378. {
  379. if (ZstUtils.GetDxBymiddle(list[i].n4, 16) == val)
  380. {
  381. return list[i];
  382. }
  383. }
  384. if (site == 5)
  385. {
  386. if (ZstUtils.GetDxBymiddle(list[i].n5, 16) == val)
  387. {
  388. return list[i];
  389. }
  390. }
  391. }
  392. }
  393. return info;
  394. }
  395. /// <summary>
  396. /// 22x5每位号质合的情况
  397. /// </summary>
  398. /// <param name="val"></param>
  399. /// <param name="site"></param>
  400. /// <param name="rank"></param>
  401. /// <returns></returns>
  402. public static Fchb30x5Info GetLastNumZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
  403. {
  404. Fchb30x5Info info = new Fchb30x5Info();
  405. if (list != null && list.Count > 0)
  406. {
  407. for (int i = rank - 2; i >= 0; i--)
  408. {
  409. if (site == 1)
  410. {
  411. if (ZstUtils.GetZh(list[i].n1) == val)
  412. {
  413. return list[i];
  414. }
  415. }
  416. if (site == 2)
  417. {
  418. if (ZstUtils.GetZh(list[i].n2) == val)
  419. {
  420. return list[i];
  421. }
  422. }
  423. if (site == 3)
  424. {
  425. if (ZstUtils.GetZh(list[i].n3) == val)
  426. {
  427. return list[i];
  428. }
  429. }
  430. if (site == 4)
  431. {
  432. if (ZstUtils.GetZh(list[i].n4) == val)
  433. {
  434. return list[i];
  435. }
  436. }
  437. if (site == 5)
  438. {
  439. if (ZstUtils.GetZh(list[i].n5) == val)
  440. {
  441. return list[i];
  442. }
  443. }
  444. }
  445. }
  446. return info;
  447. }
  448. /// <summary>
  449. /// 上一次质合比=val的数据
  450. /// </summary>
  451. /// <param name="val"></param>
  452. /// <param name="rank"></param>
  453. /// <returns></returns>
  454. public static Fchb30x5Info GetLastZhbFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
  455. {
  456. Fchb30x5Info info = new Fchb30x5Info();
  457. if (list != null && list.Count > 0)
  458. {
  459. for (int i = rank - 2; i >= 0; i--)
  460. {
  461. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  462. if (ZstUtils.GetZhb(kjh).Equals(val))
  463. {
  464. return list[i];
  465. }
  466. }
  467. }
  468. return info;
  469. }
  470. /// <summary>
  471. /// 上一次质合数=val的数据
  472. /// </summary>
  473. /// <param name="val"></param>
  474. /// <param name="rank"></param>
  475. /// <returns></returns>
  476. public static Fchb30x5Info GetLastZhgsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
  477. {
  478. Fchb30x5Info info = new Fchb30x5Info();
  479. if (list != null && list.Count > 0)
  480. {
  481. for (int i = rank - 2; i >= 0; i--)
  482. {
  483. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  484. string dxb = ZstUtils.GetZhb(kjh);
  485. string[] dxs = dxb.Split(':');
  486. int d = 0;
  487. int x = 0;
  488. if (dxs != null && dxs.Length > 0)
  489. {
  490. d = TypeConverter.ObjectToInt(dxs[0], 0);
  491. x = TypeConverter.ObjectToInt(dxs[1], 0);
  492. }
  493. if (type == 1)
  494. {
  495. if (d == val)
  496. return list[i];
  497. }
  498. if (type == 2)
  499. {
  500. if (x == val)
  501. return list[i];
  502. }
  503. }
  504. }
  505. return info;
  506. }
  507. #endregion
  508. #region 某个排名的下一次数据
  509. /// <summary>
  510. /// 某个排列的上一排名数据
  511. /// </summary>
  512. /// <param name="rank"></param>
  513. /// <returns></returns>
  514. public static Fchb30x5Info GetNextFchb30x5Info(ref List<Fchb30x5Info> list, int rank)
  515. {
  516. Fchb30x5Info info = new Fchb30x5Info();
  517. if (list != null && list.Count > 0)
  518. {
  519. for (int i = rank - 1; i < list.Count; i++)
  520. {
  521. if (list[i].rank == rank + 1)
  522. {
  523. info = list[i];
  524. return info;
  525. }
  526. }
  527. }
  528. return info;
  529. }
  530. #endregion
  531. #region 某个数据/形态上一次出现的数据
  532. /// <summary>
  533. /// 河南30选5某号码上一次出现时的数据
  534. /// </summary>
  535. /// <param name="val"></param>
  536. /// <param name="rank"></param>
  537. /// <returns></returns>
  538. public static Fchb30x5Info GetLastNumFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  539. {
  540. Fchb30x5Info info = new Fchb30x5Info();
  541. if (list != null && list.Count > 0)
  542. {
  543. int size = list.Count;
  544. for (int i = rank - 2; i >= 0; i--)
  545. {
  546. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  547. if (kjh.Contains(val))
  548. {
  549. info = list[i];
  550. return info;
  551. }
  552. }
  553. }
  554. return info;
  555. }
  556. /// <summary>
  557. /// AC值大小的上一次数据
  558. /// </summary>
  559. /// <param name="val"></param>
  560. /// <param name="rank"></param>
  561. /// <returns></returns>
  562. public static Fchb30x5Info GetLastAcDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  563. {
  564. Fchb30x5Info info = new Fchb30x5Info();
  565. if (list != null && list.Count > 0)
  566. {
  567. int size = list.Count;
  568. for (int i = rank - 2; i >= 0; i--)
  569. {
  570. if (ZstUtils.GetDx(list[i].ac) == val)
  571. {
  572. return list[i];
  573. }
  574. }
  575. }
  576. return info;
  577. }
  578. /// <summary>
  579. /// AC值奇偶的上一次数据
  580. /// </summary>
  581. /// <param name="val"></param>
  582. /// <param name="rank"></param>
  583. /// <returns></returns>
  584. public static Fchb30x5Info GetLastAcJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  585. {
  586. Fchb30x5Info info = new Fchb30x5Info();
  587. if (list != null && list.Count > 0)
  588. {
  589. int size = list.Count;
  590. for (int i = rank - 2; i >= 0; i--)
  591. {
  592. if (ZstUtils.GetJo(list[i].ac) == val)
  593. {
  594. return list[i];
  595. }
  596. }
  597. }
  598. return info;
  599. }
  600. /// <summary>
  601. /// AC值质合
  602. /// </summary>
  603. /// <param name="val"></param>
  604. /// <param name="rank"></param>
  605. /// <returns></returns>
  606. public static Fchb30x5Info GetLastAcZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  607. {
  608. Fchb30x5Info info = new Fchb30x5Info();
  609. if (list != null && list.Count > 0)
  610. {
  611. int size = list.Count;
  612. for (int i = rank - 2; i >= 0; i--)
  613. {
  614. if (ZstUtils.GetZh(list[i].ac) == val)
  615. {
  616. return list[i];
  617. }
  618. }
  619. }
  620. return info;
  621. }
  622. /// <summary>
  623. /// AC值012路的上一次数据
  624. /// </summary>
  625. /// <param name="val"></param>
  626. /// <param name="rank"></param>
  627. /// <returns></returns>
  628. public static Fchb30x5Info GetLastAc012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  629. {
  630. Fchb30x5Info info = new Fchb30x5Info();
  631. if (list != null && list.Count > 0)
  632. {
  633. int size = list.Count;
  634. for (int i = rank - 2; i >= 0; i--)
  635. {
  636. if (ZstUtils.Get012(list[i].ac) == val)
  637. {
  638. return list[i];
  639. }
  640. }
  641. }
  642. return info;
  643. }
  644. /// <summary>
  645. /// AC值=val的上一次情况
  646. /// </summary>
  647. /// <param name="val"></param>
  648. /// <param name="rank"></param>
  649. /// <returns></returns>
  650. public static Fchb30x5Info GetLastAcFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  651. {
  652. Fchb30x5Info info = new Fchb30x5Info();
  653. if (list != null && list.Count > 0)
  654. {
  655. for (int i = rank - 2; i >= 0; i--)
  656. {
  657. if (list[i].ac == val)
  658. {
  659. return list[i];
  660. }
  661. }
  662. }
  663. return info;
  664. }
  665. /// <summary>
  666. /// 上一次AC值振幅的情况
  667. /// </summary>
  668. /// <param name="val"></param>
  669. /// <param name="rank"></param>
  670. /// <returns></returns>
  671. public static Fchb30x5Info GetLastAczfFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  672. {
  673. Fchb30x5Info info = new Fchb30x5Info();
  674. if (list != null && list.Count > 0)
  675. {
  676. for (int i = rank - 2; i >= 0; i--)
  677. {
  678. if (i > 0)
  679. {
  680. if (Math.Abs(list[i].ac - list[i - 1].ac) == val)
  681. {
  682. info = list[i];
  683. return info;
  684. }
  685. }
  686. }
  687. }
  688. return info;
  689. }
  690. /// <summary>
  691. /// 22x5每位号的奇偶情况的上一次数据
  692. /// </summary>
  693. /// <param name="val"></param>
  694. /// <param name="site"></param>
  695. /// <param name="rank"></param>
  696. /// <returns></returns>
  697. public static Fchb30x5Info GetLastNumJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
  698. {
  699. Fchb30x5Info info = new Fchb30x5Info();
  700. if (list != null && list.Count > 0)
  701. {
  702. for (int i = rank - 2; i >= 0; i--)
  703. {
  704. if (site == 1)
  705. {
  706. if (ZstUtils.GetJo(list[i].n1) == val)
  707. {
  708. return list[i];
  709. }
  710. }
  711. if (site == 2)
  712. {
  713. if (ZstUtils.GetJo(list[i].n2) == val)
  714. {
  715. return list[i];
  716. }
  717. }
  718. if (site == 3)
  719. {
  720. if (ZstUtils.GetJo(list[i].n3) == val)
  721. {
  722. return list[i];
  723. }
  724. }
  725. if (site == 4)
  726. {
  727. if (ZstUtils.GetJo(list[i].n4) == val)
  728. {
  729. return list[i];
  730. }
  731. }
  732. if (site == 5)
  733. {
  734. if (ZstUtils.GetJo(list[i].n5) == val)
  735. {
  736. return list[i];
  737. }
  738. }
  739. }
  740. }
  741. return info;
  742. }
  743. /// <summary>
  744. /// 上一次奇偶比=val的数据
  745. /// </summary>
  746. /// <param name="val"></param>
  747. /// <param name="rank"></param>
  748. /// <returns></returns>
  749. public static Fchb30x5Info GetLastJobFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
  750. {
  751. Fchb30x5Info info = new Fchb30x5Info();
  752. if (list != null && list.Count > 0)
  753. {
  754. for (int i = rank - 2; i >= 0; i--)
  755. {
  756. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  757. if (ZstUtils.GetJob(kjh).Equals(val))
  758. {
  759. return list[i];
  760. }
  761. }
  762. }
  763. return info;
  764. }
  765. /// <summary>
  766. /// 一次奇偶数=val的数据
  767. /// </summary>
  768. /// <param name="val"></param>
  769. /// <param name="rank"></param>
  770. /// <returns></returns>
  771. public static Fchb30x5Info GetLastJogsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
  772. {
  773. Fchb30x5Info info = new Fchb30x5Info();
  774. if (list != null && list.Count > 0)
  775. {
  776. for (int i = rank - 2; i >= 0; i--)
  777. {
  778. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  779. string dxb = ZstUtils.GetJob(kjh);
  780. string[] dxs = dxb.Split(':');
  781. int d = 0;
  782. int x = 0;
  783. if (dxs != null && dxs.Length > 0)
  784. {
  785. d = TypeConverter.ObjectToInt(dxs[0], 0);
  786. x = TypeConverter.ObjectToInt(dxs[1], 0);
  787. }
  788. if (type == 1)
  789. {
  790. if (d == val)
  791. return list[i];
  792. }
  793. if (type == 2)
  794. {
  795. if (x == val)
  796. return list[i];
  797. }
  798. }
  799. }
  800. return info;
  801. }
  802. /// <summary>
  803. /// 河南22x5每一位上一次012路情况的数据
  804. /// </summary>
  805. /// <param name="val"></param>
  806. /// <param name="site"></param>
  807. /// <param name="rank"></param>
  808. /// <returns></returns>
  809. public static Fchb30x5Info GetLastNum012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
  810. {
  811. Fchb30x5Info info = new Fchb30x5Info();
  812. if (list != null && list.Count > 0)
  813. {
  814. for (int i = rank - 2; i >= 0; i--)
  815. {
  816. if (site == 1)
  817. {
  818. if (ZstUtils.Get012(list[i].n1) == val)
  819. {
  820. return list[i];
  821. }
  822. }
  823. if (site == 2)
  824. {
  825. if (ZstUtils.Get012(list[i].n2) == val)
  826. {
  827. return list[i];
  828. }
  829. }
  830. if (site == 3)
  831. {
  832. if (ZstUtils.Get012(list[i].n3) == val)
  833. {
  834. return list[i];
  835. }
  836. }
  837. if (site == 4)
  838. {
  839. if (ZstUtils.Get012(list[i].n4) == val)
  840. {
  841. return list[i];
  842. }
  843. }
  844. if (site == 5)
  845. {
  846. if (ZstUtils.Get012(list[i].n5) == val)
  847. {
  848. return list[i];
  849. }
  850. }
  851. }
  852. }
  853. return info;
  854. }
  855. /// <summary>
  856. /// 012个数
  857. /// </summary>
  858. /// <param name="val"></param>
  859. /// <param name="rank"></param>
  860. /// <returns></returns>
  861. public static Fchb30x5Info GetLast012gsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
  862. {
  863. Fchb30x5Info info = new Fchb30x5Info();
  864. if (list != null && list.Count > 0)
  865. {
  866. for (int i = rank - 2; i >= 0; i--)
  867. {
  868. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  869. int c1 = ZstUtils.Get012Count(0, kjh);
  870. int c2 = ZstUtils.Get012Count(1, kjh);
  871. int c3 = ZstUtils.Get012Count(2, kjh);
  872. if (type == 0)
  873. {
  874. if (c1 == val)
  875. return list[i];
  876. }
  877. if (type == 1)
  878. {
  879. if (c2 == val)
  880. return list[i];
  881. }
  882. if (type == 2)
  883. {
  884. if (c3 == val)
  885. return list[i];
  886. }
  887. }
  888. }
  889. return info;
  890. }
  891. /// <summary>
  892. /// 河南30选5和值范围上一次的情况
  893. /// </summary>
  894. /// <param name="shz"></param>
  895. /// <param name="ehz"></param>
  896. /// <param name="rank"></param>
  897. /// <returns></returns>
  898. public static Fchb30x5Info GetLastHzFchb30x5Info(ref List<Fchb30x5Info> list, int shz, int ehz, int rank)
  899. {
  900. Fchb30x5Info info = new Fchb30x5Info();
  901. if (list != null && list.Count > 0)
  902. {
  903. for (int i = rank - 2; i >= 0; i--)
  904. {
  905. if (list[i].hz >= shz && list[i].hz <= ehz)
  906. {
  907. return list[i];
  908. }
  909. }
  910. }
  911. return info;
  912. }
  913. /// <summary>
  914. /// 和值上一次奇偶的情况
  915. /// </summary>
  916. /// <param name="val"></param>
  917. /// <param name="rank"></param>
  918. /// <returns></returns>
  919. public static Fchb30x5Info GetLastHzJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  920. {
  921. Fchb30x5Info info = new Fchb30x5Info();
  922. if (list != null && list.Count > 0)
  923. {
  924. for (int i = rank - 2; i >= 0; i--)
  925. {
  926. if (ZstUtils.GetJo(list[i].hz) == val)
  927. {
  928. return list[i];
  929. }
  930. }
  931. }
  932. return info;
  933. }
  934. /// <summary>
  935. /// 和值上一次012的情况
  936. /// </summary>
  937. /// <param name="val"></param>
  938. /// <param name="rank"></param>
  939. /// <returns></returns>
  940. public static Fchb30x5Info GetLastHz012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  941. {
  942. Fchb30x5Info info = new Fchb30x5Info();
  943. if (list != null && list.Count > 0)
  944. {
  945. for (int i = rank - 2; i >= 0; i--)
  946. {
  947. if (ZstUtils.Get012(list[i].hz) == val)
  948. {
  949. return list[i];
  950. }
  951. }
  952. }
  953. return info;
  954. }
  955. /// <summary>
  956. /// 上一次和尾的数据
  957. /// </summary>
  958. /// <param name="val"></param>
  959. /// <param name="rank"></param>
  960. /// <returns></returns>
  961. public static Fchb30x5Info GetLastHwFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  962. {
  963. Fchb30x5Info info = new Fchb30x5Info();
  964. if (list != null && list.Count > 0)
  965. {
  966. for (int i = rank - 2; i >= 0; i--)
  967. {
  968. if (ZstUtils.GetHw(list[i].hz) == val)
  969. {
  970. return list[i];
  971. }
  972. }
  973. }
  974. return info;
  975. }
  976. /// <summary>
  977. /// 上一次和尾大小的数据
  978. /// </summary>
  979. /// <param name="val"></param>
  980. /// <param name="rank"></param>
  981. /// <returns></returns>
  982. public static Fchb30x5Info GetLastHwDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  983. {
  984. Fchb30x5Info info = new Fchb30x5Info();
  985. if (list != null && list.Count > 0)
  986. {
  987. for (int i = rank - 2; i >= 0; i--)
  988. {
  989. if (ZstUtils.GetDx(ZstUtils.GetHw(list[i].hz)) == val)
  990. {
  991. return list[i];
  992. }
  993. }
  994. }
  995. return info;
  996. }
  997. /// <summary>
  998. /// 上一次和尾奇偶的情况
  999. /// </summary>
  1000. /// <param name="val"></param>
  1001. /// <param name="rank"></param>
  1002. /// <returns></returns>
  1003. public static Fchb30x5Info GetLastHwJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  1004. {
  1005. Fchb30x5Info info = new Fchb30x5Info();
  1006. if (list != null && list.Count > 0)
  1007. {
  1008. for (int i = rank - 2; i >= 0; i--)
  1009. {
  1010. if (ZstUtils.GetJo(ZstUtils.GetHw(list[i].hz)) == val)
  1011. {
  1012. return list[i];
  1013. }
  1014. }
  1015. }
  1016. return info;
  1017. }
  1018. /// <summary>
  1019. /// 上一次和尾012路的情况
  1020. /// </summary>
  1021. /// <param name="val"></param>
  1022. /// <param name="rank"></param>
  1023. /// <returns></returns>
  1024. public static Fchb30x5Info GetLastHw012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  1025. {
  1026. Fchb30x5Info info = new Fchb30x5Info();
  1027. if (list != null && list.Count > 0)
  1028. {
  1029. for (int i = rank - 2; i >= 0; i--)
  1030. {
  1031. if (ZstUtils.Get012(ZstUtils.GetHw(list[i].hz)) == val)
  1032. {
  1033. return list[i];
  1034. }
  1035. }
  1036. }
  1037. return info;
  1038. }
  1039. /// <summary>
  1040. /// 上一次3连形态=val时的数据
  1041. /// </summary>
  1042. /// <param name="val"></param>
  1043. /// <param name="rank"></param>
  1044. /// <returns></returns>
  1045. public static Fchb30x5Info GetLast3lhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
  1046. {
  1047. Fchb30x5Info info = new Fchb30x5Info();
  1048. if (list != null && list.Count > 0)
  1049. {
  1050. int size = list.Count;
  1051. for (int i = rank - 2; i >= 0; i--)
  1052. {
  1053. List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
  1054. if (ZstUtils.GetIs3lh(kjh) == val)
  1055. {
  1056. return list[i];
  1057. }
  1058. }
  1059. }
  1060. return info;
  1061. }
  1062. #endregion
  1063. #region 开奖公告相关方法
  1064. /// <summary>
  1065. /// 最近30期开奖数据,完整开奖信息,有缓存
  1066. /// </summary>
  1067. /// <returns></returns>
  1068. public static List<Fchb30x5LongInfo> GetFchb30x5ListTop30()
  1069. {
  1070. string key = string.Format(CacheKeys.Fchb30x5_KJH_DATA);
  1071. List<Fchb30x5LongInfo> list = cache.GetObject<List<Fchb30x5LongInfo>>(key) as List<Fchb30x5LongInfo>;
  1072. if (list == null)
  1073. {
  1074. list = Fchb30x5Data.GetFchb30x5Top30();
  1075. cache.AddObject(key, list, (int)CacheTime.Kjh);
  1076. }
  1077. return list;
  1078. }
  1079. /// <summary>
  1080. /// 获取最新一期开奖信息,完整开奖信息,有缓存
  1081. /// </summary>
  1082. /// <returns></returns>
  1083. public static Fchb30x5LongInfo GetFchb30x5InfoTop1(ref List<Fchb30x5LongInfo> list)
  1084. {
  1085. Fchb30x5LongInfo info = new Fchb30x5LongInfo();
  1086. if (list.Count > 0)
  1087. {
  1088. info = list[0];
  1089. }
  1090. return info;
  1091. }
  1092. /// <summary>
  1093. /// 根据期数返回某期完整开奖信息,无缓存
  1094. /// </summary>
  1095. /// <param name="qi"></param>
  1096. /// <returns></returns>
  1097. public static Fchb30x5LongInfo GetFchb30x5InfoByqi(int qi)
  1098. {
  1099. return Fchb30x5Data.GetFchb30x5InfoByQi(qi);
  1100. }
  1101. /// <summary>
  1102. /// 返回某年对应的期数列表,有缓存
  1103. /// </summary>
  1104. /// <param name="year"></param>
  1105. /// <returns></returns>
  1106. public static List<int> GetFchb30x5QiListByYear(int year)
  1107. {
  1108. string key = string.Format(CacheKeys.Fchb30x5_KJH_DATA + "/qilistbyyear/{0}", year);
  1109. List<int> list = cache.GetObject<List<int>>(key) as List<int>;
  1110. if (list == null)
  1111. {
  1112. list = Fchb30x5Data.GetFchb30x5QiListByYear(year);
  1113. cache.AddObject(key, list, (int)CacheTime.System);
  1114. }
  1115. return list;
  1116. }
  1117. #endregion
  1118. }
  1119. }