p3sjh.aspx.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Text;
  8. using CB.Common;
  9. using CB.Entity;
  10. using CB.Framework;
  11. using CB.Web.Kjh.AppCode;
  12. using Newtonsoft.Json;
  13. using HttpCodeLib;
  14. namespace CB.Web.Kjh.shijihao
  15. {
  16. public partial class p3sjh : WebPage
  17. {
  18. protected int term;
  19. protected DateTime date = DateTime.Now;
  20. protected StringBuilder sp = new StringBuilder();
  21. protected StringBuilder others = new StringBuilder();
  22. protected StringBuilder number = new StringBuilder();
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. InitData();
  26. }
  27. protected override void InitData()
  28. {
  29. term = WRequest.GetQueryInt("term");
  30. if (0 < term)
  31. {
  32. pageTitle = term.ToString() + "期排列三试机号_" + term.ToString() + "期排列3|P3试机号查询 -开奖助手";
  33. pageKeyWords = term.ToString() + "期排列三试机号," + term.ToString() + "期排列3|P3试机号查询";
  34. pageDescription = "开奖助手提供排列三" + term.ToString() + "期试机号,包括" + term.ToString() + "期排列3|P3试机号查询、" + term.ToString() + "期排列3试机号与开奖号的关系、" + term.ToString() + "期排列三试机号关注号|对应码|金码,查询体彩排列三试机号就上开奖助手。";
  35. }
  36. else
  37. {
  38. pageTitle = "排列三试机号_p3试机号_排三试机号_排3试机号_排列3试机号_体彩试机号_开奖助手";
  39. pageKeyWords = "排列三试机号,p3试机号,排三试机号,排列3试机号,排3试机号,_排列三试机号近十期,体彩试机号,shijihao,体彩排列3试机号,体彩排列三试机号,排三近十期试机号";
  40. pageDescription = "开奖助手提供最新的体彩排列三试机号、排三试机号今天、P3试机号查询、排列3试机号分析和排列三试机号近十期详细数据,并有排列三试机号走势图供彩民使用";
  41. }
  42. var info = CB.Data.Caches.GetTCP3Info(term, OpenCodeType.ShiJiHao);
  43. IList<int> d;
  44. if (null == info || string.IsNullOrEmpty(info.ShiJiHao) || -1 != info.ShiJiHao.IndexOf("-1"))
  45. {
  46. number.AppendLine("<li class=\"ballbox\">");
  47. number.AppendLine(" <span class=\"ball wred-40\">?</span><span class=\"ball wred-40\">?</span><span class=\"ball wred-40\">?</span>");
  48. number.AppendLine(" </li>");
  49. number.AppendLine(" <li>和值:-- | 跨度:-- | 奇偶比:-- | 大小比:-- </li>");
  50. }
  51. else
  52. {
  53. term = (int)info.Term;
  54. date = info.OpenTime;
  55. d = info.ShiJiHao.ToIntArray(',');
  56. number.AppendLine("<li class=\"ballbox\">");
  57. number.AppendLine(" <span class=\"ball wred-40\">" + d[0].ToString() + "</span><span class=\"ball wred-40\">" + d[1].ToString() + "</span><span class=\"ball wred-40\">" + d[2].ToString() + "</span>");
  58. number.AppendLine(" </li>");
  59. number.AppendLine(" <li>和值:" + CB.Common.LotteryUtils.GetSum(d).ToString() + " | 跨度:" + CB.Common.LotteryUtils.GetSpan(d).ToString() + " | 奇偶比:" + CB.Common.LotteryUtils.GetProportionOfJO(d) + " | 大小比:" + CB.Common.LotteryUtils.GetProportionOfDX(d, 5) + " </li>");
  60. }
  61. var list = CB.Data.Caches.GetTCP3List(10, OpenCodeType.ShiJiHao);
  62. if (null != list && 0 < list.Count)
  63. {
  64. int i = 1;
  65. foreach (var item in list)
  66. {
  67. d = item.ShiJiHao.ToIntArray(',');
  68. if (null == d)
  69. break;
  70. if (0 == i % 2)
  71. { sp.AppendLine(" <tr class=\"bg_grey\">"); }
  72. else
  73. { sp.AppendLine(" <tr>"); }
  74. sp.AppendLine(" <td>" + item.Term.ToString() + "</td>");
  75. sp.AppendLine(" <td>" + item.OpenTime.ToString("yyyy.MM.dd") + "</td>");
  76. sp.AppendLine(" <td><span>" + item.ShiJiHao.Replace(",", ",") + "</span></td>");
  77. sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(d).ToString() + "</td>");
  78. if (0 <= item.OpenCode1)
  79. {
  80. sp.AppendLine(" <td>" + item.OpenCode1 + "," + item.OpenCode2 + "," + item.OpenCode3 + "</td>");
  81. sp.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(item.OpenCode, 3).ToString() + "</td>");
  82. sp.AppendLine(" <td>" + GetContains(item.OpenCode, item.ShiJiHao) + "</td>");
  83. }
  84. else
  85. {
  86. sp.AppendLine(" <td>---</td>");
  87. sp.AppendLine(" <td>---</td>");
  88. sp.AppendLine(" <td>---</td>");
  89. }
  90. sp.AppendLine(" </tr>");
  91. i++;
  92. }
  93. }
  94. list = CB.Data.Caches.GetTCP3HistorySameTerm(term, OpenCodeType.ShiJiHao);
  95. if (null != list && 0 < list.Count)
  96. {
  97. int i = 1;
  98. foreach (var item in list)
  99. {
  100. d = item.ShiJiHao.ToIntArray(',');
  101. if (null == d)
  102. break;
  103. if (0 == i % 2)
  104. { others.AppendLine(" <tr class=\"bg_grey\">"); }
  105. else
  106. { others.AppendLine(" <tr>"); }
  107. others.AppendLine(" <td>" + item.Term.ToString() + "</td>");
  108. others.AppendLine(" <td>" + item.OpenTime.ToString("yyyy.MM.dd") + "</td>");
  109. others.AppendLine(" <td><span>" + item.ShiJiHao.Replace(",", ",") + "</span></td>");
  110. others.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(d).ToString() + "</td>");
  111. if (0 <= item.OpenCode1)
  112. {
  113. others.AppendLine(" <td>" + item.OpenCode1 + "," + item.OpenCode2 + "," + item.OpenCode3 + "</td>");
  114. others.AppendLine(" <td>" + CB.Common.LotteryUtils.GetSum(item.OpenCode, 3).ToString() + "</td>");
  115. others.AppendLine(" <td>" + GetContains(item.OpenCode, item.ShiJiHao) + "</td>");
  116. }
  117. else
  118. {
  119. others.AppendLine(" <td>---</td>");
  120. others.AppendLine(" <td>---</td>");
  121. others.AppendLine(" <td>---</td>");
  122. }
  123. others.AppendLine(" </tr>");
  124. i++;
  125. }
  126. }
  127. base.InitData();
  128. }
  129. private string GetContains(IList<int> list, string numbers)
  130. {
  131. if (null == list || 0 >= list.Count || string.IsNullOrEmpty(numbers))
  132. return "";
  133. if (list.Count > 3)
  134. {
  135. list = list.Take(3).ToList();
  136. }
  137. IList<int> d = numbers.ToIntArray(',');
  138. if (null == d || 0 >= d.Count)
  139. return "";
  140. int i = 0;
  141. foreach (var item in d)
  142. {
  143. if (list.Contains(item))
  144. i++;
  145. }
  146. return 0 == i ? "" : i.ToString();
  147. }
  148. /// <summary>
  149. ///
  150. /// </summary>
  151. /// <param name="indexType">当前类型 </param>
  152. /// <param name="maxLength">标题最大</param>
  153. /// <param name="wap"></param>
  154. /// <param name="showDate"></param>
  155. /// <returns></returns>
  156. protected string GetSynArticleZx(string indexTypes, int maxLength, bool wap, bool showDate = false)
  157. {
  158. //jsonList.Data
  159. //var list = CB.Data.Synchronize.Article.GetArticleList(topSize, pageSize, cid, wap);
  160. dynamic jsonList;
  161. if (null == Session["jsonList"])
  162. {
  163. Session.Timeout = 50;
  164. //开始调用
  165. HttpHelpers hhs = new HttpHelpers();
  166. HttpItems hi = new HttpItems();
  167. string getZX = System.Configuration.ConfigurationManager.AppSettings["getZX"];
  168. hi.URL = getZX + "/zx/TopicInterface/GetNewList128";
  169. hi.Method = "get";
  170. hi.Accept = "/";
  171. hi.ContentType = "";
  172. hi.Timeout = 300000;
  173. HttpResults hr = hhs.GetHtml(hi);
  174. try
  175. {
  176. jsonList = JsonConvert.DeserializeObject<dynamic>(hr.Html.ToString());
  177. CacheUtils.SetCache("jsonListKJH", jsonList, new TimeSpan(0, 0, 30, 0));
  178. }
  179. catch (Exception)
  180. {
  181. return "";
  182. }
  183. }
  184. else
  185. {
  186. jsonList = JsonConvert.DeserializeObject<dynamic>(Session["jsonList"].ToString());
  187. }
  188. if (null == jsonList)
  189. {
  190. return "";
  191. }
  192. var sp = new StringBuilder(400 * 6);
  193. var fortstr = "<li><a href=\"{0}\" target=\"_blank\">{1}</a><span></span></li>";
  194. if (showDate)
  195. fortstr = "<li><a href=\"{0}\" target=\"_blank\">{1}</a><span class=\"time\">{2}</span></li>";
  196. switch (indexTypes)
  197. {
  198. case "ssq":
  199. foreach (var item in jsonList.ssq)
  200. {
  201. var lst = new List<object>() { "http://zx.55128.cn" + item.SourceUrl, CB.Common.Utils.GetSubString(item.title.ToString(), maxLength, "") };
  202. if (showDate)
  203. lst.Add(item.createTime.ToString("MM-dd"));
  204. sp.AppendFormat(fortstr, lst.ToArray());
  205. }
  206. break;
  207. case "fc3d":
  208. foreach (var item in jsonList.fc3d)
  209. {
  210. var lst = new List<object>() { "http://zx.55128.cn" + item.SourceUrl, CB.Common.Utils.GetSubString(item.title.ToString(), maxLength, "") };
  211. if (showDate)
  212. lst.Add(item.createTime.ToString("MM-dd"));
  213. sp.AppendFormat(fortstr, lst.ToArray());
  214. }
  215. break;
  216. case "dlt":
  217. foreach (var item in jsonList.dlt)
  218. {
  219. var lst = new List<object>() { "http://zx.55128.cn" + item.SourceUrl, CB.Common.Utils.GetSubString(item.title.ToString(), maxLength, "") };
  220. if (showDate)
  221. lst.Add(item.createTime.ToString("MM-dd"));
  222. sp.AppendFormat(fortstr, lst.ToArray());
  223. }
  224. break;
  225. case "p3": //3D试机号
  226. foreach (var item in jsonList.p3)
  227. {
  228. var lst = new List<object>() { "http://zx.55128.cn" + item.SourceUrl, CB.Common.Utils.GetSubString(item.title.ToString(), maxLength, "") };
  229. if (showDate)
  230. lst.Add(item.createTime.ToString("MM-dd"));
  231. sp.AppendFormat(fortstr, lst.ToArray());
  232. }
  233. break;
  234. case "sjh":
  235. foreach (var item in jsonList.p3)
  236. {
  237. var lst = new List<object>() { "http://zx.55128.cn" + item.SourceUrl, CB.Common.Utils.GetSubString(item.title.ToString(), maxLength, "") };
  238. if (showDate)
  239. lst.Add(item.createTime.ToString("MM-dd"));
  240. sp.AppendFormat(fortstr, lst.ToArray());
  241. }
  242. break;
  243. default:
  244. break;
  245. }
  246. return sp.ToString();
  247. }
  248. }
  249. }