/// <summary> /// 收藏 /// </summary> /// <returns></returns> public ActionResult UserLike() { var userGuid = CookieOper.Instance.GetUserGuid(); var user = MemCacheHelper2.Instance.Cache.GetModel <User>("UserGuID_" + userGuid); var LikeList = UserLikeFunc.Instance.SelectLikePage(0, 5, user.Id); #region 颜色 List <LikeCommodityResponse> infos = new List <LikeCommodityResponse>(); var ListColor = ColorFunc.Instance.GetAllColorInfo(); foreach (var item in LikeList) { var commResponse = new LikeCommodityResponse(item, ListColor); infos.Add(commResponse); } ViewBag.LikeList = infos; #endregion var num = 5; var count = UserLikeFunc.Instance.SelectLikeCount(user.Id); ViewBag.PageCount = count % num == 0 ? ((int)(count / num)) : ((int)(count / num) + 1); return(View()); }
public ResultJsonModel <List <LikeCommodityResponse>, int> UserLikeByPage(PageRequest request) { ResultJsonModel <List <LikeCommodityResponse>, int> result = new ResultJsonModel <List <LikeCommodityResponse>, int>(); var userGuid = CookieOper.Instance.GetUserGuid(); var user = MemCacheHelper2.Instance.Cache.GetModel <User>("UserGuID_" + userGuid); var listUserLike = UserLikeFunc.Instance.SelectLikePage((request.PageNo - 1) * request.PageSize, request.PageSize, user.Id); var ListColor = ColorFunc.Instance.GetAllColorInfo(); var flag = true; result.Model1 = new List <LikeCommodityResponse>(); foreach (var item in listUserLike) { LikeCommodityResponse response = new LikeCommodityResponse(item, ListColor); if (flag && request.PageNo == 1) { flag = false; } result.Model1.Add(response); } result.HttpCode = 200; result.Message = "查询数据成功!"; return(result); }
/// <summary> /// 收藏1 /// </summary> /// <returns></returns> public ActionResult UserLike() { var userGuid = CookieOper.Instance.GetUserGuid(); var user = MemCacheHelper2.Instance.Cache.GetModel <User>("UserGuID_" + userGuid); //颜色 if (user == null) { return(RedirectToAction("Index", "Login")); } var LikeList = UserLikeFunc.Instance.SelectLikePage(0, 999, user.Id); List <LikeCommodityResponse> infos = new List <LikeCommodityResponse>(); var ListColor = ColorFunc.Instance.GetAllColorInfo(); foreach (var item in LikeList) { var commResponse = new LikeCommodityResponse(item, ListColor); infos.Add(commResponse); } ViewBag.LikeList = infos; ViewBag.PageCount = UserLikeFunc.Instance.SelectLikeCount(user.Id); return(View()); }