/// <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 = "商品推荐加载失败!" })); } }