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 KJH55128_Rec.Business.KJH;
namespace KJH55128_Rec.Controllers
{
public class SharedController : Controller
{
///
/// 工具
///
///
public PartialViewResult tools()
{
List list = new List();
list.Add(new IndexToolModel("福彩3D工具", "FC3DGJ", TrendChastApiBLL.GetTrendChartChache(1, (int)EnumZXTid.工具)));
list.Add(new IndexToolModel("体彩P3工具", "TCP3GJ", TrendChastApiBLL.GetTrendChartChache(2, (int)EnumZXTid.工具)));
list.Add(new IndexToolModel("体彩P5工具", "TCP5GJ", TrendChastApiBLL.GetTrendChartChache(3, (int)EnumZXTid.工具)));
list.Add(new IndexToolModel("双色球工具", "SSQGJ", TrendChastApiBLL.GetTrendChartChache(4, (int)EnumZXTid.工具)));
//string id = "c31d76a15ee54db08acbf330dba2f234";
//List list = SSApiBLL.QuerySSList(id).Take(3).ToList();
return PartialView(list);
}
///
/// 资讯
///
///
public PartialViewResult news()
{
List list = new List();
List ids = new List() {
"08a45dd1830041f493c260942fd937e4",
"23dafcc3ba6c4d67a9e98f20a0b53121",
"fe166abac4ac4baba922a72f450d374c",
"40a9e9c257a74f5f889df3c1238b1c3a" };
for (int i = 0; i < ids.Count; i++)
{
list.AddRange(ZXApiBLL.GetNewsCache()
.Where(d => d.CategoryId == ids[i])
.Take(2)
.Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress }));
}
return PartialView(list);
}
///
/// 推荐彩种
///
///
public PartialViewResult recomlot()
{
List list = TJApiBLL.GetRecommandList();
return PartialView(list);
}
///
/// 热门彩种
///
///
public PartialViewResult hotlottery()
{
List list = TJApiBLL.GetHotLotteryList();
return PartialView(list);
}
///
/// header
///
///
public PartialViewResult header(string nav = "")
{
ViewBag.nav = nav;
List data = KJApiBLL.getHeaderNav();
return PartialView(data);
}
///
/// footer
///
///
public PartialViewResult footer()
{
List list = TJApiBLL.GetFriendLinksList();
return PartialView(list);
}
///
/// 广告
///
///
public PartialViewResult ads()
{
List list = TJApiBLL.GetAdLists();
return PartialView(list);
}
///
/// 广告
///
///
[HttpPost]
public ContentResult Getads()
{
List list = TJApiBLL.GetAdLists();
return Content(list.TryToJson());
}
///
/// 全国彩|全国彩-导航bar
///
///
public PartialViewResult lotterynav(string type)
{
string id = "", name = "";
ViewLotteryType navdata = new ViewLotteryType();
switch (type)
{
case "QGC":
{
id = "qgc";//全国彩
name = "全国彩";
}
break;
case "DFC":
{
id = "dfc";//全国彩
name = "地方彩";
}
break;
}
var list = KJApiBLL.TypeList();
var data = list.Where(d => d.MenuName == id)
.Select(d => new LotteryItems(d.Name, id, d.TypeCode, d.ZSTypeCode))
.ToList();
navdata.Lotterys = data;
navdata.TypeName = name;
navdata.TypeCode = type;
return PartialView(navdata);
}
///
/// 高频彩-导航bar
///
///
public PartialViewResult gpcnav(string type, string gpcnav)
{
List navlist = KJApiBLL.getHeaderNav()
.Where(d => d.TypeCode != "QGC" && d.TypeCode != "DFC").ToList();
if (!string.IsNullOrWhiteSpace(gpcnav))
{
ViewBag.gpcnav = ("gpc" + gpcnav).ToUpper();
}
return PartialView(navlist);
}
///
/// 玩法规则导航
///
///
public PartialViewResult wfnav(string type = "QGC", string code = "ssq")
{
List list = KJApiBLL.getHeaderNav();
if (type != "QGC" && type != "DFC")
{
if (type.IndexOf("GPC") == -1)
{
type = "gpc" + type;
}
}
ViewBag.type = type.ToUpper();
ViewBag.code = code;
return PartialView(list);
}
///
/// 推荐专题???
///
///
public PartialViewResult recomnews(string code, string type = "gqc")
{
string id = null;
List list = new List();
if (type == "qgc")
{
switch (code)
{
case "fc3d": id = "08a45dd1830041f493c260942fd937e4"; break;
case "ssq": id = "23dafcc3ba6c4d67a9e98f20a0b53121"; break;
case "pl3": id = "fe166abac4ac4baba922a72f450d374c"; break;
case "dlt": id = "40a9e9c257a74f5f889df3c1238b1c3a"; break;
case "qlc": id = "b28b07513e6548719c33ddd1542e6cd6"; break;
case "qxc": id = "330e5f0e8d894c8d8f770b0ac5ce4d38"; break;
case "pl5": id = "940480808e514922b70b4863e0858354"; break;
}
list = ZXApiBLL.GetNewsCache().Where(d => d.CategoryId == id)
.Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress })
.Take(9)
.ToList();
}
else
{
// "40a9e9c257a74f5f889df3c1238b1c3a"
List ids = new List() {
"08a45dd1830041f493c260942fd937e4",
"23dafcc3ba6c4d67a9e98f20a0b53121",
"fe166abac4ac4baba922a72f450d374c",
};
for (int i = 0; i < ids.Count; i++)
{
list.AddRange(ZXApiBLL.GetNewsCache()
.Where(d => d.CategoryId == ids[i])
.Take(3)
.Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress }));
}
}
return PartialView(list);
}
///
/// 根据彩种推荐资讯
///
///
///
public PartialViewResult recomzxBytype(string type = "")
{
string id = null;
switch (type)
{
case "sjhfc3d": id = "e29e4cbe01be4799b918dc9c0aeb3926"; ViewBag.title = "3D试后分析预测"; ViewBag.more = "http://zx.55128.cn/3d/3dsjhh_list/53.htm"; break;
case "sjhpl3": id = "fe166abac4ac4baba922a72f450d374c"; ViewBag.title = "排列三分析预测"; ViewBag.more = "http://zx.55128.cn/p3/p3yc_list/23.htm"; break;
case "fc3d": id = "08a45dd1830041f493c260942fd937e4"; ViewBag.title = "福彩3D预测推荐"; ViewBag.more = "http://zx.55128.cn/3d/3dyc_list/15.htm"; break;
case "ssq": id = "23dafcc3ba6c4d67a9e98f20a0b53121"; ViewBag.title = "双色球预测推荐"; ViewBag.more = "http://zx.55128.cn/ssq/ssqyc_list/42.htm"; break;
case "pl3": id = "fe166abac4ac4baba922a72f450d374c"; ViewBag.title = "排列三预测推荐"; ViewBag.more = "http://zx.55128.cn/p3/p3yc_list/23.htm"; break;
case "dlt": id = "40a9e9c257a74f5f889df3c1238b1c3a"; ViewBag.title = "大乐透预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/dlt_list/45.htm"; break;
case "qlc": id = "b28b07513e6548719c33ddd1542e6cd6"; ViewBag.title = "七乐彩预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/qlc_list/47.htm"; break;
case "qxc": id = "330e5f0e8d894c8d8f770b0ac5ce4d38"; ViewBag.title = "七星彩预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/qxc_list/46.htm"; break;
case "pl5": id = "940480808e514922b70b4863e0858354"; ViewBag.title = "排列五预测推荐"; ViewBag.more = "http://zx.55128.cn/p3/p5_list/51.htm"; break;
}
List list = ZXApiBLL.GetNewsCache().Where(d => d.CategoryId == id)
.Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress })
.Take(15)
.ToList();
return PartialView(list);
}
///
/// 试机号描述
///
///
///
public PartialViewResult sjhDesc(string code = "", int type = 1)
{
lotteryDesc model = new lotteryDesc();
SJiHdescribe sJiHdescribe = new SJiHdescribe();
if (type == 1)
{
if (code == "fc3d")
{
model.Title = "什么是福彩3D试机号";
model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_FC3D.ToString() + "-" + SJHdescribeType.What);
}
else
{
model.Title = "什么是排列三试机号";
model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.What);
}
}
else
{
if (code == "fc3d")
{
model.Title = "3D试机号与开奖号的关系";
model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.Andkjh);
}
else
{
model.Title = "排列三试机号与开奖号关系";
model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.Andkjh);
}
}
return PartialView(model);
}
///
/// 走势图工具推荐
///
///
///
public PartialViewResult zsTools(string lottery = "", int type = 0)
{
List list = new List();
lottery = EnumHelper.GETEnumTypeByText(lottery);
//ViewBag.type = type.ToUpper();
int value = -1;
try
{
value = (int)Enum.Parse(typeof(EnumZXCid), lottery);
if (value != -1)
{
if (type == 0)
{
list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).Where(d=>d.Name.IndexOf("手机")==-1).Take(4).ToList();
list.AddRange(TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).Take(4).ToList());
}
if (type == 1)
{
list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).Where(d => d.Name.IndexOf("手机") == -1).Take(8).ToList();
}
}
}
catch
{
}
return PartialView("zsTools", list);
}
public PartialViewResult recomkjh(string lottery = "", string type = "kjh")
{
List kjh = new List { "QG_FC3D", "QG_FCSSQ", "QG_TCP3", "QG_TCDLT" };
List sjh = new List { "QG_FC3D", "QG_TCP3", };
List list = new List();
lottery = EnumHelper.GETEnumTypeByText(lottery);
ViewBag.type = type;
if (type == "kjh")
{
if (kjh.Remove(lottery))
{
list = KJApiBLL.GetLotteryAdTJ(kjh);
}
}
if (type == "sjh")
{
list = KJApiBLL.GetLotteryAdTJ(sjh);
}
return PartialView(list);
}
public PartialViewResult recomzs(string code, string type = "sjh")
{
List list = new List();
code = EnumHelper.GETEnumTypeByText(code);
int value = -1;
try
{
value = (int)Enum.Parse(typeof(EnumZXCid), code);
list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图);
}
catch
{
}
List model = new List();
if (type == "kjh")
{
model.Add(list[list.Count - 2]);
model.Add(list[list.Count - 1]);
}
if (type == "sjh")
{
model.Add(list[list.Count-1]);
model.Add(list.FirstOrDefault(d => d.hTitle.Contains("试机")));
}
return PartialView(model);
}
public PartialViewResult recomurl(string code,int type=0) {
List list = new List();
code=EnumHelper.GETEnumTypeByText(code);
ViewBag.type = type;
if (type == 0)
{
list = LotteryFriUrlHandelBLL.GetKjxqFUbyLottery(code);
}
else {
list= LotteryFriUrlHandelBLL.GetplayRuleFUbyLottery(code);
}
return PartialView(list);
}
///
/// 各省福彩体彩链接地址
///
///
///
///
public PartialViewResult FTCLink()
{
List list = TJApiBLL.GetFTCLinksList();
return PartialView(list);
}
}
}