123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503 |
- using Common;
- using KJH55128_Rec.Business;
- using KJH55128_Rec.Business.TJ;
- using KJH55128_Rec.Business.TrendChart;
- using KJH55128_Rec.Util;
- using KJH55128_Rec.ViewModels;
- using Models;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using static Common.HongKongHelper;
- namespace KJH55128_Rec.Controllers
- {
- public class HomeController : Controller
- {
- public ActionResult Mindex()
- {
- return Redirect("/index.html");
- }
- [Route("index.html")]
- public ActionResult Index()
- {
- List<string> types = TJApiBLL.GetHomeTypes();
- List<LotteryData> list = KJApiBLL.GetLotteryAdTJ(types);
- return View(list);
- }
- /// <summary>
- /// 历史开奖
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- //[Route("kjls/{area}/{type}.html")]
- //[Route("kjls/{area}/{type}/{date}.html")]
- [Route("kjls/{strparams}.html")]
- public ActionResult KJXQ(string strparams)
- {
- string area = "", type = "", date = "";
- string[] arrs = strparams.Split('-');
- if (arrs.Length > 0)
- {
- area = ValidationTools.CheckStr(arrs[0], "gpc", 5);
- type = ValidationTools.CheckStr(arrs[1], "fc3d", 20);
- if (arrs.Length == 3)
- {
- date = ValidationTools.CheckStr(arrs[2], null, 15);
- }
- }
- string code = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- type = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- LotteryData data = KJApiBLL.GetLotteryAdTJ(type);
- if (type == "DF_SMHLHC_HongKong")
- {
- var newBall = GetHongKongLotteryAttr(data.RedBall.ToList());
- ViewBag.newBall = newBall;
- ViewBag.bs = BoSeDict;
- ViewBag.sx = ShengXiaoDict;
- ViewBag.wx = WuXingDict;
- }
- ViewBag.area = area;
- if (!string.IsNullOrWhiteSpace(date))
- {
- try
- {
- date = DateTime.ParseExact(date, "yyyyMMdd", null).ToString("yyyy-MM-dd");
- ViewBag.date = date;
- }
- catch
- {
- if (date.IndexOf("y") != -1)
- {
- ViewBag.year = ValidationTools.CheckInt(date.Substring(1, date.Length - 1), 2000, (DateTime.Now.Year + 1));
- }
- if (date.IndexOf("q") != -1)
- {
- ViewBag.qs = ValidationTools.CheckInt(date.Substring(1, date.Length - 1), 0, 9999999);
- }
- if (date.IndexOf("n") != -1)
- {
- ViewBag.num = ValidationTools.CheckInt(date.Substring(1, date.Length - 1), 29, 121);
- }
- }
- }
- int value = -1;
- try
- {
- value = (int)Enum.Parse(typeof(EnumZXCid), type);
- ZXViewModel temp = new ZXViewModel();
- temp = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.Contains("基本") && d.Name.IndexOf("手机") == -1);
- if (temp == null)
- {
- ViewBag.zsSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.IndexOf("手机") == -1).Url;
- }
- else
- {
- ViewBag.zsSrc = temp.Url;
- }
- ViewBag.toolSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).FirstOrDefault().Url;
- }
- catch
- {
- }
- string TDKType = EnumHelper.GetSCCLotteryTDKTypeName((SCCLottery)Enum.Parse(typeof(SCCLottery), code));
- ViewBag.tdk = KJApiBLL.GetTDK(TDKType);
- return View(data);
- }
- /// <summary>
- /// 开机号
- /// </summary>
- /// <returns></returns>
- //[Route("kjh/{type}.html")]
- //[Route("kjh/{type}/{param}.html")]
- //[Route("kjh/{type}/{param}/{term}.html")]
- [Route("kjh/{strparams}.html")]
- public ActionResult KJH(string strparams)
- {
- string type = "", param = "", complex = "";
- int term = 0;
- string[] arrs = strparams.Split('-');
- if (arrs.Length > 0)
- {
- type = ValidationTools.CheckStr(arrs[0], "fc3d", 5);
- if (arrs.Length == 2)
- {
- param = ValidationTools.CheckStr(arrs[1], null, 20);
- }
- if (arrs.Length == 3)
- {
- param = ValidationTools.CheckStr(arrs[1], null, 20);
- complex = ValidationTools.CheckStr(arrs[2], null, 15);
- }
- }
- ViewBag.code = type;
- ViewBag.term = 30;
- KJiHdescribe kJiHdescribe = new KJiHdescribe();
- if (type == "fc3d")
- {
- ViewBag.desc = kJiHdescribe.GetValueByKey(SCCLottery.QG_FC3D.ToString() + "-" + KJDdescribeType.What);
- }
- if (type == "ssq")
- {
- ViewBag.desc = kJiHdescribe.GetValueByKey(SCCLottery.QG_FCSSQ.ToString() + "-" + KJDdescribeType.What);
- }
- if (type == "pl3")
- {
- ViewBag.desc = kJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + KJDdescribeType.What);
- }
- if (type == "dlt")
- {
- ViewBag.desc = kJiHdescribe.GetValueByKey(SCCLottery.QG_TCDLT.ToString() + "-" + KJDdescribeType.What);
- }
- type = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- List<LotteryKaiJiHaoAdShijihaoHModel> data = new List<LotteryKaiJiHaoAdShijihaoHModel>();
- if (string.IsNullOrWhiteSpace(param))
- {
- //var firstmodel = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, "Term", null, 5, true).FirstOrDefault();
- data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, "Term", null, 20, true);
- }
- else
- {
- Dictionary<string, object> dict2 = null;
- if (param.IndexOf("y") != -1)
- {
- int year = 0;
- year = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 2000, (DateTime.Now.Year + 1));
- dict2 = new Dictionary<string, object>();
- dict2["MinYear"] = year;
- dict2["MaxYear"] = year + 1;
- //data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- else if (param.IndexOf("n") != -1)
- {
- term = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 29, 121);
- ViewBag.term = term;
- dict2 = new Dictionary<string, object>();
- dict2["Num"] = term;
- //data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, "Term", dict2, term, true);
- }
- else if (param.IndexOf("q") != -1)
- {
- int qs = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 0, 9999999);
- dict2 = new Dictionary<string, object>();
- dict2["Num"] = qs;
- //data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- else
- {
- dict2 = new Dictionary<string, object>();
- int s_qs = ValidationTools.CheckInt(param, 0, 9999999);
- int e_qs = ValidationTools.CheckInt(complex, 0, 9999999);
- if (s_qs > e_qs)
- {
- int temp = e_qs;
- e_qs = s_qs;
- s_qs = temp;
- }
- dict2["MinTerm"] = s_qs;
- dict2["MaxTerm"] = e_qs;
- //data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- data = KJApiBLL.GetLotteryListKaiJiHao(type, 0, 0, "Term", dict2, term, true);
- }
- int value = -1;
- try
- {
- value = (int)Enum.Parse(typeof(EnumZXCid), type);
- ZXViewModel temp = new ZXViewModel();
- temp = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.Contains("基本") && d.Name.IndexOf("手机") == -1);
- if (temp == null)
- {
- ViewBag.zsSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.IndexOf("手机") == -1).Url;
- }
- else
- {
- ViewBag.zsSrc = temp.Url;
- }
- ViewBag.toolSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).FirstOrDefault().Url;
- }
- catch
- {
- }
- return View(data);
- }
- /// <summary>
- /// 试机号
- /// </summary>
- /// <returns></returns>
- //[Route("sjh/{type}.html")]
- //[Route("sjh/{type}/{param}.html")]
- //[Route("sjh/{type}/{param}/{term}.html")]
- [Route("sjh/{strparams}.html")]
- public ActionResult SJH(string strparams)
- {
- string type = "", param = "", complex = "";
- int term = 0;
- string[] arrs = strparams.Split('-');
- if (arrs.Length > 0)
- {
- type = ValidationTools.CheckStr(arrs[0], "fc3d", 5);
- if (arrs.Length == 2)
- {
- param = ValidationTools.CheckStr(arrs[1], null, 20);
- }
- if (arrs.Length == 3)
- {
- param = ValidationTools.CheckStr(arrs[1], null, 20);
- complex = ValidationTools.CheckStr(arrs[2], null, 15);
- }
- }
- ViewBag.code = type;
- ViewBag.term = 30;
- type = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- List<LotteryKaiJiHaoAdShijihaoHModel> data = new List<LotteryKaiJiHaoAdShijihaoHModel>();
- if (string.IsNullOrWhiteSpace(param))
- {
- data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, "Term", null, 20, true);
- }
- else
- {
- Dictionary<string, object> dict2 = null;
- if (param.IndexOf("y") != -1)
- {
- int year = 0;
- year = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 2000, (DateTime.Now.Year + 1));
- dict2 = new Dictionary<string, object>();
- dict2["MinYear"] = year;
- dict2["MaxYear"] = year + 1;
- //data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- else if (param.IndexOf("n") != -1)
- {
- term = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 29, 121);
- ViewBag.term = term;
- dict2 = new Dictionary<string, object>();
- dict2["Num"] = term;
- //data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, "Term", dict2, term, true);
- }
- else if (param.IndexOf("q") != -1)
- {
- int qs = ValidationTools.CheckInt(param.Substring(1, param.Length - 1), 0, 9999999);
- dict2 = new Dictionary<string, object>();
- dict2["Num"] = qs;
- //data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- else
- {
- dict2 = new Dictionary<string, object>();
- int s_qs = ValidationTools.CheckInt(param, 0, 9999999);
- int e_qs = ValidationTools.CheckInt(complex, 0, 9999999);
- if (s_qs > e_qs)
- {
- int temp = e_qs;
- e_qs = s_qs;
- s_qs = temp;
- }
- dict2["MinTerm"] = s_qs;
- dict2["MaxTerm"] = e_qs;
- //data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, null, dict2, 0, true);
- }
- data = KJApiBLL.GetLotteryListShiJiHao(type, 0, 0, "Term", dict2, term, true);
- }
- int value = -1;
- try
- {
- value = (int)Enum.Parse(typeof(EnumZXCid), type);
- ZXViewModel temp = new ZXViewModel();
- temp = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.Contains("基本") && d.Name.IndexOf("手机") == -1);
- if (temp == null)
- {
- ViewBag.zsSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.IndexOf("手机") == -1).Url;
- }
- else
- {
- ViewBag.zsSrc = temp.Url;
- }
- ViewBag.toolSrc = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).FirstOrDefault().Url;
- }
- catch
- {
- }
- return View(data);
- }
- /// <summary>
- /// 全国彩
- /// </summary>
- /// <returns></returns>
- [Route("qgc.html")]
- public ActionResult QGC()
- {
- //string id = TJApiBLL.GetBaseItemLottery().FirstOrDefault(d => d.Value == "QGC").Key;
- List<string> types = TJApiBLL.GetShowHomeTypes("QGC");
- List<LotteryData> datalist = KJApiBLL.GetLotteryAdTJ(types);
- return View(datalist);
- }
- /// <summary>
- /// 地方彩
- /// </summary>
- /// <returns></returns>
- [Route("dfc.html")]
- public ActionResult DFC()
- {
- //string id = TJApiBLL.GetBaseItemLottery().FirstOrDefault(d => d.Value == "DFC").Key;
- List<string> types = TJApiBLL.GetShowHomeTypes("DFC");
- List<LotteryData> datalist = KJApiBLL.GetLotteryAdTJ(types);
- if (types.Where(a => a == "DF_SMHLHC_HongKong").ToList().Count == 1)
- {
- var data = datalist.Where(a => a.LotteryType == "DF_SMHLHC_HongKong").FirstOrDefault();
- if (data != null)
- {
- var newBall = GetHongKongLotteryAttr(data.RedBall.ToList());
- ViewBag.newBall = newBall;
- }
- }
- return View(datalist);
- }
- /// <summary>
- /// 高频彩
- /// </summary>
- /// <returns></returns>
- [Route("gpc.html")]
- public ActionResult GPC()
- {
- //string id = TJApiBLL.GetBaseItemLottery().FirstOrDefault(d => d.Value == "GPC11X5").Key;
- List<string> types = TJApiBLL.GetShowHomeTypes("GPC11X5");
- List<LotteryData> datalist = KJApiBLL.GetLotteryAdTJ(types);
- return View(datalist);
- }
- /// <summary>
- /// 开奖详情
- /// </summary>
- /// <returns></returns>
- //[Route("kjxq/{area}/{type}.html")]
- //[Route("kjxq/{area}/{type}/{num}.html")]
- [Route("kjxq/{strparams}.html")]
- public ActionResult KJDetail(string strparams)
- {
- string area = "", type = "", num = "";
- string[] arrs = strparams.Split('-');
- if (arrs.Length > 0)
- {
- area = ValidationTools.CheckStr(arrs[0], "gpc", 5);
- type = ValidationTools.CheckStr(arrs[1], "fc3d", 20);
- if (arrs.Length == 3)
- {
- num = ValidationTools.CheckStr(arrs[2], null, 15);
- }
- }
- try
- {
- string code = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- LotteryData data = new LotteryData();
- LotterySupply lottsumodel = new LotterySupply();
- ViewBag.area = area;
- if (!string.IsNullOrWhiteSpace(num))
- {
- int intnum = 0;
- int.TryParse(num, out intnum);
- Dictionary<string, object> dict = new Dictionary<string, object>();
- dict["Num"] = intnum;
- LotteryViewModel temp = KJApiBLL.GetLotteryList(code, 0, 0, null, dict).FirstOrDefault(); //查期号
- data.OpenTime = temp.OpenTime;
- data.LotteryName = temp.LotteryName;
- data.Term = temp.LotteryName;
- data.LotteryText = type;
- data.MoneyPond = temp.MoneyPond;
- data.MoneyCount = temp.MoneyCount;
- data.RedBall = temp.RedBall;
- data.BlueBall = temp.BlueBall;
- data.Term = intnum.ToString();
- data.LotteryType = temp.LotteryType;
- data.KJTime = temp.KJTime;
- lottsumodel.hezhi = temp.hezhi;
- lottsumodel.daxiaobi = temp.daxiao;
- lottsumodel.jioubi = temp.jio;
- if (temp.Details != null && temp.Details.Count > 0)
- {
- for (int i = 0; i < temp.Details.Count; i++)
- {
- data.Details.Add(new LotteryDetail(temp.Details[i].Label, temp.Details[i].Value));
- }
- }
- if (temp.Results != null && temp.Results.Count > 0)
- {
- data.ResultsList = new List<LotteryResults>();
- for (int i = 0; i < temp.Results.Count; i++)
- {
- data.ResultsList.Add(new LotteryResults(temp.Results[i].LevelName, temp.Results[i].Count, temp.Results[i].Money));
- }
- }
- }
- else
- {
- data = KJApiBLL.GetLotteryAdTJ(code);
- //和值 奇偶比 大小比;
- if (data.Details.Select(w => w.Label).ToList().Contains("大小比"))
- {
- lottsumodel.daxiaobi = data.Details.FirstOrDefault(w => w.Label == "大小比").Value.ToString();
- }
- if (data.Details.Select(w => w.Label).ToList().Contains("奇偶比"))
- {
- lottsumodel.jioubi = data.Details.FirstOrDefault(w => w.Label == "奇偶比").Value.ToString();
- }
- if (data.Details.Select(w => w.Label).ToList().Contains("和值"))
- {
- lottsumodel.hezhi = data.Details.FirstOrDefault(w => w.Label == "和值").Value.ToString();
- }
- }
- int value = -1;
- try
- {
- value = (int)Enum.Parse(typeof(EnumZXCid), code);
- ZXViewModel temp = new ZXViewModel();
- temp = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.Contains("基本") && d.Name.IndexOf("手机") == -1);
- if (temp == null)
- {
- lottsumodel.zsurl = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).FirstOrDefault(d => d.Name.IndexOf("手机") == -1).Url;
- }
- else
- {
- lottsumodel.zsurl = temp.Url;
- }
- lottsumodel.gjurl = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).FirstOrDefault().Url;
- }
- catch (Exception e)
- {
- Console.Write(e);
- }
- ViewBag.lotterysu = lottsumodel;
- string TDKType = EnumHelper.GetSCCLotteryTDKTypeName((SCCLottery)Enum.Parse(typeof(SCCLottery), code));
- ViewBag.tdk=KJApiBLL.GetTDK(TDKType);
- string type1 = EnumHelper.GETEnumTypeByText<SCCLottery>(type);
- if (type1 == "DF_SMHLHC_HongKong")
- {
- var newBall = GetHongKongLotteryAttr(data.RedBall.ToList());
- ViewBag.newBall = newBall;
- ViewBag.bs = BoSeDict;
- ViewBag.sx = ShengXiaoDict;
- ViewBag.wx = WuXingDict;
- }
- return View(data);
- }
- catch (Exception ee)
- {
- return Redirect("/");
- }
- }
- }
- }
|