/// <summary> /// 获得购物车列表 /// </summary> public static IList <Hoto.Model.cart_items> GetList(int group_id) { IDictionary <string, int> dic = GetCart(); if (dic != null) { IList <Hoto.Model.cart_items> iList = new List <Hoto.Model.cart_items>(); foreach (var item in dic) { Hoto.BLL.article bll = new Hoto.BLL.article(); Hoto.Model.article_goods model = bll.GetGoodsModel(Convert.ToInt32(item.Key)); if (model == null) { continue; } Hoto.Model.cart_items modelt = new Hoto.Model.cart_items(); modelt.id = model.id; modelt.title = model.title; modelt.img_url = model.img_url; modelt.point = model.point; modelt.price = model.sell_price; modelt.user_price = model.sell_price; modelt.stock_quantity = model.stock_quantity; //会员价格 if (model.goods_group_prices != null) { Hoto.Model.goods_group_price gmodel = model.goods_group_prices.Find(p => p.group_id == group_id); if (gmodel != null) { modelt.user_price = gmodel.price; } } modelt.quantity = item.Value; iList.Add(modelt); } return(iList); } return(null); }
/// <summary> /// 返回对应商品的会员价格 /// </summary> /// <param name="goods_id">商品ID</param> /// <returns>Decimal</returns> protected decimal get_user_goods_price(int goods_id) { Hoto.Model.users userModel = GetUserInfo(); if (userModel == null) { return(-1); } Hoto.Model.article_goods model = new Hoto.BLL.article().GetGoodsModel(goods_id); if (model != null) { if (model.goods_group_prices != null) { Hoto.Model.goods_group_price priceModel = model.goods_group_prices.Find(p => p.group_id == userModel.group_id); if (priceModel != null) { return(priceModel.price); } } return(model.sell_price); } return(-1); }