/// <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(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)); }
/// <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)); }
/// <summary> /// 咨询商品 /// </summary> public ActionResult ConsultProduct() { //不允许游客访问 if (WorkContext.Uid < 1) { return(AjaxResult("nologin", "请先登录")); } //验证验证码 if (CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.ShopConfig.VerifyPages)) { string verifyCode = WebHelper.GetFormString("verifyCode");//验证码 if (string.IsNullOrWhiteSpace(verifyCode)) { return(AjaxResult("emptyverifycode", "验证码不能为空"));; } else if (verifyCode.ToLower() != Sessions.GetValueString(WorkContext.Sid, "verifyCode")) { return(AjaxResult("wrongverifycode", "验证码错误"));; } } int pid = WebHelper.GetFormInt("pid"); int consultTypeId = WebHelper.GetFormInt("consultTypeId"); string consultMessage = WebHelper.GetFormString("consultMessage"); PartProductInfo partProductInfo = Products.GetPartProductById(pid); if (partProductInfo == null) { return(AjaxResult("noproduct", "请选择商品")); } if (consultTypeId < 1 || ProductConsults.GetProductConsultTypeById(consultTypeId) == null) { return(AjaxResult("noproductconsulttype", "请选择咨询类型")); } ; if (string.IsNullOrWhiteSpace(consultMessage)) { return(AjaxResult("noconsultmessage", "请填写咨询内容")); } ; if (consultMessage.Length > 100) { return(AjaxResult("muchconsultmessage", "咨询内容内容太长")); } ; if (!SecureHelper.IsSafeSqlString(consultMessage)) { return(AjaxResult("dangerconsultmessage", "咨询内中包含非法字符")); } ; ProductConsults.ConsultProduct(pid, consultTypeId, WorkContext.Uid, DateTime.Now, WebHelper.HtmlEncode(consultMessage), WorkContext.NickName, partProductInfo.Name, partProductInfo.ShowImg, WorkContext.IP); return(AjaxResult("success", Url.Action("product", new RouteValueDictionary { { "pid", pid } })));; }
public int ReplyProductConsult(ProductConsults Item) { StringBuilder sb = new StringBuilder(); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@ReplyIp", Item.ReplyIp), new SqlParameter("@ReplyMessage", Item.ReplyMessage), new SqlParameter("@ReplyNickName", Item.ReplyNickName), new SqlParameter("@ReplyUid", Item.ReplyUid), new SqlParameter("@ConsultId", Item.ConsultId), new SqlParameter("@State", Item.State), }; sb.Append(" UPDATE dbo.ProductConsults SET ReplyIp=@ReplyIp,ReplyMessage=@ReplyMessage, "); sb.Append(" ReplyNickName=@ReplyNickName,ReplyUid=@ReplyUid,State=@State,ReplyTime=GETDATE() "); sb.Append(" WHERE ConsultId=@ConsultId "); try { return(SQLHelper.ExcuteSQL(sb.ToString(), parms)); } catch (Exception) { return(-1); } }
/// <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)); }
/// <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)); }
public int AddProductConsult(ProductConsults Item) { StringBuilder sb = new StringBuilder(); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@StoreId", Item.StoreId), new SqlParameter("@State", Item.State), new SqlParameter("@PShowImg", Item.PShowImg), new SqlParameter("@PName", Item.PName), new SqlParameter("@Pid", Item.Pid), new SqlParameter("@ConsultUid", Item.ConsultUid), new SqlParameter("@ConsultTypeId", Item.ConsultTypeId), new SqlParameter("@ConsultTime", Item.ConsultTime), new SqlParameter("@ConsultNickName", Item.ConsultNickName), new SqlParameter("@ConsultMessage", Item.ConsultMessage), new SqlParameter("@ConsultIp", Item.ConsultIp), }; sb.Append(" INSERT INTO ProductConsults( Pid ,ConsultTypeId ,State ,ConsultUid ,ReplyUid , "); sb.Append(" StoreId ,ConsultTime ,ReplyTime ,ConsultMessage ,ReplyMessage , "); sb.Append(" ConsultNickName ,ReplyNickName ,PName ,PShowImg ,ConsultIp ,ReplyIp) "); sb.Append(" Values( @Pid ,@ConsultTypeId ,@State ,@ConsultUid ,0 ,"); sb.Append(" @StoreId ,GETDATE() ,GETDATE() ,@ConsultMessage ,'' , "); sb.Append(" @ConsultNickName ,'' ,@PName ,@PShowImg ,@ConsultIp ,'' "); sb.Append(" ) "); sb.Append(" "); try { return(SQLHelper.ExcuteSQL(sb.ToString(), parms)); } catch (Exception) { return(-1); } }
/// <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)); }
public int ReplyProductConsult(ProductConsults Item) { return(_dal.ReplyProductConsult(Item)); }
public int UpdateProductConsult(ProductConsults Item) { return(_dal.UpdateProductConsult(Item)); }
public int AddProductConsult(ProductConsults Item) { return(_dal.AddProductConsult(Item)); }