123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- 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<string> dfclottery = new List<string>()
- //{ "jiangsu11x5","heilongjiang11x5","guangdong11x5","hebei11x5","liaoning11x5",
- // "jiangxi11x5","jilin11x5","shandong11x5","yunnan11x5","zhejiang11x5"};
- //高频彩11x5部分区分
- private List<string> dfclottery = new List<string>()
- { "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"};
- /// <summary>
- /// 全国彩开奖table
- /// </summary>
- /// <returns></returns>
- public PartialViewResult _qgc(string type)
- {
- ViewBag.lottery = type;
- List<LotteryViewModel> data = KJApiBLL.GetLotteryList(type, 0, 0, "Term", null, 10, true);// 查倒数
- return PartialView(data);
- }
- /// <summary>
- /// 地方彩开奖table
- /// </summary>
- /// <returns></returns>
- public PartialViewResult _dfc(string type)
- {
- ViewBag.lottery = type;
- List<LotteryViewModel> data = KJApiBLL.GetLotteryList(type, 0, 0, "Term", null, 10, true);// 查倒数
- return PartialView(data);
- }
- #region 高频彩
- /// <summary>
- /// 高频彩11x5开奖table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpc11x5(string type, string date)
- {
- ViewBag.Dispaly = getDfcIsDisplay(type);
- List<LotteryViewModel> data = new List<LotteryViewModel>();
- if (string.IsNullOrWhiteSpace(date))
- {
- data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- }
- else
- {
- Dictionary<string, object> 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);
- }
- /// <summary>
- /// 高频彩快3开奖table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpck3(string type, string date)
- {
- List<LotteryViewModel> data = new List<LotteryViewModel>();
- if (string.IsNullOrWhiteSpace(date))
- {
- data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- }
- else
- {
- Dictionary<string, object> 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);
- }
- /// <summary>
- /// 高频彩快12开奖table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpckl12(string type, string date)
- {
- List<LotteryViewModel> data = new List<LotteryViewModel>();
- if (string.IsNullOrWhiteSpace(date))
- {
- data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- }
- else
- {
- Dictionary<string, object> 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);
- }
- /// <summary>
- /// 高频彩快乐十分开奖table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpcklsf(string type, string date)
- {
- ViewBag.lottery = type;
- List<LotteryViewModel> data = new List<LotteryViewModel>();
- if (string.IsNullOrWhiteSpace(date))
- {
- data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- }
- else
- {
- Dictionary<string, object> 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);
- }
- /// <summary>
- /// 高频彩时时彩table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpcssc(string type, string date)
- {
- ViewBag.lottery = type;
- List<LotteryViewModel> data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- return PartialView(data);
- }
- /// <summary>
- /// 高频彩其他table
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _gpcqt(string type, string date)
- {
- ViewBag.lottery = type;
- List<LotteryViewModel> data = KJApiBLL.GetLotteryList(type, 1, 0, null, null, 0, true);// 查天数
- return PartialView(data);
- }
- #endregion
- /// <summary>
- /// 控制高频彩11x5部分区分模板的单元格
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- private bool getDfcIsDisplay(string type)
- {
- return dfclottery.FindIndex(d => d == type) > -1;
- }
- /// <summary>
- /// 返回彩种的历史记录table分页
- /// </summary>
- /// <param name="tablename">模板名</param>
- /// <param name="lotterytype">彩种名</param>
- /// <param name="day">多少天以内</param>
- /// <param name="num"></param>
- /// <param name="order"></param>
- /// <param name="param"></param>
- /// <param name="count">倒数多少条</param>
- /// <returns></returns>
- public PartialViewResult _getTable(string tablename = "", string lotterytype = "",
- int day = 1, int num = 0, string date = "", int year = 0,string qs="")
- {
- //lotterytype = EnumHelper.GETEnumTypeByText<SCCLottery>(lotterytype);
- ViewBag.lottery = lotterytype;
- ViewBag.Dispaly = getDfcIsDisplay(lotterytype);
- string param = null;
- Dictionary<string, object> 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<string, object>();
- dict2["MinYear"] = year;
- dict2["MaxYear"] = (year + 1);
- }
- if (!string.IsNullOrWhiteSpace(qs))
- {
- dict2 = new Dictionary<string, object>();
- 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<string, object>();
- dict2["MinDate"] = date + " 00:00:00";
- dict2["MaxDate"] = date + " 23:59:59";
- day = 0;
- }
- }
- List<LotteryViewModel> data = KJApiBLL.GetLotteryList(lotterytype, day, 0, param, dict2, num, true);
- return PartialView(tablename, data);
- }
- /// <summary>
- /// 返回彩种的历史记录table接口
- /// </summary>
- /// <param name="tablename">模板名</param>
- /// <param name="lotterytype">彩种名</param>
- /// <param name="day">多少天以内</param>
- /// <param name="num"></param>
- /// <param name="order"></param>
- /// <param name="param"></param>
- /// <param name="count">倒数多少条</param>
- /// <returns></returns>
- [HttpPost]
- public PartialViewResult _getTables(string tablename = "", string lotterytype = "", int day = 1, int num = 0,
- string minDate = "", string maxDate = "")
- {
- //lotterytype = EnumHelper.GETEnumTypeByText<SCCLottery>(lotterytype);
- ViewBag.lottery = lotterytype;
- ViewBag.Dispaly = getDfcIsDisplay(lotterytype);
- string param = null;
- if (num > 0)
- {
- param = "Term";
- }
- Dictionary<string, object> dict2 = null;
- if (!string.IsNullOrWhiteSpace(minDate) || !string.IsNullOrWhiteSpace(maxDate))
- {
- dict2 = new Dictionary<string, object>();
- dict2["MinDate"] = minDate;
- dict2["MaxDate"] = maxDate;
- }
- List<LotteryViewModel> 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);
- }
- /// <summary>
- /// 获取开奖数据
- /// </summary>
- /// <param name="lotterytype"></param>
- /// <returns></returns>
- [HttpPost]
- public JsonResult _getKjData(string lotterytype = "")
- {
- //lotterytype = EnumHelper.GETEnumTypeByText<SCCLottery>(lotterytype);
- if (!string.IsNullOrWhiteSpace(lotterytype))
- {
- LotteryData data = KJApiBLL.GetLotteryAdTJ(lotterytype);
- return Json(data, JsonRequestBehavior.AllowGet);
- }
- else
- {
- return Json(new { msg = "lotterytype 参数传值有误" }, JsonRequestBehavior.AllowGet);
- }
- }
- /// <summary>
- /// 开机号、试机号年份、近10期切换
- /// </summary>
- /// <param name="lotterytype"></param>
- /// <param name="type"></param>
- /// <param name="term"></param>
- /// <param name="minYear"></param>
- /// <param name="maxYear"></param>
- /// <returns></returns>
- [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<SCCLottery>(lotterytype);
- Dictionary<string, object> dict2 = null;
- string param = null;
- if (term > 0)
- {
- param = "Term";
- }
- if (!string.IsNullOrWhiteSpace(minYear) || !string.IsNullOrWhiteSpace(maxYear))
- {
- dict2 = new Dictionary<string, object>();
- dict2["MinYear"] = minYear;
- dict2["MaxYear"] = maxYear;
- }
- if (!string.IsNullOrWhiteSpace(minTerm) || !string.IsNullOrWhiteSpace(maxTerm))
- {
- dict2 = new Dictionary<string, object>();
- dict2["MinTerm"] = minTerm;
- dict2["MaxTerm"] = maxTerm;
- }
- List<LotteryKaiJiHaoAdShijihaoHModel> 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");
- }
- }
- /// <summary>
- /// 开机号||试机号按期号查询
- /// </summary>
- /// <param name="lotterytype"></param>
- /// <param name="type"></param>
- /// <param name="qs"></param>
- /// <returns></returns>
- [HttpPost]
- public JsonResult _getKJHorSJHDataByTerm(string lotterytype = "fc3d", string type = "kjh", string qs = "")
- {
- try
- {
- if (!string.IsNullOrWhiteSpace(lotterytype))
- {
- lotterytype = EnumHelper.GETEnumTypeByText<SCCLottery>(lotterytype);
- Dictionary<string, object> dict2 = null;
- if (!string.IsNullOrWhiteSpace(qs))
- {
- dict2 = new Dictionary<string, object>();
- 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;
- }
- }
- /// <summary>
- /// 高频彩页面展示彩种切换接口
- /// </summary>
- /// <param name="types"></param>
- /// <returns></returns>
- public PartialViewResult _getNavLotteryTable(string id)
- {
- //id = TJApiBLL.GetBaseItemLottery().FirstOrDefault(d => d.ItemCode == id).ItemId;
- List<string> types = TJApiBLL.GetShowHomeTypes(id);
- List<LotteryData> datalist = KJApiBLL.GetLotteryAdTJ(types);
- return PartialView("_navLotteryTable", datalist);
- }
- /// <summary>
- /// 历史上的今天
- /// </summary>
- /// <param name="lotterytype"></param>
- /// <param name="type"></param>
- /// <returns></returns>
- public PartialViewResult _getSjhHistoryToday(string lotterytype, string term)
- {
- Dictionary<string, object> dict = null;
- List<LotteryKaiJiHaoAdShijihaoHModel> list = new List<LotteryKaiJiHaoAdShijihaoHModel>();
- if (!string.IsNullOrWhiteSpace(lotterytype) && !string.IsNullOrWhiteSpace(term))
- {
- dict = new Dictionary<string, object>();
- dict["InTerm"] = getTerms(term);
- list = KJApiBLL.GetLotteryListShiJiHao(lotterytype, 0, 0, null, dict);
- }
- return PartialView("_sjhTable", list);
- }
- private List<string> getTerms(string term)
- {
- int num = 0; string per = "";
- List<string> terms = new List<string>();
- 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;
- }
- }
- }
|