using Common; using KJH55128_Rec.Business; using KJH55128_Rec.Business.TJ; using KJH55128_Rec.Business.TrendChart; using KJH55128_Rec.ViewModels; using Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace KJH55128_Rec.Controllers { public class TemplateController : Controller { ////高频彩11x5部分区分 //private List dfclottery = new List() //{ "jiangsu11x5","heilongjiang11x5","guangdong11x5","hebei11x5","liaoning11x5", // "jiangxi11x5","jilin11x5","shandong11x5","yunnan11x5","zhejiang11x5"}; //高频彩11x5部分区分 private List dfclottery = new List() { "GP_11x5_JiangSu","GP_11x5_HeiLongJiang","GP_11x5_GuangDong","GP_11x5_HeBei","GP_11x5_LiaoNing", "GP_11x5_JiangXi","GP_11x5_JiLin","GP_11x5_ShanDong","GP_11x5_YunNan","GP_11x5_ZheJiang"}; /// /// 全国彩开奖table /// /// public PartialViewResult _qgc(string type) { ViewBag.lottery = type; List data = KJApiBLL.GetLotteryList(type, 0, 0, "Term", null, 10, true);// 查倒数 return PartialView(data); } /// /// 地方彩开奖table /// /// public PartialViewResult _dfc(string type) { ViewBag.lottery = type; List data = KJApiBLL.GetLotteryList(type, 0, 0, "Term", null, 10, true);// 查倒数 return PartialView(data); } #region 高频彩 /// /// 高频彩11x5开奖table /// /// /// public PartialViewResult _gpc11x5(string type, string date) { ViewBag.Dispaly = getDfcIsDisplay(type); List data = new List(); if (string.IsNullOrWhiteSpace(date)) { data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 } else { Dictionary dict2 = null; dict2["MinDate"] = date + " 00:00:00"; dict2["MaxDate"] = date + " 23:59:59"; data = KJApiBLL.GetLotteryList(type, 0, 0, null, dict2, 0, true); } return PartialView(data); } /// /// 高频彩快3开奖table /// /// /// public PartialViewResult _gpck3(string type, string date) { List data = new List(); if (string.IsNullOrWhiteSpace(date)) { data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 } else { Dictionary dict2 = null; dict2["MinDate"] = date + " 00:00:00"; dict2["MaxDate"] = date + " 23:59:59"; data = KJApiBLL.GetLotteryList(type, 0, 0, null, dict2, 0, true); } return PartialView(data); } /// /// 高频彩快12开奖table /// /// /// public PartialViewResult _gpckl12(string type, string date) { List data = new List(); if (string.IsNullOrWhiteSpace(date)) { data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 } else { Dictionary dict2 = null; dict2["MinDate"] = date + " 00:00:00"; dict2["MaxDate"] = date + " 23:59:59"; data = KJApiBLL.GetLotteryList(type, 0, 0, null, dict2, 0, true); } return PartialView(data); } /// /// 高频彩快乐十分开奖table /// /// /// public PartialViewResult _gpcklsf(string type, string date) { ViewBag.lottery = type; List data = new List(); if (string.IsNullOrWhiteSpace(date)) { data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 } else { Dictionary dict2 = null; dict2["MinDate"] = date + " 00:00:00"; dict2["MaxDate"] = date + " 23:59:59"; data = KJApiBLL.GetLotteryList(type, 0, 0, null, dict2, 0, true); } return PartialView(data); } /// /// 高频彩时时彩table /// /// /// public PartialViewResult _gpcssc(string type, string date) { ViewBag.lottery = type; List data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 return PartialView(data); } /// /// 高频彩其他table /// /// /// public PartialViewResult _gpcqt(string type, string date) { ViewBag.lottery = type; List data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数 return PartialView(data); } #endregion /// /// 控制高频彩11x5部分区分模板的单元格 /// /// /// private bool getDfcIsDisplay(string type) { return dfclottery.FindIndex(d => d == type) > -1; } /// /// 返回彩种的历史记录table分页 /// /// 模板名 /// 彩种名 /// 多少天以内 /// /// /// /// 倒数多少条 /// public PartialViewResult _getTable(string tablename = "", string lotterytype = "", int day = 1, int num = 0, string date = "", int year = 0,string qs="") { //lotterytype = EnumHelper.GETEnumTypeByText(lotterytype); ViewBag.lottery = lotterytype; ViewBag.Dispaly = getDfcIsDisplay(lotterytype); string param = null; Dictionary dict2 = null; if (tablename.IndexOf("qgc") != -1 || tablename.IndexOf("dfc") != -1) { //全国彩地方彩 if (num == 0 && day == 1&& year == 0 && string.IsNullOrWhiteSpace(qs))//初始化 { day = 0; num = 20; param = "Term"; } else { day = 0; param = "Term"; } if (year != 0) { dict2 = new Dictionary(); dict2["MinYear"] = year; dict2["MaxYear"] = (year + 1); } if (!string.IsNullOrWhiteSpace(qs)) { dict2 = new Dictionary(); dict2["Num"] = qs; } try { int value = -1; value = (int)Enum.Parse(typeof(EnumZXCid), lotterytype); 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; } } catch { } } else { //高频彩 if (!string.IsNullOrWhiteSpace(date)) { //date = DateTime.ParseExact(date, "yyyyMMdd", null).ToString("yyyy-MM-dd"); dict2 = new Dictionary(); dict2["MinDate"] = date + " 00:00:00"; dict2["MaxDate"] = date + " 23:59:59"; day = 0; } } List data = KJApiBLL.GetLotteryList(lotterytype, day, 0, param, dict2, num, true); return PartialView(tablename, data); } /// /// 返回彩种的历史记录table接口 /// /// 模板名 /// 彩种名 /// 多少天以内 /// /// /// /// 倒数多少条 /// [HttpPost] public PartialViewResult _getTables(string tablename = "", string lotterytype = "", int day = 1, int num = 0, string minDate = "", string maxDate = "") { //lotterytype = EnumHelper.GETEnumTypeByText(lotterytype); ViewBag.lottery = lotterytype; ViewBag.Dispaly = getDfcIsDisplay(lotterytype); string param = null; if (num > 0) { param = "Term"; } Dictionary dict2 = null; if (!string.IsNullOrWhiteSpace(minDate) || !string.IsNullOrWhiteSpace(maxDate)) { dict2 = new Dictionary(); dict2["MinDate"] = minDate; dict2["MaxDate"] = maxDate; } List data = KJApiBLL.GetLotteryList(lotterytype, day, 0, param, dict2, num, true); try { int value = -1; value = (int)Enum.Parse(typeof(EnumZXCid), lotterytype); 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; } } catch { } return PartialView(tablename, data); } /// /// 获取开奖数据 /// /// /// [HttpPost] public JsonResult _getKjData(string lotterytype = "") { //lotterytype = EnumHelper.GETEnumTypeByText(lotterytype); if (!string.IsNullOrWhiteSpace(lotterytype)) { LotteryData data = KJApiBLL.GetLotteryAdTJ(lotterytype); return Json(data, JsonRequestBehavior.AllowGet); } else { return Json(new { msg = "lotterytype 参数传值有误" }, JsonRequestBehavior.AllowGet); } } /// /// 开机号、试机号年份、近10期切换 /// /// /// /// /// /// /// [HttpPost] public PartialViewResult _getKJHorSJHTable(string lotterytype, string type = "kjh", int term = 0, string minTerm = "", string maxTerm = "", string minYear = "", string maxYear = "") { if (!string.IsNullOrWhiteSpace(lotterytype)) { lotterytype = EnumHelper.GETEnumTypeByText(lotterytype); Dictionary dict2 = null; string param = null; if (term > 0) { param = "Term"; } if (!string.IsNullOrWhiteSpace(minYear) || !string.IsNullOrWhiteSpace(maxYear)) { dict2 = new Dictionary(); dict2["MinYear"] = minYear; dict2["MaxYear"] = maxYear; } if (!string.IsNullOrWhiteSpace(minTerm) || !string.IsNullOrWhiteSpace(maxTerm)) { dict2 = new Dictionary(); dict2["MinTerm"] = minTerm; dict2["MaxTerm"] = maxTerm; } List data = null; if (type == "kjh") { data = KJApiBLL.GetLotteryListKaiJiHao(lotterytype, 0, 0, param, dict2, term, true); return PartialView("_kjhTable", data); } else { data = KJApiBLL.GetLotteryListShiJiHao(lotterytype, 0, 0, param, dict2, term, true); return PartialView("_sjhTable", data); } } else { return PartialView("/Shared/Error"); } } /// /// 开机号||试机号按期号查询 /// /// /// /// /// [HttpPost] public JsonResult _getKJHorSJHDataByTerm(string lotterytype = "fc3d", string type = "kjh", string qs = "") { try { if (!string.IsNullOrWhiteSpace(lotterytype)) { lotterytype = EnumHelper.GETEnumTypeByText(lotterytype); Dictionary dict2 = null; if (!string.IsNullOrWhiteSpace(qs)) { dict2 = new Dictionary(); dict2["Num"] = qs; } KaiJiHaoAdShijihaoHModel data = null; if (type == "kjh") { data = KJApiBLL.GetLotteryListKaiJiHao(lotterytype, 0, 0, null, dict2, 0, true)[0].Kaijianghao; } else { data = KJApiBLL.GetLotteryListShiJiHao(lotterytype, 0, 0, null, dict2, 0, true)[0].Shijihao; } return Json(data, JsonRequestBehavior.AllowGet); } else { return Json(new { msg = "lotterytype 参数传值有误" }, JsonRequestBehavior.AllowGet); } } catch (Exception ee) { return null; } } /// /// 高频彩页面展示彩种切换接口 /// /// /// public PartialViewResult _getNavLotteryTable(string id) { //id = TJApiBLL.GetBaseItemLottery().FirstOrDefault(d => d.ItemCode == id).ItemId; List types = TJApiBLL.GetShowHomeTypes(id); List datalist = KJApiBLL.GetLotteryAdTJ(types); return PartialView("_navLotteryTable", datalist); } /// /// 历史上的今天 /// /// /// /// public PartialViewResult _getSjhHistoryToday(string lotterytype, string term) { Dictionary dict = null; List list = new List(); if (!string.IsNullOrWhiteSpace(lotterytype) && !string.IsNullOrWhiteSpace(term)) { dict = new Dictionary(); dict["InTerm"] = getTerms(term); list = KJApiBLL.GetLotteryListShiJiHao(lotterytype, 0, 0, null, dict); } return PartialView("_sjhTable", list); } private List getTerms(string term) { int num = 0; string per = ""; List terms = new List(); if (term.Length >= 7) { num = Int32.Parse(term.Substring(0, 4)); per = term.Substring(4, 3); } else { num = Int32.Parse(term.Substring(0, 2)); per = term.Substring(2, 3); } int yearCount = DateTime.Now.Year - 2000; for (int i = 0; i <= yearCount; i++) { terms.Add((num - i).ToString() + per); } return terms; } } }