using M55128_rec.Business.TK; using M55128_rec.Models.ViewModels.GallerMangerModel; using M55128_rec.Util; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace M55128_rec.Controllers { [RoutePrefix("tk")] public class TKController : Controller { // GET: TK /// /// 图库首页 /// /// [Route("index.html")] public ActionResult Index() { int countrow = 0, countpage = 0; Dictionary dict = new Dictionary(); dict["AreaCode"] = "A"; List tkarea = TKApiBLL.QueryAll(1, 30, dict, out countrow, out countpage, 0); int qs = DateHelper.getTimeSpan(); string q = DateTime.Now.Year + qs.ToString().PadLeft(3, '0'); ViewBag.totalp = countpage; return View(Tuple.Create(tkarea, q)); } /// /// 详情 /// /// /// /// /// [Route("{param}.html")] public ActionResult TKXQ(string param) { string q = param.Split('_')[0]; string id = param.Split('_')[1].Substring(1); string qs =null; if (q != "0" && !string.IsNullOrWhiteSpace(q)) { qs = q.Substring(4, 3); } ImageInfoModel model = TKApiBLL.QueryArtInfo(null, qs,id); var tk = TKApiBLL.GetBykey(model.galleryId); ViewBag.name = tk.GalleryName; ViewBag.mark = tk.Reamrk; ViewBag.qs = q; ViewBag.code=param.Split('_')[1].Substring(0,1); return View(model); } /// /// 图库全部 /// /// 1:带a b c;2:返回list数据 /// /// /// /// /// /TK/GetTKQB public ActionResult GetTKQB(string t = "1", int p = 1, int r = 50, string a = "A", string q = "") { ViewBag.qs = q; int qs = 0; if (q != "0" && !string.IsNullOrWhiteSpace(q)) { qs = int.Parse(q.Substring(4, 3)); } int countrow = 0, countpage = 0; Dictionary dict = new Dictionary(); dict["AreaCode"] = a; List tkarea = TKApiBLL.QueryAll(p, r, dict, out countrow, out countpage, qs); ViewBag.p = p; ViewBag.totalp = countpage; return PartialView("TKQB", Tuple.Create(tkarea, t)); } /// /// 图库热门 /// /// 1:带热门;2:返回list数据 /// /// /// /// public ActionResult GetTKRM(string t = "1", int p = 1, int r = 50, string n = "彩吧图谜", string q = "0") { ViewBag.qs = q; int qs = 0; if (q != "0" && !string.IsNullOrWhiteSpace(q)) { qs = int.Parse(q.Substring(4, 3)); } int countrow = 0, countpage = 0; List tkhotmenu = new List(); if (t == "1") { tkhotmenu = TKApiBLL.QueryHotMenu(new List() { "A", "B", "C" }); } List tkhlist = TKApiBLL.QueryHotArtList(p, r, n, out countrow, out countpage, qs); ViewBag.p = p; ViewBag.totalp = countpage; return PartialView("TKRM", Tuple.Create(tkhotmenu, tkhlist, t)); } /// /// 图库最新 /// /// 1:第一次 2:下拉加载 /// /// /// /// public ActionResult GetTKZX(string t = "1", int p = 1, int r = 50, string q = "0") { int countrow = 0, countpage = 0; ViewBag.t = t; ViewBag.qs = q; int qs = 0; if (q != "0" && !string.IsNullOrWhiteSpace(q)) { qs = int.Parse(q.Substring(4, 3)); } ViewBag.t = t; List tkzx = TKApiBLL.QueryNew(p, r, out countrow, out countpage, qs); ViewBag.p = p; ViewBag.totalp = countpage; return PartialView("TKZX", tkzx); } /// /// 图库历史 /// /// public ActionResult GetTKLS() { List tkls = TKApiBLL.GetTkPeriodsNumberList(); return PartialView("TKLS", tkls); } public ActionResult Getqs(string y) { string qs = TKApiBLL.GetMaxInYear(y); return Json(qs, JsonRequestBehavior.AllowGet); } } }