/// <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 }));
        }
Exemple #2
0
        protected override void PageLoad()
        {
            base.PageLoad();
            topNav = 2;
            int groupId = RequestHelper.GetQueryString <int>("GroupId");

            group    = GroupBuyBLL.Read(groupId);
            dataList = GroupSignBLL.SearchListByGroupId(groupId, 1, group.Quantity, ref Count);
            dataList.ForEach(k => k.UserName = System.Web.HttpUtility.UrlDecode(k.UserName, System.Text.Encoding.UTF8));
            Title = "参团记录[" + group.ProductName + "]";
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CheckAdminPower("ReadGroupSign", PowerCheckType.Single);
         int groupId = RequestHelper.GetQueryString <int>("GroupId");
         group = GroupBuyBLL.Read(groupId);
         var dataList = GroupSignBLL.SearchListByGroupId(groupId, 1, group.Quantity, ref Count);
         dataList.ForEach(k => k.UserName = HttpUtility.UrlDecode(k.UserName, System.Text.Encoding.UTF8));
         BindControl(dataList, RecordList);
     }
 }
Exemple #4
0
        /// <summary>
        /// 获取我的拼团(开团、参团)
        /// </summary>
        /// <returns></returns>
        public ActionResult GroupList(int pageIndex, int pageSize)
        {
            pageIndex = pageIndex <= 0 ? 1 : pageIndex;
            if (pageSize <= 0)
            {
                return(Json(new { ok = false, msg = "参数错误,请稍后重试" }, JsonRequestBehavior.AllowGet));
            }
            int count = 0;
            List <GroupSignInfo> groupList = GroupSignBLL.SearchListByUserId(user.Id, pageIndex, pageSize, ref count);

            groupList.ForEach(k => k.VirtualStatus = ((k.EndTime <DateTime.Now && k.Quantity> k.SignCount) ? -1 : (k.StartTime <= DateTime.Now && k.EndTime >= DateTime.Now && k.Quantity > k.SignCount) ? 0 : (k.StartTime <= DateTime.Now && k.EndTime >= DateTime.Now && k.Quantity <= k.SignCount) ? 1 : -1));
            return(Json(new { ok = true, datalist = groupList }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 按纽提交结束
        /// </summary>
        protected void ButtonEnd(OrderInfo order, string note, OrderOperate orderOperate, int startOrderStatus)
        {
            OrderBLL.AdminUpdateOrderAddAction(order, note, (int)orderOperate, startOrderStatus);

            string result = OrderOperateSendEmail(order, orderOperate);

            if (orderOperate == OrderOperate.Pay)
            {
                #region 拼团订单付款:团长付款--开团+增加参团记录;成员付款--增加参团记录
                if (order.IsActivity == (int)OrderKind.GroupBuy)
                {
                    var orderDetail = OrderDetailBLL.ReadList(order.Id).FirstOrDefault() ?? new OrderDetailInfo();
                    if (orderDetail.Id > 0)
                    {
                        var product = ProductBLL.Read(orderDetail.ProductId);
                        //团长付款
                        if (order.FavorableActivityId <= 0)
                        {
                            //开团
                            int groupId = GroupBuyBLL.Add(new GroupBuyInfo
                            {
                                Leader    = order.UserId,
                                ProductId = product.Id,
                                StartTime = DateTime.Now,
                                EndTime   = DateTime.Now.AddDays(ShopConfig.ReadConfigInfo().GroupBuyDays),
                                Quantity  = product.GroupQuantity,
                                //团购订单支付成功之后计数加1
                                SignCount = 1
                            });
                            //订单绑定团购Id
                            Dictionary <string, object> dict = new Dictionary <string, object>();
                            dict.Add("[FavorableActivityId]", groupId);
                            OrderBLL.UpdatePart("[Order]", dict, order.Id);
                            //增加参团记录
                            GroupSignBLL.Add(new GroupSignInfo
                            {
                                GroupId  = groupId,
                                UserId   = order.UserId,
                                OrderId  = order.Id,
                                SignTime = DateTime.Now
                            });
                        }
                        else//参团者付款
                        {
                            //增加参团记录
                            GroupSignBLL.Add(new GroupSignInfo
                            {
                                GroupId  = order.FavorableActivityId,
                                UserId   = order.UserId,
                                OrderId  = order.Id,
                                SignTime = DateTime.Now
                            });
                            //开团表signcount加1
                            GroupBuyBLL.PlusSignCount(order.FavorableActivityId);
                        }
                    }
                }
                #endregion
                #region 自提订单 生成提货码
                //避免重复数据,一个订单对应一个提货码,提货码没有有效期,使用过后失效
                if (order.SelfPick == 1 && PickUpCodeBLL.ReadByOrderId(order.Id).Id <= 0)
                {
                    PickUpCodeInfo pkCode = new PickUpCodeInfo();
                    pkCode.OrderId  = order.Id;
                    pkCode.Status   = 0;
                    pkCode.PickCode = PickUpCodeBLL.CreatePickUpCode();
                    int pickCodeId = PickUpCodeBLL.Add(pkCode);
                    //if (pickCodeId <= 0)
                    //{
                    //    return Json(new { flag = false, msg = "生成提货码失败" });
                    //}
                }
                #endregion
                //付款操作时触发sianalr
                ScriptHelper.Alert("订单" + ShopLanguage.ReadLanguage("OperateOK") + "。" + result, RequestHelper.RawUrl.IndexOf("?") >= 0 ? RequestHelper.RawUrl + "&paysuccess=1" : RequestHelper.RawUrl + "?paysuccess=1");
            }
            else
            {
                ScriptHelper.Alert("订单" + ShopLanguage.ReadLanguage("OperateOK") + "。" + result, RequestHelper.RawUrl);
            }
        }
Exemple #6
0
        public override void ProcessNotify()
        {
            WxPayData notifyData = GetNotifyData();


            //检查支付结果中transaction_id是否存在
            if (!notifyData.IsSet("transaction_id"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中微信订单号不存在");
                Log.Error(this.GetType().ToString(), "The Pay result is error : " + res.ToXml());
                //page.Response.Write(res.ToXml());
                //page.Response.End();
            }
            else
            {
                string transaction_id = notifyData.GetValue("transaction_id").ToString();

                //查询订单,判断订单真实性
                if (!QueryOrder(transaction_id))
                ////沙箱测试只能用out_trade_no
                //if (notifyData.IsSet("out_trade_no") && !QueryOrderByout_trade_no(notifyData.GetValue("out_trade_no").ToString()))
                {
                    //若订单查询失败,则立即返回结果给微信支付后台
                    WxPayData res = new WxPayData();
                    res.SetValue("return_code", "FAIL");
                    res.SetValue("return_msg", "订单查询失败");
                    Log.Error(this.GetType().ToString(), "Order query failure : " + res.ToXml());
                    //page.Response.Write(res.ToXml());
                    //page.Response.End();
                }
                //查询订单成功
                else
                {
                    Log.Debug(this.GetType().ToString(), "订单查询成功 ");
                    /************在这里加入商户自己的逻辑***********************************************************/

                    //attach:以逗号分开的订单Id字符串,与支付时提交的数据一致
                    if (notifyData.IsSet("attach"))
                    {
                        string attach = notifyData.GetValue("attach").ToString();

                        string[] orderIds = attach.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string orderId in orderIds)
                        {
                            var order = OrderBLL.Read(int.Parse(orderId));
                            if (order.Id > 0)
                            {
                                #region 正常流程 待付款--》待审核
                                if (order.OrderStatus == (int)OrderStatus.WaitPay)
                                {
                                    order.PayKey  = "WxPay";
                                    order.PayName = "微信支付";

                                    order.WxPayTradeNo = transaction_id;
                                    //沙箱测试用out_trade_no
                                    //order.WxPayTradeNo = notifyData.GetValue("out_trade_no").ToString();

                                    order.OrderStatus = (int)OrderStatus.WaitCheck;
                                    order.PayDate     = RequestHelper.DateNow;
                                    OrderBLL.Update(order);
                                    #region 拼团订单付款:团长付款--开团+增加参团记录;成员付款--增加参团记录
                                    if (order.IsActivity == (int)OrderKind.GroupBuy)
                                    {
                                        var orderDetail = OrderDetailBLL.ReadList(order.Id).FirstOrDefault() ?? new OrderDetailInfo();
                                        if (orderDetail.Id > 0)
                                        {
                                            var product = ProductBLL.Read(orderDetail.ProductId);
                                            //团长付款
                                            if (order.FavorableActivityId <= 0)
                                            {
                                                //开团
                                                int groupId = GroupBuyBLL.Add(new GroupBuyInfo
                                                {
                                                    Leader    = order.UserId,
                                                    ProductId = product.Id,
                                                    StartTime = DateTime.Now,
                                                    EndTime   = DateTime.Now.AddDays(ShopConfig.ReadConfigInfo().GroupBuyDays),
                                                    Quantity  = product.GroupQuantity,
                                                    //团购订单支付成功之后计数加1
                                                    SignCount = 1
                                                });
                                                //订单绑定团购Id
                                                Dictionary <string, object> dict = new Dictionary <string, object>();
                                                dict.Add("[FavorableActivityId]", groupId);
                                                OrderBLL.UpdatePart("[Order]", dict, order.Id);
                                                //增加参团记录
                                                GroupSignBLL.Add(new GroupSignInfo
                                                {
                                                    GroupId  = groupId,
                                                    UserId   = order.UserId,
                                                    OrderId  = order.Id,
                                                    SignTime = DateTime.Now
                                                });
                                            }
                                            else//参团者付款--放到参团者checkout
                                            {
                                                ////增加参团记录
                                                //GroupSignBLL.Add(new GroupSignInfo
                                                //{
                                                //    GroupId = order.FavorableActivityId,
                                                //    UserId = order.UserId,
                                                //    OrderId = order.Id,
                                                //    SignTime = DateTime.Now
                                                //});
                                                ////开团表signcount加1
                                                //GroupBuyBLL.PlusSignCount(order.FavorableActivityId);
                                            }
                                        }
                                    }
                                    #endregion
                                    #region 自提订单 生成提货码
                                    //避免重复数据,一个订单对应一个提货码,提货码没有有效期,使用过后失效
                                    if (order.SelfPick == 1 && PickUpCodeBLL.ReadByOrderId(order.Id).Id <= 0)
                                    {
                                        PickUpCodeInfo pkCode = new PickUpCodeInfo();
                                        pkCode.OrderId  = order.Id;
                                        pkCode.Status   = 0;
                                        pkCode.PickCode = PickUpCodeBLL.CreatePickUpCode();
                                        int pickCodeId = PickUpCodeBLL.Add(pkCode);
                                    }
                                    #endregion
                                    #region  价订单
                                    if (order.IsActivity == (int)OrderKind.Bargain)
                                    {
                                        BargainOrderBLL.HandleBargainOrderPay(order.FavorableActivityId);
                                    }
                                    #endregion
                                    //发送订单支付成功通知
                                    SendPayOrderMsg(order);
                                    //增加操作记录
                                    OrderActionInfo orderAction = new OrderActionInfo();
                                    orderAction.OrderId          = order.Id;
                                    orderAction.OrderOperate     = (int)OrderOperate.Pay;
                                    orderAction.StartOrderStatus = (int)OrderStatus.WaitPay;
                                    orderAction.EndOrderStatus   = (int)OrderStatus.WaitCheck;
                                    orderAction.Note             = "客户微信在线支付";
                                    orderAction.IP        = ClientHelper.IP;
                                    orderAction.Date      = RequestHelper.DateNow;
                                    orderAction.AdminID   = 0;
                                    orderAction.AdminName = string.Empty;
                                    OrderActionBLL.Add(orderAction);
                                }
                                #endregion
                                #region 非正常流程 待付款超时已失效(未退款)--》待审核
                                if (order.OrderStatus == (int)OrderStatus.NoEffect && order.IsRefund == 0)
                                {
                                    order.PayKey       = "WxPay";
                                    order.PayName      = "微信支付";
                                    order.WxPayTradeNo = transaction_id;
                                    order.OrderStatus  = (int)OrderStatus.WaitCheck;
                                    order.PayDate      = RequestHelper.DateNow;
                                    OrderBLL.Update(order);
                                    #region 拼团订单付款:团长付款--开团+增加参团记录;成员付款--增加参团记录
                                    if (order.IsActivity == (int)OrderKind.GroupBuy)
                                    {
                                        var orderDetail = OrderDetailBLL.ReadList(order.Id).FirstOrDefault() ?? new OrderDetailInfo();
                                        if (orderDetail.Id > 0)
                                        {
                                            var product = ProductBLL.Read(orderDetail.ProductId);
                                            //团长付款
                                            if (order.FavorableActivityId <= 0)
                                            {
                                                //开团
                                                int groupId = GroupBuyBLL.Add(new GroupBuyInfo
                                                {
                                                    Leader    = order.UserId,
                                                    ProductId = product.Id,
                                                    StartTime = DateTime.Now,
                                                    EndTime   = DateTime.Now.AddDays(ShopConfig.ReadConfigInfo().GroupBuyDays),
                                                    Quantity  = product.GroupQuantity,
                                                    //团购订单支付成功之后计数加1
                                                    SignCount = 1
                                                });
                                                //订单绑定团购Id
                                                Dictionary <string, object> dict = new Dictionary <string, object>();
                                                dict.Add("[FavorableActivityId]", groupId);
                                                OrderBLL.UpdatePart("[Order]", dict, order.Id);
                                                //增加参团记录
                                                GroupSignBLL.Add(new GroupSignInfo
                                                {
                                                    GroupId  = groupId,
                                                    UserId   = order.UserId,
                                                    OrderId  = order.Id,
                                                    SignTime = DateTime.Now
                                                });
                                            }
                                            else//参团者付款--放到参团者checkout
                                            {
                                                ////增加参团记录
                                                //GroupSignBLL.Add(new GroupSignInfo
                                                //{
                                                //    GroupId = order.FavorableActivityId,
                                                //    UserId = order.UserId,
                                                //    OrderId = order.Id,
                                                //    SignTime = DateTime.Now
                                                //});
                                                ////开团表signcount加1
                                                //GroupBuyBLL.PlusSignCount(order.FavorableActivityId);
                                            }
                                        }
                                    }
                                    #endregion
                                    #region 自提订单 生成提货码
                                    //避免重复数据,一个订单对应一个提货码,提货码没有有效期,使用过后失效
                                    if (order.SelfPick == 1 && PickUpCodeBLL.ReadByOrderId(order.Id).Id <= 0)
                                    {
                                        PickUpCodeInfo pkCode = new PickUpCodeInfo();
                                        pkCode.OrderId  = order.Id;
                                        pkCode.Status   = 0;
                                        pkCode.PickCode = PickUpCodeBLL.CreatePickUpCode();
                                        int pickCodeId = PickUpCodeBLL.Add(pkCode);
                                    }
                                    #endregion
                                    #region  价订单
                                    if (order.IsActivity == (int)OrderKind.Bargain)
                                    {
                                        BargainOrderBLL.HandleBargainOrderPay(order.FavorableActivityId);
                                    }
                                    #endregion
                                    #region 扣除支付积分
                                    if (order.Point > 0)
                                    {
                                        //减少积分
                                        UserAccountRecordInfo uarInfo = new UserAccountRecordInfo();
                                        uarInfo.RecordType = (int)AccountRecordType.Point;
                                        uarInfo.UserId     = order.UserId;
                                        uarInfo.UserName   = order.UserName;
                                        uarInfo.Note       = "支付订单:" + order.OrderNumber;
                                        uarInfo.Point      = -order.Point;
                                        uarInfo.Money      = 0;
                                        uarInfo.Date       = DateTime.Now;
                                        uarInfo.IP         = ClientHelper.IP;
                                        UserAccountRecordBLL.Add(uarInfo);
                                    }
                                    #endregion
                                    #region 减少商品库存
                                    ProductBLL.ChangeOrderCountByOrder(order.Id, ChangeAction.Plus);
                                    #endregion
                                    //发送订单支付成功通知
                                    SendPayOrderMsg(order);
                                    //增加操作记录
                                    OrderActionInfo orderAction = new OrderActionInfo();
                                    orderAction.OrderId          = order.Id;
                                    orderAction.OrderOperate     = (int)OrderOperate.Pay;
                                    orderAction.StartOrderStatus = (int)OrderStatus.WaitPay;
                                    orderAction.EndOrderStatus   = (int)OrderStatus.WaitCheck;
                                    orderAction.Note             = "客户微信在线支付";
                                    orderAction.IP        = ClientHelper.IP;
                                    orderAction.Date      = RequestHelper.DateNow;
                                    orderAction.AdminID   = 0;
                                    orderAction.AdminName = string.Empty;
                                    OrderActionBLL.Add(orderAction);
                                }
                                #endregion
                                //记录微信支付交易单号
                                if (order.OrderStatus == (int)OrderStatus.WaitCheck && string.IsNullOrEmpty(order.WxPayTradeNo))
                                {
                                    order.WxPayTradeNo = transaction_id;
                                    OrderBLL.Update(order);
                                }
                                notifyResult = true;
                            }
                        }
                    }

                    /************在这里加入商户自己的逻辑***********************************************************/

                    WxPayData res = new WxPayData();
                    res.SetValue("return_code", "SUCCESS");
                    res.SetValue("return_msg", "OK");
                    Log.Info(this.GetType().ToString(), "order query success : " + res.ToXml());
                    //page.Response.Write(res.ToXml());
                    //page.Response.End();
                }
            }
        }
        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));
        }