123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using CB.Framework;
- using CB.Common;
- using System.Text;
- using CB.Entity;
- using System.Text.RegularExpressions;
- namespace CB.Wap
- {
- public partial class list : WebPage
- {
- protected StringBuilder sp = new StringBuilder();
- protected string lotteryName = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- InitData();
- header1.ColumnName = lotteryName;
- }
- protected override void InitData()
- {
- var cid = WRequest.GetQueryInt("cid");
- var lottery = CB.Data.Caches.GetLotteryInfo(cid);
- if (null == lottery)
- { ShowError(); return; }
- lotteryName = lottery.Name;
- var css = GetLotteryLogoCss(lottery.Cid);
- //switch (lottery.Id)
- //{
- // case 1:
- // css = "fc3d";
- // break;
- // case 2:
- // css = "p3";
- // break;
- // case 3:
- // css = "p5";
- // break;
- // case 4:
- // css = "ssq";
- // break;
- // case 5:
- // css = "qlc";
- // break;
- // case 9:
- // css = "22x5";
- // break;
- // case 12:
- // css = "dlt";
- // break;
- // case 19:
- // css = "qxc";
- // break;
- // default:
- // css = "fc3d";
- // break;
- //}
- var list = CB.Data.Caches.GetTrendChartList(cid, 2001, 0);
- if (null != list && 0 < list.Count)
- {
- sp.Append("<div class=\"lot-title nav-list\">");
- sp.AppendFormat("<h1><span class=\"{0}\"></span>走势图</h1>", css);
- sp.Append("</div>");
- sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
- //modified by zizi,at 2016-6-13
- //新增地方彩和高频彩后限制输出内容,补齐缺失列
- int z = 1;
- foreach (var item in list)
- {
- var exceptionCids = new int[] {15, 20};
- var splitCid = 29;
- if ((lottery.Cid < splitCid && !exceptionCids.Contains(lottery.Cid) &&
- !item.Name.Contains("手机版")) ||
- ((lottery.Cid >= splitCid || exceptionCids.Contains(lottery.Cid)) &&
- item.Name.Contains("手机版")))
- {
- if (z%3 == 1)
- {
- sp.Append("<ul>");
- }
- var _name = LotteryNameReplace(item.Name, lottery.Name);
- //TODO: 2016-7-15 保持移动端和pc端的地址一致
- var _id = MobPcConvert.GetSyncIdFromM(item.Id);
- if (_id == 0) _id = item.Id;
- sp.AppendFormat("<li><a href=\"/zs/{2}_{3}.htm\">{0}{1}</a></li>", // style=\"color:#2574c5\"
- //Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
- _name,
- GetTrendChartStatus(item.Status), item.Cid, _id);//item.Id);
- if (z%3 == 0)//|| z == list.Count)
- {
- //if (z == list.Count && list.Count%3 != 0)
- //{
- // int ts = 3 - list.Count%3;
- // for (int j = 0; j < ts; j++)
- // {
- // sp.Append("<li></li>");
- // }
- //}
- sp.Append("</ul>");
- }
- z++;
- }
- }
- var n1 = (z-1)%3;
- if (n1 > 0 && z > 3)
- {
- for (int j = n1; j < 3; j++)
- {
- sp.Append("<li></li>");
- }
- sp.Append("</ul>");
- }
- sp.Append("</div></div></div>");
- }
- list = CB.Data.Caches.GetTrendChartList(cid, 2002, 0);
- if (null != list && 0 < list.Count)
- {
- sp.Append("<div class=\"lot-title nav-list\">");
- sp.AppendFormat("<h1><span class=\"{0}\"></span>缩水工具</h1>", css);
- sp.Append("</div>");
- sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
- int s = 1;
- foreach (var item in list)
- {
- if (s % 3 == 1)
- {
- sp.Append("<ul>");
- }
- sp.AppendFormat("<li><a href=\"{2}\">{0}{1}</a></li>",// style=\"color:#2574c5\"
- Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
- GetTrendChartStatus(item.Status), item.Url);
- if (s % 3 == 0 || s == list.Count)
- {
- if (s == list.Count && list.Count % 3 != 0)
- {
- int ts = 3 - list.Count % 3;
- for (int j = 0; j < ts; j++)
- {
- sp.Append("<li></li>");
- }
- }
- sp.Append("</ul>");
- }
- s++;
- }
- sp.Append("</div></div></div>");
- }
- list = CB.Data.Caches.GetTrendChartList(cid, 2003, 0);
- if (null != list && 0 < list.Count)
- {
- sp.Append("<div class=\"lot-title nav-list\">");
- sp.AppendFormat("<h1><span class=\"{0}\"></span>遗漏</h1>", css);
- sp.Append("</div>");
- sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
- int y = 1;
- foreach (var item in list)
- {
- if (y % 3 == 1)
- {
- sp.Append("<ul>");
- }
- sp.AppendFormat("<li><a href=\"/yl/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
- Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
- GetTrendChartStatus(item.Status), item.Cid, item.Id);
- if (y % 3 == 0 || y == list.Count)
- {
- if (y == list.Count && list.Count % 3 != 0)
- {
- int ts = 3 - list.Count % 3;
- for (int j = 0; j < ts; j++)
- {
- sp.Append("<li></li>");
- }
- }
- sp.Append("</ul>");
- }
- y++;
- }
- sp.Append("</div></div></div>");
- }
- list = CB.Data.Caches.GetTrendChartList(cid, 2004, 0);
- if (null != list && 0 < list.Count)
- {
- sp.Append("<div class=\"lot-title nav-list\">");
- sp.AppendFormat("<h1><span class=\"{0}\"></span>图表</h1>", css);
- sp.Append("</div>");
- sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
- int tb = 1;
- foreach (var item in list)
- {
- if (tb % 3 == 1)
- {
- sp.Append("<ul>");
- }
- sp.AppendFormat("<li><a href=\"/tb/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
- Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
- GetTrendChartStatus(item.Status), item.Cid, item.Id);
- if (tb % 3 == 0 || tb == list.Count)
- {
- if (tb == list.Count && list.Count % 3 != 0)
- {
- int ts = 3 - list.Count % 3;
- for (int j = 0; j < ts; j++)
- {
- sp.Append("<li></li>");
- }
- }
- sp.Append("</ul>");
- }
- tb++;
- }
- sp.Append("</div></div></div>");
- }
- list = CB.Data.Caches.GetTrendChartList();
- List<TrendChartInfo> nlist = list.Where(it=>it.Status==TrendChartStatus.Hot).ToList();
- if (null != nlist && 0 < nlist.Count)
- {
- sp.Append("<div class=\"lot-title nav-list\">");
- sp.AppendFormat("<h1><span class=\"{0}\"></span>热门专题</h1>", css);
- sp.Append("</div>");
- sp.Append("<div class=\"wrap\"><div class=\"content\"><div class=\"navlist\">");
- int tb = 1;
- foreach (var item in nlist)
- {
- if (tb % 3 == 1)
- {
- sp.Append("<ul>");
- }
- sp.AppendFormat("<li><a href=\"/tb/{2}_{3}.htm\">{0}{1}</a></li>",// style=\"color:#2574c5\"
- Regex.Replace(item.Name, "^" + lottery.Name, "", RegexOptions.IgnoreCase),
- GetTrendChartStatus(item.Status), item.Cid, item.Id);
- if (tb % 3 == 0 || tb == list.Count)
- {
- if (tb == list.Count && list.Count % 3 != 0)
- {
- int ts = 3 - list.Count % 3;
- for (int j = 0; j < ts; j++)
- {
- sp.Append("<li></li>");
- }
- }
- sp.Append("</ul>");
- }
- tb++;
- }
- sp.Append("</div></div></div>");
- }
- base.InitData();
- }
- private string GetTrendChartStatus(TrendChartStatus status)
- {
- switch (status)
- {
- case TrendChartStatus.New:
- return "<span class=\"new\"></span>";
- case TrendChartStatus.Hot:
- return "<span class=\"hot\"></span>";
- }
- return "";
- }
- }
- }
|