/// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView(Url.Action("index", "home"), "你访问的商品不存在"));
            }

            if (!SecureHelper.IsSafeSqlString(consultMessage))
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的内容不存在"));
            }

            PageModel pageModel           = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo            = productInfo,
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.ShopConfig.VerifyPages)
            };

            return(View(model));
        }
Exemple #2
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult AjaxProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            if (!SecureHelper.IsSafeSqlString(consultMessage))
            {
                return(View(new AjaxProductConsultListModel()));
            }

            PageModel pageModel = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            AjaxProductConsultListModel model = new AjaxProductConsultListModel()
            {
                Pid                    = pid,
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages)
            };

            return(View(model));
        }
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            PageModel pageModel           = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo            = productInfo,
                CategoryInfo           = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo              = Brands.GetBrandById(productInfo.BrandId),
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.ShopConfig.VerifyPages)
            };

            return(View(model));
        }
Exemple #4
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            if (!SecureHelper.IsSafeSqlString(consultMessage))
            {
                return(PromptView(WorkContext.UrlReferrer, "您搜索的内容不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            PageModel pageModel           = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo            = productInfo,
                CategoryInfo           = Categories.GetCategoryById(productInfo.CateId),
                BrandInfo              = Brands.GetBrandById(productInfo.BrandId),
                StoreInfo              = storeInfo,
                StoreKeeperInfo        = Stores.GetStoreKeeperById(storeInfo.StoreId),
                StoreRegion            = Regions.GetRegionById(storeInfo.RegionId),
                StoreRankInfo          = StoreRanks.GetStoreRankById(storeInfo.StoreRid),
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages)
            };

            return(View(model));
        }
Exemple #5
0
        /// <summary>
        /// 商品咨询列表
        /// </summary>
        public ActionResult ProductConsultList()
        {
            int    pid            = WebHelper.GetQueryInt("pid");
            int    consultTypeId  = WebHelper.GetQueryInt("consultTypeId");
            string consultMessage = WebHelper.GetQueryString("consultMessage");
            int    page           = WebHelper.GetQueryInt("page");

            //判断商品是否存在
            PartProductInfo productInfo = Products.GetPartProductById(pid);

            if (productInfo == null)
            {
                return(PromptView(Url.Action("index", "home"), "你访问的商品不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView(Url.Action("index", "home"), "你访问的商品不存在"));
            }

            PageModel pageModel           = new PageModel(10, page, ProductConsults.GetProductConsultCount(pid, consultTypeId, consultMessage));
            ProductConsultListModel model = new ProductConsultListModel()
            {
                ProductInfo            = productInfo,
                StoreInfo              = storeInfo,
                ConsultTypeId          = consultTypeId,
                ConsultMessage         = consultMessage,
                PageModel              = pageModel,
                ProductConsultList     = ProductConsults.GetProductConsultList(pageModel.PageSize, pageModel.PageNumber, pid, consultTypeId, consultMessage),
                ProductConsultTypeList = ProductConsults.GetProductConsultTypeList(),
                IsVerifyCode           = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages)
            };

            return(View(model));
        }
Exemple #6
0
        /// <summary>
        /// 商品
        /// </summary>
        public ActionResult Product()
        {
            //商品id
            int pid = GetRouteInt("pid");

            if (pid == 0)
            {
                pid = WebHelper.GetQueryInt("pid");
            }

            //判断商品是否存在
            ProductInfo productInfo = Products.GetProductById(pid);

            if (productInfo == null)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            //店铺信息
            StoreInfo storeInfo = Stores.GetStoreById(productInfo.StoreId);

            if (storeInfo.State != (int)StoreState.Open)
            {
                return(PromptView("/", "你访问的商品不存在"));
            }

            //商品存在时
            ProductModel model = new ProductModel();

            //商品id
            model.Pid = pid;
            //商品信息
            model.ProductInfo = productInfo;
            //商品分类
            model.CategoryInfo = Categories.GetCategoryById(productInfo.CateId);
            //商品品牌
            model.BrandInfo = Brands.GetBrandById(productInfo.BrandId);
            //店铺信息
            model.StoreInfo = storeInfo;
            //店长信息
            model.StoreKeeperInfo = Stores.GetStoreKeeperById(storeInfo.StoreId);
            //店铺区域
            model.StoreRegion = Regions.GetRegionById(storeInfo.RegionId);
            //店铺等级信息
            model.StoreRankInfo = StoreRanks.GetStoreRankById(storeInfo.StoreRid);
            //商品图片列表
            model.ProductImageList = Products.GetProductImageList(pid);
            //扩展商品属性列表
            model.ExtProductAttributeList = Products.GetExtProductAttributeList(pid);
            //商品SKU列表
            model.ProductSKUList = Products.GetProductSKUListBySKUGid(productInfo.SKUGid);
            //商品库存数量
            model.StockNumber = Products.GetProductStockNumberByPid(pid);


            //单品促销
            model.SinglePromotionInfo = Promotions.GetSinglePromotionByPidAndTime(pid, DateTime.Now);
            //买送促销活动列表
            model.BuySendPromotionList = Promotions.GetBuySendPromotionList(productInfo.StoreId, pid, DateTime.Now);
            //赠品促销活动
            model.GiftPromotionInfo = Promotions.GetGiftPromotionByPidAndTime(pid, DateTime.Now);
            //赠品列表
            if (model.GiftPromotionInfo != null)
            {
                model.ExtGiftList = Promotions.GetExtGiftList(model.GiftPromotionInfo.PmId);
            }
            //套装商品列表
            model.SuitProductList = Promotions.GetProductAllSuitPromotion(pid, DateTime.Now);
            //满赠促销活动
            model.FullSendPromotionInfo = Promotions.GetFullSendPromotionByStoreIdAndPidAndTime(productInfo.StoreId, pid, DateTime.Now);
            //满减促销活动
            model.FullCutPromotionInfo = Promotions.GetFullCutPromotionByStoreIdAndPidAndTime(productInfo.StoreId, pid, DateTime.Now);

            //广告语
            model.Slogan = model.SinglePromotionInfo == null ? "" : model.SinglePromotionInfo.Slogan;
            //商品促销信息
            model.PromotionMsg = Promotions.GeneratePromotionMsg(model.SinglePromotionInfo, model.BuySendPromotionList, model.FullSendPromotionInfo, model.FullCutPromotionInfo);
            //商品折扣价格
            model.DiscountPrice = Promotions.ComputeDiscountPrice(model.ProductInfo.ShopPrice, model.SinglePromotionInfo);

            //关联商品列表
            model.RelateProductList = Products.GetRelateProductList(pid);

            //用户浏览历史
            model.UserBrowseHistory = BrowseHistories.GetUserBrowseHistory(WorkContext.Uid, pid);

            //商品咨询类型列表
            model.ProductConsultTypeList = ProductConsults.GetProductConsultTypeList();

            //更新浏览历史
            if (WorkContext.Uid > 0)
            {
                Asyn.UpdateBrowseHistory(WorkContext.Uid, pid);
            }
            //更新商品统计
            Asyn.UpdateProductStat(pid, WorkContext.RegionId);

            return(View(model));
        }