list.aspx.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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 CB.Framework;
  8. using CB.Common;
  9. using System.Text;
  10. using CB.Entity;
  11. using System.Text.RegularExpressions;
  12. namespace CB.Wap
  13. {
  14. public partial class list : WebPage
  15. {
  16. protected StringBuilder sp = new StringBuilder();
  17. protected string lotteryName = "";
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. InitData();
  21. header1.ColumnName = lotteryName;
  22. }
  23. protected override void InitData()
  24. {
  25. var cid = WRequest.GetQueryInt("cid");
  26. var lottery = CB.Data.Caches.GetLotteryInfo(cid);
  27. if (null == lottery)
  28. { ShowError(); return; }
  29. lotteryName = lottery.Name;
  30. var css = GetLotteryLogoCss(lottery.Cid);
  31. //switch (lottery.Id)
  32. //{
  33. // case 1:
  34. // css = "fc3d";
  35. // break;
  36. // case 2:
  37. // css = "p3";
  38. // break;
  39. // case 3:
  40. // css = "p5";
  41. // break;
  42. // case 4:
  43. // css = "ssq";
  44. // break;
  45. // case 5:
  46. // css = "qlc";
  47. // break;
  48. // case 9:
  49. // css = "22x5";
  50. // break;
  51. // case 12:
  52. // css = "dlt";
  53. // break;
  54. // case 19:
  55. // css = "qxc";
  56. // break;
  57. // default:
  58. // css = "fc3d";
  59. // break;
  60. //}
  61. var list = CB.Data.Caches.GetTrendChartList(cid, 2001, 0);
  62. if (null != list && 0 < list.Count)
  63. {
  64. sp.Append("<div class=\"lot-title nav-list\">");
  65. sp.AppendFormat("<h1><span class=\"{0}\"></span>走势图</h1>", css);
  66. sp.Append("</div>");
  67. sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
  68. //modified by zizi,at 2016-6-13
  69. //新增地方彩和高频彩后限制输出内容,补齐缺失列
  70. int z = 1;
  71. foreach (var item in list)
  72. {
  73. var exceptionCids = new int[] {15, 20};
  74. var splitCid = 29;
  75. if ((lottery.Cid < splitCid && !exceptionCids.Contains(lottery.Cid) &&
  76. !item.Name.Contains("手机版")) ||
  77. ((lottery.Cid >= splitCid || exceptionCids.Contains(lottery.Cid)) &&
  78. item.Name.Contains("手机版")))
  79. {
  80. if (z%3 == 1)
  81. {
  82. sp.Append("<ul>");
  83. }
  84. var _name = LotteryNameReplace(item.Name, lottery.Name);
  85. //TODO: 2016-7-15 保持移动端和pc端的地址一致
  86. var _id = MobPcConvert.GetSyncIdFromM(item.Id);
  87. if (_id == 0) _id = item.Id;
  88. sp.AppendFormat("<li><a href=\"/zs/{2}_{3}.htm\">{0}{1}</a></li>", // style=\"color:#2574c5\"
  89. //Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
  90. _name,
  91. GetTrendChartStatus(item.Status), item.Cid, _id);//item.Id);
  92. if (z%3 == 0)//|| z == list.Count)
  93. {
  94. //if (z == list.Count && list.Count%3 != 0)
  95. //{
  96. // int ts = 3 - list.Count%3;
  97. // for (int j = 0; j < ts; j++)
  98. // {
  99. // sp.Append("<li></li>");
  100. // }
  101. //}
  102. sp.Append("</ul>");
  103. }
  104. z++;
  105. }
  106. }
  107. var n1 = (z-1)%3;
  108. if (n1 > 0 && z > 3)
  109. {
  110. for (int j = n1; j < 3; j++)
  111. {
  112. sp.Append("<li></li>");
  113. }
  114. sp.Append("</ul>");
  115. }
  116. sp.Append("</div></div></div>");
  117. }
  118. list = CB.Data.Caches.GetTrendChartList(cid, 2002, 0);
  119. if (null != list && 0 < list.Count)
  120. {
  121. sp.Append("<div class=\"lot-title nav-list\">");
  122. sp.AppendFormat("<h1><span class=\"{0}\"></span>缩水工具</h1>", css);
  123. sp.Append("</div>");
  124. sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
  125. int s = 1;
  126. foreach (var item in list)
  127. {
  128. if (s % 3 == 1)
  129. {
  130. sp.Append("<ul>");
  131. }
  132. sp.AppendFormat("<li><a href=\"{2}\">{0}{1}</a></li>",// style=\"color:#2574c5\"
  133. Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
  134. GetTrendChartStatus(item.Status), item.Url);
  135. if (s % 3 == 0 || s == list.Count)
  136. {
  137. if (s == list.Count && list.Count % 3 != 0)
  138. {
  139. int ts = 3 - list.Count % 3;
  140. for (int j = 0; j < ts; j++)
  141. {
  142. sp.Append("<li></li>");
  143. }
  144. }
  145. sp.Append("</ul>");
  146. }
  147. s++;
  148. }
  149. sp.Append("</div></div></div>");
  150. }
  151. list = CB.Data.Caches.GetTrendChartList(cid, 2003, 0);
  152. if (null != list && 0 < list.Count)
  153. {
  154. sp.Append("<div class=\"lot-title nav-list\">");
  155. sp.AppendFormat("<h1><span class=\"{0}\"></span>遗漏</h1>", css);
  156. sp.Append("</div>");
  157. sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
  158. int y = 1;
  159. foreach (var item in list)
  160. {
  161. if (y % 3 == 1)
  162. {
  163. sp.Append("<ul>");
  164. }
  165. sp.AppendFormat("<li><a href=\"/yl/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
  166. Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
  167. GetTrendChartStatus(item.Status), item.Cid, item.Id);
  168. if (y % 3 == 0 || y == list.Count)
  169. {
  170. if (y == list.Count && list.Count % 3 != 0)
  171. {
  172. int ts = 3 - list.Count % 3;
  173. for (int j = 0; j < ts; j++)
  174. {
  175. sp.Append("<li></li>");
  176. }
  177. }
  178. sp.Append("</ul>");
  179. }
  180. y++;
  181. }
  182. sp.Append("</div></div></div>");
  183. }
  184. list = CB.Data.Caches.GetTrendChartList(cid, 2004, 0);
  185. if (null != list && 0 < list.Count)
  186. {
  187. sp.Append("<div class=\"lot-title nav-list\">");
  188. sp.AppendFormat("<h1><span class=\"{0}\"></span>图表</h1>", css);
  189. sp.Append("</div>");
  190. sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
  191. int tb = 1;
  192. foreach (var item in list)
  193. {
  194. if (tb % 3 == 1)
  195. {
  196. sp.Append("<ul>");
  197. }
  198. sp.AppendFormat("<li><a href=\"/tb/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
  199. Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
  200. GetTrendChartStatus(item.Status), item.Cid, item.Id);
  201. if (tb % 3 == 0 || tb == list.Count)
  202. {
  203. if (tb == list.Count && list.Count % 3 != 0)
  204. {
  205. int ts = 3 - list.Count % 3;
  206. for (int j = 0; j < ts; j++)
  207. {
  208. sp.Append("<li></li>");
  209. }
  210. }
  211. sp.Append("</ul>");
  212. }
  213. tb++;
  214. }
  215. sp.Append("</div></div></div>");
  216. }
  217. list = CB.Data.Caches.GetTrendChartList();
  218. List<TrendChartInfo> nlist = list.Where(it=>it.Status==TrendChartStatus.Hot).ToList();
  219. if (null != nlist && 0 < nlist.Count)
  220. {
  221. sp.Append("<div class=\"lot-title nav-list\">");
  222. sp.AppendFormat("<h1><span class=\"{0}\"></span>热门专题</h1>", css);
  223. sp.Append("</div>");
  224. sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
  225. int tb = 1;
  226. foreach (var item in nlist)
  227. {
  228. if (tb % 3 == 1)
  229. {
  230. sp.Append("<ul>");
  231. }
  232. sp.AppendFormat("<li><a href=\"/tb/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
  233. Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
  234. GetTrendChartStatus(item.Status), item.Cid, item.Id);
  235. if (tb % 3 == 0 || tb == list.Count)
  236. {
  237. if (tb == list.Count && list.Count % 3 != 0)
  238. {
  239. int ts = 3 - list.Count % 3;
  240. for (int j = 0; j < ts; j++)
  241. {
  242. sp.Append("<li></li>");
  243. }
  244. }
  245. sp.Append("</ul>");
  246. }
  247. tb++;
  248. }
  249. sp.Append("</div></div></div>");
  250. }
  251. base.InitData();
  252. }
  253. private string GetTrendChartStatus(TrendChartStatus status)
  254. {
  255. switch (status)
  256. {
  257. case TrendChartStatus.New:
  258. return "<span class=\"new\"></span>";
  259. case TrendChartStatus.Hot:
  260. return "<span class=\"hot\"></span>";
  261. }
  262. return "";
  263. }
  264. }
  265. }