TKController.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using M55128_rec.Business.TK;
  2. using M55128_rec.Models.ViewModels.GallerMangerModel;
  3. using M55128_rec.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace M55128_rec.Controllers
  10. {
  11. [RoutePrefix("tk")]
  12. public class TKController : Controller
  13. {
  14. // GET: TK
  15. /// <summary>
  16. /// 图库首页
  17. /// </summary>
  18. /// <returns></returns>
  19. [Route("index.html")]
  20. public ActionResult Index()
  21. {
  22. int countrow = 0, countpage = 0;
  23. Dictionary<string, Object> dict = new Dictionary<string, object>();
  24. dict["AreaCode"] = "A";
  25. List<QueryAllDataModel> tkarea = TKApiBLL.QueryAll(1, 30, dict, out countrow, out countpage, 0);
  26. int qs = DateHelper.getTimeSpan();
  27. string q = DateTime.Now.Year + qs.ToString().PadLeft(3, '0');
  28. ViewBag.totalp = countpage;
  29. return View(Tuple.Create(tkarea, q));
  30. }
  31. /// <summary>
  32. /// 详情
  33. /// </summary>
  34. /// <param name="id"></param>
  35. /// <param name="p"></param>
  36. /// <param name="name"></param>
  37. /// <returns></returns>
  38. [Route("{param}.html")]
  39. public ActionResult TKXQ(string param)
  40. {
  41. string q = param.Split('_')[0];
  42. string id = param.Split('_')[1].Substring(1);
  43. string qs =null;
  44. if (q != "0" && !string.IsNullOrWhiteSpace(q))
  45. {
  46. qs = q.Substring(4, 3);
  47. }
  48. ImageInfoModel model = TKApiBLL.QueryArtInfo(null, qs,id);
  49. var tk = TKApiBLL.GetBykey(model.galleryId);
  50. ViewBag.name = tk.GalleryName;
  51. ViewBag.mark = tk.Reamrk;
  52. ViewBag.qs = q;
  53. ViewBag.code=param.Split('_')[1].Substring(0,1);
  54. return View(model);
  55. }
  56. /// <summary>
  57. /// 图库全部
  58. /// </summary>
  59. /// <param name="t">1:带a b c;2:返回list数据</param>
  60. /// <param name="p"></param>
  61. /// <param name="r"></param>
  62. /// <param name="a"></param>
  63. /// <param name="q"></param>
  64. /// <returns>/TK/GetTKQB</returns>
  65. public ActionResult GetTKQB(string t = "1", int p = 1, int r = 50, string a = "A", string q = "")
  66. {
  67. ViewBag.qs = q;
  68. int qs = 0;
  69. if (q != "0" && !string.IsNullOrWhiteSpace(q))
  70. {
  71. qs = int.Parse(q.Substring(4, 3));
  72. }
  73. int countrow = 0, countpage = 0;
  74. Dictionary<string, Object> dict = new Dictionary<string, object>();
  75. dict["AreaCode"] = a;
  76. List<QueryAllDataModel> tkarea = TKApiBLL.QueryAll(p, r, dict, out countrow, out countpage, qs);
  77. ViewBag.p = p;
  78. ViewBag.totalp = countpage;
  79. return PartialView("TKQB", Tuple.Create(tkarea, t));
  80. }
  81. /// <summary>
  82. /// 图库热门
  83. /// </summary>
  84. /// <param name="type">1:带热门;2:返回list数据</param>
  85. /// <param name="page"></param>
  86. /// <param name="rows"></param>
  87. /// <param name="n"></param>
  88. /// <param name="periodsNumber"></param>
  89. public ActionResult GetTKRM(string t = "1", int p = 1, int r = 50, string n = "彩吧图谜", string q = "0")
  90. {
  91. ViewBag.qs = q;
  92. int qs = 0;
  93. if (q != "0" && !string.IsNullOrWhiteSpace(q))
  94. {
  95. qs = int.Parse(q.Substring(4, 3));
  96. }
  97. int countrow = 0, countpage = 0;
  98. List<HotMenuModel> tkhotmenu = new List<HotMenuModel>();
  99. if (t == "1")
  100. {
  101. tkhotmenu = TKApiBLL.QueryHotMenu(new List<string>() { "A", "B", "C" });
  102. }
  103. List<ImageMenuInfoModel> tkhlist = TKApiBLL.QueryHotArtList(p, r, n, out countrow, out countpage, qs);
  104. ViewBag.p = p;
  105. ViewBag.totalp = countpage;
  106. return PartialView("TKRM", Tuple.Create(tkhotmenu, tkhlist, t));
  107. }
  108. /// <summary>
  109. /// 图库最新
  110. /// </summary>
  111. /// <param name="t">1:第一次 2:下拉加载</param>
  112. /// <param name="p"></param>
  113. /// <param name="r"></param>
  114. /// <param name="q"></param>
  115. /// <returns></returns>
  116. public ActionResult GetTKZX(string t = "1", int p = 1, int r = 50, string q = "0")
  117. {
  118. int countrow = 0, countpage = 0;
  119. ViewBag.t = t;
  120. ViewBag.qs = q;
  121. int qs = 0;
  122. if (q != "0" && !string.IsNullOrWhiteSpace(q))
  123. {
  124. qs = int.Parse(q.Substring(4, 3));
  125. }
  126. ViewBag.t = t;
  127. List<ImageMenuInfoModel> tkzx = TKApiBLL.QueryNew(p, r, out countrow, out countpage, qs);
  128. ViewBag.p = p;
  129. ViewBag.totalp = countpage;
  130. return PartialView("TKZX", tkzx);
  131. }
  132. /// <summary>
  133. /// 图库历史
  134. /// </summary>
  135. /// <returns></returns>
  136. public ActionResult GetTKLS()
  137. {
  138. List<GalleryNumberList> tkls = TKApiBLL.GetTkPeriodsNumberList();
  139. return PartialView("TKLS", tkls);
  140. }
  141. public ActionResult Getqs(string y)
  142. {
  143. string qs = TKApiBLL.GetMaxInYear(y);
  144. return Json(qs, JsonRequestBehavior.AllowGet);
  145. }
  146. }
  147. }