SharedController.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. using Common;
  2. using KJH55128_Rec.Business;
  3. using KJH55128_Rec.Business.TJ;
  4. using KJH55128_Rec.Business.TrendChart;
  5. using KJH55128_Rec.Util;
  6. using KJH55128_Rec.ViewModels;
  7. using Models;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Web;
  12. using System.Web.Mvc;
  13. using KJH55128_Rec.Business.KJH;
  14. namespace KJH55128_Rec.Controllers
  15. {
  16. public class SharedController : Controller
  17. {
  18. /// <summary>
  19. /// 工具
  20. /// </summary>
  21. /// <returns></returns>
  22. public PartialViewResult tools()
  23. {
  24. List<IndexToolModel> list = new List<IndexToolModel>();
  25. list.Add(new IndexToolModel("福彩3D工具", "FC3DGJ", TrendChastApiBLL.GetTrendChartChache(1, (int)EnumZXTid.工具)));
  26. list.Add(new IndexToolModel("体彩P3工具", "TCP3GJ", TrendChastApiBLL.GetTrendChartChache(2, (int)EnumZXTid.工具)));
  27. list.Add(new IndexToolModel("体彩P5工具", "TCP5GJ", TrendChastApiBLL.GetTrendChartChache(3, (int)EnumZXTid.工具)));
  28. list.Add(new IndexToolModel("双色球工具", "SSQGJ", TrendChastApiBLL.GetTrendChartChache(4, (int)EnumZXTid.工具)));
  29. //string id = "c31d76a15ee54db08acbf330dba2f234";
  30. //List<Tools_Preview> list = SSApiBLL.QuerySSList(id).Take(3).ToList();
  31. return PartialView(list);
  32. }
  33. /// <summary>
  34. /// 资讯
  35. /// </summary>
  36. /// <returns></returns>
  37. public PartialViewResult news()
  38. {
  39. List<NewsItem> list = new List<NewsItem>();
  40. List<string> ids = new List<string>() {
  41. "08a45dd1830041f493c260942fd937e4",
  42. "23dafcc3ba6c4d67a9e98f20a0b53121",
  43. "fe166abac4ac4baba922a72f450d374c",
  44. "40a9e9c257a74f5f889df3c1238b1c3a" };
  45. for (int i = 0; i < ids.Count; i++)
  46. {
  47. list.AddRange(ZXApiBLL.GetNewsCache()
  48. .Where(d => d.CategoryId == ids[i])
  49. .Take(2)
  50. .Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress }));
  51. }
  52. return PartialView(list);
  53. }
  54. /// <summary>
  55. /// 推荐彩种
  56. /// </summary>
  57. /// <returns></returns>
  58. public PartialViewResult recomlot()
  59. {
  60. List<LotteryItems> list = TJApiBLL.GetRecommandList();
  61. return PartialView(list);
  62. }
  63. /// <summary>
  64. /// 热门彩种
  65. /// </summary>
  66. /// <returns></returns>
  67. public PartialViewResult hotlottery()
  68. {
  69. List<LotteryItems> list = TJApiBLL.GetHotLotteryList();
  70. return PartialView(list);
  71. }
  72. /// <summary>
  73. /// header
  74. /// </summary>
  75. /// <returns></returns>
  76. public PartialViewResult header(string nav = "")
  77. {
  78. ViewBag.nav = nav;
  79. List<ViewLotteryType> data = KJApiBLL.getHeaderNav();
  80. return PartialView(data);
  81. }
  82. /// <summary>
  83. /// footer
  84. /// </summary>
  85. /// <returns></returns>
  86. public PartialViewResult footer()
  87. {
  88. List<FriendLink> list = TJApiBLL.GetFriendLinksList();
  89. return PartialView(list);
  90. }
  91. /// <summary>
  92. /// 广告
  93. /// </summary>
  94. /// <returns></returns>
  95. public PartialViewResult ads()
  96. {
  97. List<AdViewModel> list = TJApiBLL.GetAdLists();
  98. return PartialView(list);
  99. }
  100. /// <summary>
  101. /// 广告
  102. /// </summary>
  103. /// <returns></returns>
  104. [HttpPost]
  105. public ContentResult Getads()
  106. {
  107. List<AdViewModel> list = TJApiBLL.GetAdLists();
  108. return Content(list.TryToJson());
  109. }
  110. /// <summary>
  111. /// 全国彩|全国彩-导航bar
  112. /// </summary>
  113. /// <returns></returns>
  114. public PartialViewResult lotterynav(string type)
  115. {
  116. string id = "", name = "";
  117. ViewLotteryType navdata = new ViewLotteryType();
  118. switch (type)
  119. {
  120. case "QGC":
  121. {
  122. id = "qgc";//全国彩
  123. name = "全国彩";
  124. }
  125. break;
  126. case "DFC":
  127. {
  128. id = "dfc";//全国彩
  129. name = "地方彩";
  130. }
  131. break;
  132. }
  133. var list = KJApiBLL.TypeList();
  134. var data = list.Where(d => d.MenuName == id)
  135. .Select(d => new LotteryItems(d.Name, id, d.TypeCode, d.ZSTypeCode))
  136. .ToList();
  137. navdata.Lotterys = data;
  138. navdata.TypeName = name;
  139. navdata.TypeCode = type;
  140. return PartialView(navdata);
  141. }
  142. /// <summary>
  143. /// 高频彩-导航bar
  144. /// </summary>
  145. /// <returns></returns>
  146. public PartialViewResult gpcnav(string type, string gpcnav)
  147. {
  148. List<ViewLotteryType> navlist = KJApiBLL.getHeaderNav()
  149. .Where(d => d.TypeCode != "QGC" && d.TypeCode != "DFC").ToList();
  150. if (!string.IsNullOrWhiteSpace(gpcnav))
  151. {
  152. ViewBag.gpcnav = ("gpc" + gpcnav).ToUpper();
  153. }
  154. return PartialView(navlist);
  155. }
  156. /// <summary>
  157. /// 玩法规则导航
  158. /// </summary>
  159. /// <returns></returns>
  160. public PartialViewResult wfnav(string type = "QGC", string code = "ssq")
  161. {
  162. List<ViewLotteryType> list = KJApiBLL.getHeaderNav();
  163. if (type != "QGC" && type != "DFC")
  164. {
  165. if (type.IndexOf("GPC") == -1)
  166. {
  167. type = "gpc" + type;
  168. }
  169. }
  170. ViewBag.type = type.ToUpper();
  171. ViewBag.code = code;
  172. return PartialView(list);
  173. }
  174. /// <summary>
  175. /// 推荐专题???
  176. /// </summary>
  177. /// <returns></returns>
  178. public PartialViewResult recomnews(string code, string type = "gqc")
  179. {
  180. string id = null;
  181. List<NewsItem> list = new List<NewsItem>();
  182. if (type == "qgc")
  183. {
  184. switch (code)
  185. {
  186. case "fc3d": id = "08a45dd1830041f493c260942fd937e4"; break;
  187. case "ssq": id = "23dafcc3ba6c4d67a9e98f20a0b53121"; break;
  188. case "pl3": id = "fe166abac4ac4baba922a72f450d374c"; break;
  189. case "dlt": id = "40a9e9c257a74f5f889df3c1238b1c3a"; break;
  190. case "qlc": id = "b28b07513e6548719c33ddd1542e6cd6"; break;
  191. case "qxc": id = "330e5f0e8d894c8d8f770b0ac5ce4d38"; break;
  192. case "pl5": id = "940480808e514922b70b4863e0858354"; break;
  193. }
  194. list = ZXApiBLL.GetNewsCache().Where(d => d.CategoryId == id)
  195. .Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress })
  196. .Take(9)
  197. .ToList();
  198. }
  199. else
  200. {
  201. // "40a9e9c257a74f5f889df3c1238b1c3a"
  202. List<string> ids = new List<string>() {
  203. "08a45dd1830041f493c260942fd937e4",
  204. "23dafcc3ba6c4d67a9e98f20a0b53121",
  205. "fe166abac4ac4baba922a72f450d374c",
  206. };
  207. for (int i = 0; i < ids.Count; i++)
  208. {
  209. list.AddRange(ZXApiBLL.GetNewsCache()
  210. .Where(d => d.CategoryId == ids[i])
  211. .Take(3)
  212. .Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress }));
  213. }
  214. }
  215. return PartialView(list);
  216. }
  217. /// <summary>
  218. /// 根据彩种推荐资讯
  219. /// </summary>
  220. /// <param name="type"></param>
  221. /// <returns></returns>
  222. public PartialViewResult recomzxBytype(string type = "")
  223. {
  224. string id = null;
  225. switch (type)
  226. {
  227. case "sjhfc3d": id = "e29e4cbe01be4799b918dc9c0aeb3926"; ViewBag.title = "3D试后分析预测"; ViewBag.more = "http://zx.55128.cn/3d/3dsjhh_list/53.htm"; break;
  228. case "sjhpl3": id = "fe166abac4ac4baba922a72f450d374c"; ViewBag.title = "排列三分析预测"; ViewBag.more = "http://zx.55128.cn/p3/p3yc_list/23.htm"; break;
  229. case "fc3d": id = "08a45dd1830041f493c260942fd937e4"; ViewBag.title = "福彩3D预测推荐"; ViewBag.more = "http://zx.55128.cn/3d/3dyc_list/15.htm"; break;
  230. case "ssq": id = "23dafcc3ba6c4d67a9e98f20a0b53121"; ViewBag.title = "双色球预测推荐"; ViewBag.more = "http://zx.55128.cn/ssq/ssqyc_list/42.htm"; break;
  231. case "pl3": id = "fe166abac4ac4baba922a72f450d374c"; ViewBag.title = "排列三预测推荐"; ViewBag.more = "http://zx.55128.cn/p3/p3yc_list/23.htm"; break;
  232. case "dlt": id = "40a9e9c257a74f5f889df3c1238b1c3a"; ViewBag.title = "大乐透预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/dlt_list/45.htm"; break;
  233. case "qlc": id = "b28b07513e6548719c33ddd1542e6cd6"; ViewBag.title = "七乐彩预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/qlc_list/47.htm"; break;
  234. case "qxc": id = "330e5f0e8d894c8d8f770b0ac5ce4d38"; ViewBag.title = "七星彩预测推荐"; ViewBag.more = "http://zx.55128.cn/qita/qxc_list/46.htm"; break;
  235. case "pl5": id = "940480808e514922b70b4863e0858354"; ViewBag.title = "排列五预测推荐"; ViewBag.more = "http://zx.55128.cn/p3/p5_list/51.htm"; break;
  236. }
  237. List<NewsItem> list = ZXApiBLL.GetNewsCache().Where(d => d.CategoryId == id)
  238. .Select(d => new NewsItem { NewsId = d.PK.ToString(), AddTime = d.CreateDate.ToString("yyyy-MM-dd"), Title = d.FullHead, Source = d.SourceAddress })
  239. .Take(15)
  240. .ToList();
  241. return PartialView(list);
  242. }
  243. /// <summary>
  244. /// 试机号描述
  245. /// </summary>
  246. /// <param name="type"></param>
  247. /// <returns></returns>
  248. public PartialViewResult sjhDesc(string code = "", int type = 1)
  249. {
  250. lotteryDesc model = new lotteryDesc();
  251. SJiHdescribe sJiHdescribe = new SJiHdescribe();
  252. if (type == 1)
  253. {
  254. if (code == "fc3d")
  255. {
  256. model.Title = "什么是福彩3D试机号";
  257. model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_FC3D.ToString() + "-" + SJHdescribeType.What);
  258. }
  259. else
  260. {
  261. model.Title = "什么是排列三试机号";
  262. model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.What);
  263. }
  264. }
  265. else
  266. {
  267. if (code == "fc3d")
  268. {
  269. model.Title = "3D试机号与开奖号的关系";
  270. model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.Andkjh);
  271. }
  272. else
  273. {
  274. model.Title = "排列三试机号与开奖号关系";
  275. model.Content = sJiHdescribe.GetValueByKey(SCCLottery.QG_TCP3.ToString() + "-" + SJHdescribeType.Andkjh);
  276. }
  277. }
  278. return PartialView(model);
  279. }
  280. /// <summary>
  281. /// 走势图工具推荐
  282. /// </summary>
  283. /// <param name="type"></param>
  284. /// <returns></returns>
  285. public PartialViewResult zsTools(string lottery = "", int type = 0)
  286. {
  287. List<ZXViewModel> list = new List<ZXViewModel>();
  288. lottery = EnumHelper.GETEnumTypeByText<SCCLottery>(lottery);
  289. //ViewBag.type = type.ToUpper();
  290. int value = -1;
  291. try
  292. {
  293. value = (int)Enum.Parse(typeof(EnumZXCid), lottery);
  294. if (value != -1)
  295. {
  296. if (type == 0)
  297. {
  298. list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).Where(d=>d.Name.IndexOf("手机")==-1).Take(4).ToList();
  299. list.AddRange(TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.工具).Take(4).ToList());
  300. }
  301. if (type == 1)
  302. {
  303. list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图).Where(d => d.Name.IndexOf("手机") == -1).Take(8).ToList();
  304. }
  305. }
  306. }
  307. catch
  308. {
  309. }
  310. return PartialView("zsTools", list);
  311. }
  312. public PartialViewResult recomkjh(string lottery = "", string type = "kjh")
  313. {
  314. List<string> kjh = new List<string> { "QG_FC3D", "QG_FCSSQ", "QG_TCP3", "QG_TCDLT" };
  315. List<string> sjh = new List<string> { "QG_FC3D", "QG_TCP3", };
  316. List<LotteryData> list = new List<LotteryData>();
  317. lottery = EnumHelper.GETEnumTypeByText<SCCLottery>(lottery);
  318. ViewBag.type = type;
  319. if (type == "kjh")
  320. {
  321. if (kjh.Remove(lottery))
  322. {
  323. list = KJApiBLL.GetLotteryAdTJ(kjh);
  324. }
  325. }
  326. if (type == "sjh")
  327. {
  328. list = KJApiBLL.GetLotteryAdTJ(sjh);
  329. }
  330. return PartialView(list);
  331. }
  332. public PartialViewResult recomzs(string code, string type = "sjh")
  333. {
  334. List<ZXViewModel> list = new List<ZXViewModel>();
  335. code = EnumHelper.GETEnumTypeByText<SCCLottery>(code);
  336. int value = -1;
  337. try
  338. {
  339. value = (int)Enum.Parse(typeof(EnumZXCid), code);
  340. list = TrendChastApiBLL.GetTrendChartChache(value, (int)EnumZXTid.走势图);
  341. }
  342. catch
  343. {
  344. }
  345. List<ZXViewModel> model = new List<ZXViewModel>();
  346. if (type == "kjh")
  347. {
  348. model.Add(list[list.Count - 2]);
  349. model.Add(list[list.Count - 1]);
  350. }
  351. if (type == "sjh")
  352. {
  353. model.Add(list[list.Count-1]);
  354. model.Add(list.FirstOrDefault(d => d.hTitle.Contains("试机")));
  355. }
  356. return PartialView(model);
  357. }
  358. public PartialViewResult recomurl(string code,int type=0) {
  359. List<UrlEntity> list = new List<UrlEntity>();
  360. code=EnumHelper.GETEnumTypeByText<SCCLottery>(code);
  361. ViewBag.type = type;
  362. if (type == 0)
  363. {
  364. list = LotteryFriUrlHandelBLL.GetKjxqFUbyLottery(code);
  365. }
  366. else {
  367. list= LotteryFriUrlHandelBLL.GetplayRuleFUbyLottery(code);
  368. }
  369. return PartialView(list);
  370. }
  371. /// <summary>
  372. /// 各省福彩体彩链接地址
  373. /// </summary>
  374. /// <param name="code"></param>
  375. /// <param name="type"></param>
  376. /// <returns></returns>
  377. public PartialViewResult FTCLink()
  378. {
  379. List<FriendLink> list = TJApiBLL.GetFTCLinksList();
  380. return PartialView(list);
  381. }
  382. }
  383. }