12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CP.Cache;
- using CP.Common;
- using CP.Model;
- namespace CP.Business
- {
- /// <summary>
- /// 湖北30选5
- /// </summary>
- public class Fchb30x5
- {
- /// <summary>
- /// 缓存
- /// </summary>
- static WMCache cache = WMCache.GetCacheService();
- #region 所有湖北30选5数据
- /// <summary>
- /// 所有湖北30选5数据 即中原风采30选5
- /// </summary>
- /// <returns></returns>
- public static List<Fchb30x5Info> GetFchb30x5List()
- {
- string key = string.Format(CacheKeys.Fchb30x5_DATALIST);
- List<Fchb30x5Info> list = cache.GetObject<List<Fchb30x5Info>>(key) as List<Fchb30x5Info>;
- if (list == null)
- {
- list = Fchb30x5Data.GetFchb30x5List();
- cache.AddObject(key, list, (int)CacheTime.Data);
- }
- return list;
- }
- /// <summary>
- /// 数据筛选
- /// </summary>
- /// <param name="pagesize">最近n条</param>
- /// <param name="year">某年</param>
- /// <param name="sqi">开始期</param>
- /// <param name="eqi">结束期</param>
- /// <param name="week">星期n(最近120期)</param>
- /// <param name="ds">单双期.1=单;2=双(最近120期)</param>
- /// <returns></returns>
- public static List<Fchb30x5Info> GetFchb30x5List(ref List<Fchb30x5Info> list, int pagesize, int year, int sqi, int eqi, int week = 0, int ds = 0)
- {
- List<Fchb30x5Info> rlist = new List<Fchb30x5Info>();
- if (list == null || list.Count == 0)
- return rlist;
- int size = list.Count;
- if (pagesize > 0)
- {
- int temp = size - pagesize;
- if (temp < 0)
- temp = 0;
- for (int i = temp; i < size; i++)
- {
- rlist.Add(list[i]);
- }
- return rlist;
- }
- if (year > 0)
- {
- rlist.Clear();
- for (int i = 0; i < size; i++)
- {
- if (TypeConverter.StrToInt(list[i].qi.ToString().Substring(0, 4), 0) == year)
- rlist.Add(list[i]);
- }
- return rlist;
- }
- if (week > 0)
- {
- rlist.Clear();
- List<Fchb30x5Info> temp = new List<Fchb30x5Info>();
- for (int i = 0; i < size; i++)
- {
- if (list[i].week == week)
- temp.Add(list[i]);
- }
- int start = 0;
- if (temp.Count - 120 > 0)
- start = temp.Count - 120;
- for (int i = start; i < temp.Count; i++)
- {
- rlist.Add(temp[i]);
- }
- return rlist;
- }
- if (ds > 0)
- {
- rlist.Clear();
- List<Fchb30x5Info> temp = new List<Fchb30x5Info>();
- for (int i = 0; i < size; i++)
- {
- if (ds == 1)
- {
- if (list[i].qi % 2 != 0)
- temp.Add(list[i]);
- }
- else if (ds == 2)
- {
- if (list[i].qi % 2 == 0)
- temp.Add(list[i]);
- }
- }
- for (int i = (temp.Count - 120); i < temp.Count; i++)
- {
- rlist.Add(temp[i]);
- }
- return rlist;
- }
- if (sqi > 0 && eqi > 0)
- {
- rlist.Clear();
- int srank = GetFchb30x5Info(ref list,sqi).rank;
- int erank = GetFchb30x5Info(ref list,eqi).rank;
- if (erank != 0 && srank != 0 && erank > srank)
- {
- for (int i = srank - 1; i < erank && i < size; i++)
- {
- rlist.Add(list[i]);
- }
- }
- return rlist;
- }
- ///无参数条件时,返回所有数据
- if (pagesize == 0 && year == 0 && sqi == 0 && eqi == 0 && week == 0)
- return list;
- return rlist;
- }
- /// <summary>
- /// 根据期数获取期一期的数据...
- /// </summary>
- /// <param name="qi"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetFchb30x5Info(ref List<Fchb30x5Info> list, int qi)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- int size = list.Count;
- for (int i = 0; i < size; i++)
- {
- if (list[i].qi == qi)
- {
- info = list[i];
- break;
- }
- }
- return info;
- }
- #endregion
- #region 某个排名的上一次数据
- /// <summary>
- /// 某个排列的上一排名数据
- /// </summary>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastFchb30x5Info(ref List<Fchb30x5Info> list, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (list[i].rank == rank - 1)
- {
- info = list[i];
- return info;
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次大小比=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastDxbFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- if (ZstUtils.GetDxb(kjh,16).Equals(val))
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 一次大个数=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastDxgsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- string dxb = ZstUtils.GetDxb(kjh,16);
- string[] dxs = dxb.Split(':');
- int d = 0;
- int x = 0;
- if (dxs != null && dxs.Length > 0)
- {
- d = TypeConverter.ObjectToInt(dxs[0], 0);
- x = TypeConverter.ObjectToInt(dxs[1], 0);
- }
- if (type == 1)
- {
- if (d == val)
- return list[i];
- }
- if (type == 2)
- {
- if (x == val)
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 跨度=val的上一次情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastKdFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (list[i].kd == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 跨度大小的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastKdDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetDxBymiddle(list[i].kd, 16) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 跨度奇偶的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastKdJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetJo(list[i].kd) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 跨度质合
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastKdZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetZh(list[i].kd) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 跨度012路的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastKd012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.Get012(list[i].ac) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 河南22x5每位号的大小情况的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="site"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastNumDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (site == 1)
- {
- if (ZstUtils.GetDxBymiddle(list[i].n1, 16) == val)
- {
- return list[i];
- }
- }
- if (site == 2)
- {
- if (ZstUtils.GetDxBymiddle(list[i].n2, 16) == val)
- {
- return list[i];
- }
- }
- if (site == 3)
- {
- if (ZstUtils.GetDxBymiddle(list[i].n3, 16) == val)
- {
- return list[i];
- }
- }
- if (site == 4)
- {
- if (ZstUtils.GetDxBymiddle(list[i].n4, 16) == val)
- {
- return list[i];
- }
- }
- if (site == 5)
- {
- if (ZstUtils.GetDxBymiddle(list[i].n5, 16) == val)
- {
- return list[i];
- }
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 22x5每位号质合的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="site"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastNumZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (site == 1)
- {
- if (ZstUtils.GetZh(list[i].n1) == val)
- {
- return list[i];
- }
- }
- if (site == 2)
- {
- if (ZstUtils.GetZh(list[i].n2) == val)
- {
- return list[i];
- }
- }
- if (site == 3)
- {
- if (ZstUtils.GetZh(list[i].n3) == val)
- {
- return list[i];
- }
- }
- if (site == 4)
- {
- if (ZstUtils.GetZh(list[i].n4) == val)
- {
- return list[i];
- }
- }
- if (site == 5)
- {
- if (ZstUtils.GetZh(list[i].n5) == val)
- {
- return list[i];
- }
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次质合比=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastZhbFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- if (ZstUtils.GetZhb(kjh).Equals(val))
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次质合数=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastZhgsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- string dxb = ZstUtils.GetZhb(kjh);
- string[] dxs = dxb.Split(':');
- int d = 0;
- int x = 0;
- if (dxs != null && dxs.Length > 0)
- {
- d = TypeConverter.ObjectToInt(dxs[0], 0);
- x = TypeConverter.ObjectToInt(dxs[1], 0);
- }
- if (type == 1)
- {
- if (d == val)
- return list[i];
- }
- if (type == 2)
- {
- if (x == val)
- return list[i];
- }
- }
- }
- return info;
- }
- #endregion
- #region 某个排名的下一次数据
- /// <summary>
- /// 某个排列的上一排名数据
- /// </summary>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetNextFchb30x5Info(ref List<Fchb30x5Info> list, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 1; i < list.Count; i++)
- {
- if (list[i].rank == rank + 1)
- {
- info = list[i];
- return info;
- }
- }
- }
- return info;
- }
- #endregion
- #region 某个数据/形态上一次出现的数据
- /// <summary>
- /// 河南30选5某号码上一次出现时的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastNumFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- if (kjh.Contains(val))
- {
- info = list[i];
- return info;
- }
- }
- }
- return info;
- }
- /// <summary>
- /// AC值大小的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAcDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetDx(list[i].ac) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// AC值奇偶的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAcJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetJo(list[i].ac) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// AC值质合
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAcZhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetZh(list[i].ac) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// AC值012路的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAc012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.Get012(list[i].ac) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// AC值=val的上一次情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAcFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (list[i].ac == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次AC值振幅的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastAczfFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (i > 0)
- {
- if (Math.Abs(list[i].ac - list[i - 1].ac) == val)
- {
- info = list[i];
- return info;
- }
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 22x5每位号的奇偶情况的上一次数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="site"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastNumJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (site == 1)
- {
- if (ZstUtils.GetJo(list[i].n1) == val)
- {
- return list[i];
- }
- }
- if (site == 2)
- {
- if (ZstUtils.GetJo(list[i].n2) == val)
- {
- return list[i];
- }
- }
- if (site == 3)
- {
- if (ZstUtils.GetJo(list[i].n3) == val)
- {
- return list[i];
- }
- }
- if (site == 4)
- {
- if (ZstUtils.GetJo(list[i].n4) == val)
- {
- return list[i];
- }
- }
- if (site == 5)
- {
- if (ZstUtils.GetJo(list[i].n5) == val)
- {
- return list[i];
- }
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次奇偶比=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastJobFchb30x5Info(ref List<Fchb30x5Info> list, string val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- if (ZstUtils.GetJob(kjh).Equals(val))
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 一次奇偶数=val的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastJogsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- string dxb = ZstUtils.GetJob(kjh);
- string[] dxs = dxb.Split(':');
- int d = 0;
- int x = 0;
- if (dxs != null && dxs.Length > 0)
- {
- d = TypeConverter.ObjectToInt(dxs[0], 0);
- x = TypeConverter.ObjectToInt(dxs[1], 0);
- }
- if (type == 1)
- {
- if (d == val)
- return list[i];
- }
- if (type == 2)
- {
- if (x == val)
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 河南22x5每一位上一次012路情况的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="site"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastNum012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int site, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (site == 1)
- {
- if (ZstUtils.Get012(list[i].n1) == val)
- {
- return list[i];
- }
- }
- if (site == 2)
- {
- if (ZstUtils.Get012(list[i].n2) == val)
- {
- return list[i];
- }
- }
- if (site == 3)
- {
- if (ZstUtils.Get012(list[i].n3) == val)
- {
- return list[i];
- }
- }
- if (site == 4)
- {
- if (ZstUtils.Get012(list[i].n4) == val)
- {
- return list[i];
- }
- }
- if (site == 5)
- {
- if (ZstUtils.Get012(list[i].n5) == val)
- {
- return list[i];
- }
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 012个数
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLast012gsFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank, int type)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- int c1 = ZstUtils.Get012Count(0, kjh);
- int c2 = ZstUtils.Get012Count(1, kjh);
- int c3 = ZstUtils.Get012Count(2, kjh);
- if (type == 0)
- {
- if (c1 == val)
- return list[i];
- }
- if (type == 1)
- {
- if (c2 == val)
- return list[i];
- }
- if (type == 2)
- {
- if (c3 == val)
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 河南30选5和值范围上一次的情况
- /// </summary>
- /// <param name="shz"></param>
- /// <param name="ehz"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHzFchb30x5Info(ref List<Fchb30x5Info> list, int shz, int ehz, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (list[i].hz >= shz && list[i].hz <= ehz)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 和值上一次奇偶的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHzJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetJo(list[i].hz) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 和值上一次012的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHz012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.Get012(list[i].hz) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次和尾的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHwFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetHw(list[i].hz) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次和尾大小的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHwDxFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetDx(ZstUtils.GetHw(list[i].hz)) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次和尾奇偶的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHwJoFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.GetJo(ZstUtils.GetHw(list[i].hz)) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次和尾012路的情况
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLastHw012Fchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- for (int i = rank - 2; i >= 0; i--)
- {
- if (ZstUtils.Get012(ZstUtils.GetHw(list[i].hz)) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- /// <summary>
- /// 上一次3连形态=val时的数据
- /// </summary>
- /// <param name="val"></param>
- /// <param name="rank"></param>
- /// <returns></returns>
- public static Fchb30x5Info GetLast3lhFchb30x5Info(ref List<Fchb30x5Info> list, int val, int rank)
- {
- Fchb30x5Info info = new Fchb30x5Info();
- if (list != null && list.Count > 0)
- {
- int size = list.Count;
- for (int i = rank - 2; i >= 0; i--)
- {
- List<int> kjh = new List<int> { list[i].n1, list[i].n2, list[i].n3, list[i].n4, list[i].n5 };
- if (ZstUtils.GetIs3lh(kjh) == val)
- {
- return list[i];
- }
- }
- }
- return info;
- }
- #endregion
- #region 开奖公告相关方法
- /// <summary>
- /// 最近30期开奖数据,完整开奖信息,有缓存
- /// </summary>
- /// <returns></returns>
- public static List<Fchb30x5LongInfo> GetFchb30x5ListTop30()
- {
- string key = string.Format(CacheKeys.Fchb30x5_KJH_DATA);
- List<Fchb30x5LongInfo> list = cache.GetObject<List<Fchb30x5LongInfo>>(key) as List<Fchb30x5LongInfo>;
- if (list == null)
- {
- list = Fchb30x5Data.GetFchb30x5Top30();
- cache.AddObject(key, list, (int)CacheTime.Kjh);
- }
- return list;
- }
- /// <summary>
- /// 获取最新一期开奖信息,完整开奖信息,有缓存
- /// </summary>
- /// <returns></returns>
- public static Fchb30x5LongInfo GetFchb30x5InfoTop1(ref List<Fchb30x5LongInfo> list)
- {
- Fchb30x5LongInfo info = new Fchb30x5LongInfo();
- if (list.Count > 0)
- {
- info = list[0];
- }
- return info;
- }
- /// <summary>
- /// 根据期数返回某期完整开奖信息,无缓存
- /// </summary>
- /// <param name="qi"></param>
- /// <returns></returns>
- public static Fchb30x5LongInfo GetFchb30x5InfoByqi(int qi)
- {
- return Fchb30x5Data.GetFchb30x5InfoByQi(qi);
- }
- /// <summary>
- /// 返回某年对应的期数列表,有缓存
- /// </summary>
- /// <param name="year"></param>
- /// <returns></returns>
- public static List<int> GetFchb30x5QiListByYear(int year)
- {
- string key = string.Format(CacheKeys.Fchb30x5_KJH_DATA + "/qilistbyyear/{0}", year);
- List<int> list = cache.GetObject<List<int>>(key) as List<int>;
- if (list == null)
- {
- list = Fchb30x5Data.GetFchb30x5QiListByYear(year);
- cache.AddObject(key, list, (int)CacheTime.System);
- }
- return list;
- }
- #endregion
- }
- }
|