public JsonResult GoodsDetails(string entId, string userId, string articleId) { try { if (string.IsNullOrEmpty(entId)) { entId = BaseConfiguration.EntId; } if (string.IsNullOrEmpty(articleId)) { return(Json(new { success = false, message = "参数获取失败!" })); } ///商品信息 GoodsInfoDal dal = new GoodsInfoDal(); ///商品当月销量排行 List <GoodsStatistical> slist = dal.GetGoodsRanking(userId, entId, "GoodsSale", 10); ///商品当月点击量量排行 List <GoodsStatistical> clist = dal.GetGoodsRanking(userId, entId, "GoodsClick", 3); ///商品详情 List <GoodsList> list = dal.GetGoodDetail(userId, articleId, entId); return(Json(new { success = true, list, slist, clist })); } catch (Exception ex) { LogQueue.Write(LogType.Error, "Goods/GoodsDetails", ex.Message.ToString()); return(Json(new { success = false, message = "商品详情加载失败!" })); } }
/// <summary> /// 同类商品推荐 /// </summary> /// <param name="entId">企业</param> /// <param name="userId">用户</param> /// <param name="articleId">商品ID</param> /// <param name="num">条目数</param> /// <returns></returns> public ActionResult Commendation(string entId, string userId, string articleId, int num) { try { if (string.IsNullOrEmpty(entId)) { entId = BaseConfiguration.EntId; } if (string.IsNullOrEmpty(articleId)) { return(Json(new { success = false, message = "参数异常" })); } ///获取用户信息 UserInfoDal dal = new UserInfoDal(); List <UserInfo> user = new List <UserInfo>(); if (!string.IsNullOrEmpty(userId)) { user = dal.GetUserInfo(userId, entId); } string jgjb = "", clientlimit = "", KhType = ""; bool landing = false; bool staleDated = false; //获取客户价格级别 if (user.Count > 0) { entId = user[0].EntId; jgjb = user[0].Pricelevel; clientlimit = user[0].ClientLimit; KhType = user[0].KhType; staleDated = user[0].StaleDated; landing = true; } GoodsInfoDal infoDal = new GoodsInfoDal(); ///商品详情 List <GoodsList> list = infoDal.GetGoodDetail(userId, articleId, entId); var category = list[0].GoodsInfo[0].Category; //同类商品推荐 List <Models.GoodsInfo> klist = infoDal.Commendation(entId, category, num, jgjb, KhType, landing, staleDated); return(Json(new { success = true, message = "商品推荐获取成功", klist })); } catch (Exception ex) { LogQueue.Write(LogType.Error, "Goods/Commendation", ex.Message.ToString()); return(Json(new { success = false, message = "商品推荐加载失败!" })); } }