Fchb22x5.cs 38 KB

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