예제 #1
0
        /// <summary>
        /// 获得满赠赠品
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFullSend()
        {
            //当商城不允许游客使用购物车时
            if (WorkContext.ShopConfig.IsGuestSC == 0 && WorkContext.Uid < 1)
            {
                return(AjaxResult("nologin", "请先登录"));
            }

            int pmId = WebHelper.GetQueryInt("pmId");//满赠id
            //获得满赠赠品列表
            List <PartProductInfo> fullSendPresentList = Promotions.GetFullSendPresentList(pmId);

            StringBuilder sb = new StringBuilder();

            sb.Append("[");
            foreach (PartProductInfo partProductInfo in fullSendPresentList)
            {
                sb.AppendFormat("{0}\"pid\":\"{1}\",\"name\":\"{2}\",\"shopPrice\":\"{3}\",\"showImg\":\"{4}\",\"url\":\"{5}\"{6},", "{", partProductInfo.Pid, partProductInfo.Name, partProductInfo.ShopPrice, partProductInfo.ShowImg, Url.Action("product", "catalog", new RouteValueDictionary {
                    { "pid", partProductInfo.Pid }
                }), "}");
            }
            if (fullSendPresentList.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]");

            return(AjaxResult("success", sb.ToString(), true));
        }