Ejemplo n.º 1
0
        /// <summary>
        /// 拼团活动详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GroupBuyDetail()
        {
            int          id     = RequestHelper.GetForm <int>("id");
            GroupBuyInfo entity = GroupBuyBLL.Read(id);

            if (entity.Id <= 0)
            {
                return(Json(new { ok = false, msg = "拼团商品不存在" }));
            }
            var product = ProductBLL.Read(entity.ProductId);

            if (product.Id <= 0)
            {
                return(Json(new { ok = false, msg = "拼团商品不存在" }));
            }
            if (product.OpenGroup != 1)
            {
                return(Json(new { ok = false, msg = "此商品暂不支持拼团" }));
            }
            //拼团状态
            entity.VirtualStatus = (entity.EndTime <DateTime.Now && entity.Quantity> entity.SignCount) ? -1 : (entity.StartTime <= DateTime.Now && entity.EndTime >= DateTime.Now && entity.Quantity > entity.SignCount) ? 0 : (entity.StartTime <= DateTime.Now && entity.EndTime >= DateTime.Now && entity.Quantity <= entity.SignCount) ? 1 : -1;
            //除团长以外其他参与者
            List <GroupSignInfo> signList = GroupSignBLL.ReadListByGroupId(id).Where(k => k.UserId != entity.Leader).ToList();

            #region 推荐商品
            int userGrade = UserGradeBLL.ReadByMoney(0).Id;
            int uid       = RequestHelper.GetForm <int>("uid");
            var user      = UserBLL.ReadUserMore(uid);
            if (user != null && user.Id > 0)
            {
                userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
            }
            int hotCount     = 0;
            var prorecommend = ProductBLL.SearchList(1, 4, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            var prorelist = new List <ProductVirtualModel>();
            foreach (var item in prorecommend)
            {
                var vp = new ProductVirtualModel()
                {
                    id         = item.Id,
                    name       = item.Name,
                    img        = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                    imgbig     = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                    imgorg     = ShopCommon.ShowImage(item.Photo),
                    price      = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                    click      = item.ViewCount,
                    like       = item.LikeNum,
                    totalstore = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount,
                    //ordercount = item.OrderCount
                    //是否启用不限库存,分别计算销量
                    ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount
                };
                prorelist.Add(vp);
            }
            #endregion
            return(Json(new { ok = true, entity = entity, product = product, signlist = signList, topproductlist = prorelist }));
        }
Ejemplo n.º 2
0
 public UserController()
 {
     uid = RequestHelper.GetForm <int>("uid");
     if (uid <= 0)
     {
         uid = RequestHelper.GetQueryString <int>("uid");
     }
     user = UserBLL.ReadUserMore(uid);
     if (user != null && user.Id > 0)
     {
         userGradeInfo = UserGradeBLL.ReadByMoney(user.MoneyUsed);
         userGrade     = userGradeInfo.Id;
     }
 }
Ejemplo n.º 3
0
 public UserController()
 {
     uid = RequestHelper.GetForm <int>("uid");
     if (uid <= 0)
     {
         uid = RequestHelper.GetQueryString <int>("uid");
     }
     user = UserBLL.ReadUserMore(uid);
     if (user != null && user.Id > 0)
     {
         userGradeInfo = UserGradeBLL.ReadByMoney(user.MoneyUsed);
         userGrade     = userGradeInfo.Id;
     }
     user.UserName = System.Web.HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8);
     //分销商等级标题
     user.Distributor_Grade_Title = (DistributorGradeBLL.ReadList().FirstOrDefault(d => user.Total_Commission >= d.Min_Amount && user.Total_Commission < d.Max_Amount) ?? new DistributorGradeInfo()).Title;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 检查cookies
        /// </summary>
        /// <returns></returns>
        private void ReadUserCookies()
        {
            string cookiesName = ShopConfig.ReadConfigInfo().UserCookies;

            if (CookiesHelper.ReadCookie(cookiesName) != null)
            {
                string cookiesValue = CookiesHelper.ReadCookieValue(cookiesName);
                if (!string.IsNullOrEmpty(cookiesValue))
                {
                    try
                    {
                        string[] strArray = cookiesValue.Split(new char[] { '|' });
                        string   sign     = strArray[0];
                        string   userID   = strArray[1];
                        string   userName = strArray[2];
                        string   gradeID  = strArray[3];
                        if (FormsAuthentication.HashPasswordForStoringInConfigFile(userID + userName + gradeID.ToString() + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == sign.ToLower())
                        {
                            UserId   = Convert.ToInt32(userID);
                            UserName = HttpContext.Current.Server.UrlDecode(userName);
                            GradeID  = Convert.ToInt32(gradeID);
                        }
                        else
                        {
                            CookiesHelper.DeleteCookie(cookiesName);
                        }
                    }
                    catch
                    {
                        CookiesHelper.DeleteCookie(cookiesName);
                    }
                }
            }
            if (GradeID == 0)
            {
                GradeID = UserGradeBLL.ReadByMoney(0).Id;
            }
            UserGrade = UserGradeBLL.Read(GradeID).Name;
            UserGrade = string.IsNullOrEmpty(UserGrade) ? "游客" : UserGrade;
        }
Ejemplo n.º 5
0
        public ActionResult GetProductPriceAndStore()
        {
            int userGrade = UserGradeBLL.ReadByMoney(0).Id;
            int uid       = RequestHelper.GetForm <int>("uid");
            var user      = UserBLL.ReadUserMore(uid);

            if (user != null && user.Id > 0)
            {
                userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
            }

            int    id        = RequestHelper.GetForm <int>("productID");
            string valueList = StringHelper.AddSafe(RequestHelper.GetForm <string>("valueList"));
            var    product   = ProductBLL.Read(id);
            List <ProductTypeStandardRecordInfo> standRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(id, product.StandardType);

            foreach (var item in standRecordList)
            {
                if (item.ValueList.Trim() == valueList.Trim())
                {
                    return(Json(new
                    {
                        price = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                        markprice = ProductBLL.GetCurrentPrice(item.MarketPrice, userGrade),
                        groupprice = item.GroupPrice,
                        totalstorage = item.Storage,
                        //leftstore = (item.Storage - item.OrderCount),
                        ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now, item.ValueList.Trim()) : item.OrderCount,
                        //是否启用不限库存,分别计算销量
                        leftstore = (item.Storage - (product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now, item.ValueList.Trim()) : item.OrderCount)),
                        img = item.Photo,
                        unlimitedstorage = product.UnlimitedStorage
                    }));
                }
            }

            return(Content("no"));
        }
Ejemplo n.º 6
0
        public ActionResult Product(int page = 1, int pagesize = 10, int classid = 0)
        {
            int      userGrade = UserGradeBLL.ReadByMoney(0).Id;
            UserInfo user      = new UserInfo();
            int      uid       = RequestHelper.GetForm <int>("uid");

            if (uid > 0)
            {
                user = UserBLL.ReadUserMore(uid);
                if (user.Id > 0)
                {
                    userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
                }
            }


            var productlist = new List <ProductInfo>();
            int count       = 0;
            var catelist    = ProductClassBLL.ReadRootList();
            //if (catelist.Count > 0)
            //{
            //    if (classid == 0) classid = catelist[0].Id;
            //}

            var prosearch = new ProductSearchInfo()
            {
                IsSale   = 1,
                IsDelete = 0
            };
            string searchkey = RequestHelper.GetForm <string>("searchkey");

            if (!string.IsNullOrEmpty(searchkey))
            {
                prosearch.Name = searchkey;
            }
            if (classid > 0)
            {
                prosearch.ClassId = "|" + classid + "|";
            }

            int    sort   = RequestHelper.GetForm <int>("sort");
            string sortby = "[OrderId],[Id]";

            switch (sort)
            {
            case 1:
                sortby = "OrderCount";
                break;

            case 2:
                sortby = "SalePriceUp";
                break;

            case 3:
                sortby = "SalePriceDown";
                break;
            }
            prosearch.ProductOrderType = sortby;
            prosearch.OrderType        = OrderType.Desc;

            productlist = ProductBLL.SearchList(page, pagesize, prosearch, ref count);


            //List<ProductVirtualModel> tempvp = new List<ProductVirtualModel>();
            //foreach (var item in productlist)
            //{
            //    double percent = 0;
            //    var pcomment = ProductCommentBLL.SearchProductCommentList(new ProductCommentSearchInfo() { ProductId = item.Id, Status = (int)CommentStatus.Show });
            //    if (pcomment.Count() > 0)
            //    {
            //        percent = pcomment.Where(e => e.Rank > 3).Count() * 1.00 / pcomment.Count() * 100;
            //    }

            //    var vp = new
            //    {
            //        id = item.Id,
            //        name = item.Name,
            //        img = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
            //        imgbig = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
            //        imgorg = ShopCommon.ShowImage(item.Photo),
            //        price = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
            //        click = item.ViewCount,
            //        like = item.LikeNum,
            //        totalstore = item.TotalStorageCount,
            //        ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount,
            //        virtualordercount = item.VirtualOrderCount,
            //        usevirtualorder = item.UseVirtualOrder,
            //        commentcount = pcomment.Count,
            //        goodcompercent = Math.Round(percent, 2)
            //    };
            //    tempvp.Add(vp);
            //}

            var dataList = productlist.Select(item => new
            {
                id                = item.Id,
                name              = item.Name,
                img               = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                imgbig            = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                imgorg            = ShopCommon.ShowImage(item.Photo),
                price             = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                click             = item.ViewCount,
                like              = item.LikeNum,
                totalstore        = item.TotalStorageCount,
                ordercount        = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount,
                virtualordercount = item.VirtualOrderCount,
                usevirtualorder   = item.UseVirtualOrder,
                //commentcount = pcomment.Count,
                //goodcompercent = Math.Round(percent, 2)
            });

            return(Json(new { products = dataList }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public ActionResult Detail(int id)
        {
            int userGrade = UserGradeBLL.ReadByMoney(0).Id;
            int uid       = RequestHelper.GetForm <int>("uid");
            var user      = UserBLL.ReadUserMore(uid);

            if (user.Id > 0)
            {
                userGrade     = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
                user.UserName = HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8);
            }

            if (id <= 0)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            string      fromwhere = RequestHelper.GetQueryString <string>("fw");
            ProductInfo product   = ProductBLL.Read(id);

            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            #region 如果商品没有小程序码 则生成并保存
            if (string.IsNullOrWhiteSpace(product.Qrcode))
            {
                string product_miniProramCode = string.Empty;
                CreateMiniProgramCode(product.Id, ref product_miniProramCode, product.Qrcode);
                if (!string.IsNullOrWhiteSpace(product_miniProramCode))
                {//如果调用接口成功生成小程序码(因为只有发布后才能使用此微信接口)
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    dict.Add("[Qrcode]", product_miniProramCode);
                    ProductBLL.UpdatePart("[Product]", dict, product.Id);
                    product.Qrcode = product_miniProramCode;
                }
            }
            #endregion
            //更新查看数量
            if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null)
            {
                ProductBLL.ChangeViewCount(id, 1);
                CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString());
            }
            ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo();
            var proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo {
                ProductId = product.Id, Status = (int)CommentStatus.Show
            });
            var procomlist = new List <VirtualProductCommend>();
            foreach (var item in proComm)
            {
                VirtualProductCommend vpc = new VirtualProductCommend()
                {
                    id         = item.Id,
                    name       = HttpUtility.UrlDecode(item.UserName, Encoding.UTF8),
                    avator     = ShopCommon.ShowImage(UserBLL.Read(item.UserId).Photo),
                    lv         = item.Rank,
                    date       = item.PostDate,
                    content    = item.Content,
                    imglist    = ProductPhotoBLL.ReadList(item.Id, 3),
                    adminreply = item.AdminReplyContent,
                    replydate  = item.AdminReplyDate
                };
                procomlist.Add(vpc);
            }

            //产品价格
            int hotCount           = 0;
            var currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, userGrade);
            var prorecommend       = ProductBLL.SearchList(1, 8, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            var prorelist = new List <ProductVirtualModel>();
            foreach (var item in prorecommend)
            {
                var vp = new ProductVirtualModel()
                {
                    id          = item.Id,
                    name        = item.Name,
                    img         = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                    imgbig      = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                    imgorg      = ShopCommon.ShowImage(item.Photo),
                    price       = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                    marketprice = item.MarketPrice,
                    click       = item.ViewCount,
                    like        = item.LikeNum,
                    totalstore  = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount,
                    //ordercount = item.OrderCount
                    //是否启用不限库存,分别计算销量
                    ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount
                };
                prorelist.Add(vp);
            }
            //产品图片
            List <ProductPhotoInfo> productPhotoList = new List <ProductPhotoInfo>();
            ProductPhotoInfo        productPhoto     = new ProductPhotoInfo();
            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            productPhotoList.ForEach(k => k.ImageUrl = k.ImageUrl.Replace("75-75", "Original"));
            //属性
            var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id);

            #region 产品规格
            List <ProductTypeStandardInfo> standardList = new List <ProductTypeStandardInfo>();
            string  standardRecordValueList             = "|";
            var     standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            decimal maxPrice           = product.SalePrice;
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            if (standardRecord.MarketPrice > maxPrice)
                            {
                                maxPrice = standardRecord.MarketPrice;
                            }
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            #endregion
            #region 正在开的团(进行中,排除本人开的团)
            GroupBuySearchInfo gpsearch = new GroupBuySearchInfo
            {
                ProductId = product.Id,
                //NotLeader = user.Id,
                Status = (int)GroupBuyStatus.Going
            };
            List <GroupBuyInfo> gpList = GroupBuyBLL.SearchList(gpsearch);
            gpList.ForEach(k => k.groupSignList = GroupSignBLL.ReadListByGroupId(k.Id));
            gpList.ForEach(k => k.GroupUserName = System.Web.HttpUtility.UrlDecode(k.GroupUserName, Encoding.UTF8));
            #endregion
            return(Json(new
            {
                ok = true,
                product = new
                {
                    id = product.Id,
                    img = ShopCommon.ShowImage(product.Photo.Replace("Original", "350-350")),
                    imgorg = ShopCommon.ShowImage(product.Photo),
                    title = product.Name,
                    summary = product.Summary,
                    price = currentMemberPrice,
                    marketprice = product.MarketPrice,
                    intro = string.IsNullOrEmpty(product.Introduction1_Mobile) ? product.Introduction1 : product.Introduction1_Mobile,
                    remark = product.Remark,
                    totalstore = product.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(product.Id) : product.TotalStorageCount,
                    ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now) : product.OrderCount,
                    unlimitedstorage = product.UnlimitedStorage,
                    virtualordercount = product.VirtualOrderCount,
                    usevirtualorder = product.UseVirtualOrder,
                    opengroup = product.OpenGroup,
                    groupprice = product.GroupPrice,
                    groupquantity = product.GroupQuantity,
                    qrcode = product.Qrcode,
                    groupphoto = string.IsNullOrWhiteSpace(product.GroupPhoto) ? product.Photo : product.GroupPhoto
                },
                standardList = standardList,
                standardRecordValueList = standardRecordValueList,
                attributeRecordList = attributeRecordList,
                productPhotoList = productPhotoList,
                prorecommend = prorelist,
                proComm = procomlist,
                maxPrice = maxPrice,
                groupList = gpList
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        public ActionResult Index()
        {
            int      userGrade = UserGradeBLL.ReadByMoney(0).Id;
            UserInfo user      = new UserInfo();

            #region 判断用户归属分销商

            int uid = RequestHelper.GetForm <int>("uid");
            //分销商Id
            int distributor_id = RequestHelper.GetForm <int>("distributor_id");
            if (uid > 0)
            {
                user = UserBLL.ReadUserMore(uid);
                if (user.Id > 0)
                {
                    userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
                }
            }
            //if (distributor_id > 0)
            //{
            //    //当前分销商
            //    var distributor = UserBLL.Read(distributor_id);
            //    //如果当前分销商状态正常
            //    if (distributor.Distributor_Status == (int)Distributor_Status.Normal)
            //    {
            //        //如果用户已有分销商
            //        if (user.Recommend_UserId > 0)
            //        {
            //            var old_distributor = UserBLL.Read(user.Recommend_UserId);
            //            //如果原分销商状态不正常,,则修改用户归属当前分销商
            //            if (old_distributor.Distributor_Status != (int)Distributor_Status.Normal)
            //            {
            //                Dictionary<string, object> dict = new Dictionary<string, object>();
            //                dict.Add("[Recommend_UserId]", distributor.Id);
            //                UserBLL.UpdatePart("[Usr]", dict, user.Id);
            //            }
            //        }
            //        else
            //        {//如果用户没有归属分销商,则修改用户归属当前分销商
            //            Dictionary<string, object> dict = new Dictionary<string, object>();
            //            dict.Add("[Recommend_UserId]", distributor.Id);
            //            UserBLL.UpdatePart("[Usr]", dict, user.Id);
            //        }
            //    }
            //}

            #endregion
            #region 首页BANNER
            var bannercount = RequestHelper.GetForm <int>("bannercount");
            if (bannercount <= 0)
            {
                bannercount = 5;
            }
            var banner = AdImageBLL.ReadList(11, bannercount);
            #endregion

            int count = int.MinValue;
            #region 推荐产品
            var recmdprocount = RequestHelper.GetForm <int>("recmdprocount");
            if (recmdprocount <= 0)
            {
                recmdprocount = 6;
            }
            var recmdpro = ProductBLL.SearchList(1, recmdprocount, new ProductSearchInfo()
            {
                IsSale = 1, IsTop = 1, IsDelete = 0
            }, ref count).Select(k => new
            {
                id     = k.Id,
                name   = k.Name,
                img    = ShopCommon.ShowImage(k.Photo.Replace("Original", "150-150")),
                imgbig = ShopCommon.ShowImage(k.Photo.Replace("Original", "350-350")),
                imgorg = ShopCommon.ShowImage(k.Photo),
                price  = ProductBLL.GetCurrentPrice(k.SalePrice, userGrade)
            });
            #endregion

            #region 排序前4个分类及相关产品

            List <VirtualCategory> vcatelist = new List <VirtualCategory>();
            var catelist = ProductClassBLL.ReadRootList().Take(6).ToList();

            foreach (var category in catelist)
            {
                VirtualCategory vcate = new VirtualCategory();
                vcate.productClass = category;

                List <ProductVirtualModel> tempvp = new List <ProductVirtualModel>();
                var templist = ProductBLL.SearchList(1, 4, new ProductSearchInfo()
                {
                    IsSale = 1, ClassId = "|" + category.Id + "|", IsDelete = 0
                }, ref count);
                foreach (var item in templist)
                {
                    var vp = new ProductVirtualModel()
                    {
                        id         = item.Id,
                        name       = item.Name,
                        img        = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                        imgbig     = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                        imgorg     = ShopCommon.ShowImage(item.Photo),
                        groupphoto = string.IsNullOrWhiteSpace(item.GroupPhoto) ? item.Photo : item.GroupPhoto,
                        price      = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                        click      = item.ViewCount,
                        like       = item.LikeNum,
                        totalstore = item.TotalStorageCount,
                        //ordercount=item.OrderCount
                        //是否启用不限库存,分别计算销量
                        ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount
                    };
                    tempvp.Add(vp);
                }
                vcate.productlists = tempvp;
                vcatelist.Add(vcate);
            }
            #endregion
            //普通优惠券
            var couponlist = CouponBLL.SearchList(1, 1000, new CouponSearchInfo {
                Type = (int)CouponKind.Common, CanUse = 1
            }, ref count);
            //新客优惠券
            CouponInfo registerCoupon     = new CouponInfo();
            var        registerCouponlist = CouponBLL.SearchList(1, 1, new CouponSearchInfo {
                Type = (int)CouponKind.RegisterGet, CanUse = 1
            }, ref count);
            if (registerCouponlist.Count > 0)
            {
                registerCoupon = registerCouponlist[0];
            }
            //是否获取新人券
            int hasRegisterCoupon = user.HasRegisterCoupon;
            //将到期未结束的砍价活动置为“砍价结束”
            BargainTimeExpire();
            return(Json(new { flag = true, banner = banner, recmdpro = recmdpro, cateandproduct = vcatelist, coupons = couponlist, hasRegisterCoupon = hasRegisterCoupon, registerCoupon = registerCoupon }));
        }