示例#1
0
 public ShopBonusModel(ShopBonusInfo m)
 {
     Id                = m.Id;
     Count             = m.Count;
     RandomAmountStart = m.RandomAmountStart;
     RandomAmountEnd   = m.RandomAmountEnd;
     UseState          = m.UseState;
     UseStateStr       = m.UseState.ToDescription();
     UsrStatePrice     = m.UsrStatePrice;
     GrantPrice        = m.GrantPrice;
     DateStart         = m.DateStart;
     DateEnd           = m.DateEnd;
     DateStartStr      = m.DateStart.ToString("yyyy-MM-dd");
     DateEndStr        = m.DateEnd.ToString("yyyy-MM-dd");
     BonusDateStart    = m.BonusDateStart;
     BonusDateEnd      = m.BonusDateEnd;
     BonusDateStartStr = m.BonusDateStart.ToString("yyyy-MM-dd");
     BonusDateEndStr   = m.BonusDateEnd.ToString("yyyy-MM-dd");
     ShareTitle        = m.ShareTitle;
     ShareDetail       = m.ShareDetail;
     ShareImg          = m.ShareImg;
     SynchronizeCard   = m.SynchronizeCard;
     CardTitle         = m.CardTitle;
     CardColor         = m.CardColor;
     CardSubtitle      = m.CardSubtitle;
     IsInvalid         = m.IsInvalid;
     ReceiveCount      = ( int )m.ReceiveCount;
     Name              = m.Name;
     QRPath            = m.QRPath;
     ShopId            = m.ShopId;
 }
示例#2
0
        public void Invalid(long id)
        {
            ShopBonusInfo shopBonusInfo = context.ShopBonusInfo.FirstOrDefault((ShopBonusInfo p) => p.Id == id);

            shopBonusInfo.IsInvalid = true;
            context.Configuration.ValidateOnSaveEnabled = false;
            context.SaveChanges();
            context.Configuration.ValidateOnSaveEnabled = true;
        }
示例#3
0
        public ActionResult Return(string orderIds)
        {
            string empty = string.Empty;

            try
            {
                char[]             chrArray = new char[] { ',' };
                IEnumerable <long> num      =
                    from item in orderIds.Split(chrArray)
                    select long.Parse(item);

                List <long> list = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrders(num)
                    select item.Id).ToList();
                ViewBag.OrderIds = string.Join <long>(",", list);
                IOrderService orderService = ServiceHelper.Create <IOrderService>();
                DateTime?     nullable     = DateTime.Now;

                orderService.PayPalSucceed(list, nullable.Value, null, list.FirstOrDefault());
                string str = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                Cache.Insert(str, true, 15);
                Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                string            str1             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    if (byShopId != null)
                    {
                        Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                        Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                        if (byShopId.GrantPrice > order.OrderTotalAmount)
                        {
                            continue;
                        }
                        object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str1 };
                        Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                        long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str1);
                        Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                        nums.Add(num1, byShopId);
                    }
                }
            }
            catch (Exception exception)
            {
                empty = exception.Message;
            }
            ViewBag.Error = empty;
            ViewBag.Logo  = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo;
            return(View());
        }
示例#4
0
        public void Add(ShopBonusInfo model, long shopid)
        {
            ShopBonusInfo shopBonusInfo = (
                from p in context.ShopBonusInfo
                where p.ShopId == shopid
                select p).FirstOrDefault();

            if (shopBonusInfo != null && !shopBonusInfo.IsInvalid && shopBonusInfo.DateEnd > DateTime.Now && shopBonusInfo.DateStart < DateTime.Now)
            {
                throw new HimallException("一个时间段只能新增一个随机红包");
            }
            DateTime dateTime  = model.DateEnd.AddHours(23);
            DateTime dateTime1 = dateTime.AddMinutes(59);

            model.DateEnd = dateTime1.AddSeconds(59);
            DateTime dateTime2 = model.BonusDateEnd.AddHours(23);
            DateTime dateTime3 = dateTime2.AddMinutes(59);

            model.BonusDateEnd = dateTime3.AddSeconds(59);
            model.ShopId       = shopid;
            model.IsInvalid    = false;
            model.ReceiveCount = new int?(0);
            model.QRPath       = "";
            model = context.ShopBonusInfo.Add(model);
            context.Configuration.ValidateOnSaveEnabled = false;
            context.SaveChanges();
            context.Configuration.ValidateOnSaveEnabled = false;
            context.SaveChanges();
            if (model.SynchronizeCard)
            {
                WXCardLogInfo wXCardLogInfo = new WXCardLogInfo()
                {
                    CardColor    = model.CardColor,
                    CardTitle    = model.CardTitle,
                    CardSubTitle = model.CardSubtitle,
                    CouponType   = new WXCardLogInfo.CouponTypeEnum?(ThisCouponType),
                    CouponId     = new long?(model.Id),
                    ShopId       = model.ShopId,
                    Quantity     = 0
                };
                string  str             = model.RandomAmountStart.ToString("F2");
                decimal randomAmountEnd = model.RandomAmountEnd;
                wXCardLogInfo.DefaultDetail = string.Concat(str, "元", randomAmountEnd.ToString("F2"), "元随机优惠券1张");
                wXCardLogInfo.LeastCost     = (model.UseState == ShopBonusInfo.UseStateType.None ? 0 : (int)(model.UsrStatePrice * new decimal(100)));
                wXCardLogInfo.BeginTime     = model.BonusDateStart.Date;
                DateTime dateTime4 = model.BonusDateEnd.AddDays(1);
                wXCardLogInfo.EndTime = dateTime4.AddMinutes(-1);
                Instance <IWXCardService> .Create.Add(wXCardLogInfo);
            }
        }
示例#5
0
        public ActionResult Return(string id)
        {
            id = DecodePaymentId(id);
            string empty = string.Empty;

            try
            {
                Plugin <IPaymentPlugin> plugin      = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                PaymentInfo             paymentInfo = plugin.Biz.ProcessReturn(base.HttpContext.Request);
                DateTime?   tradeTime = paymentInfo.TradeTime;
                long        num       = paymentInfo.OrderIds.FirstOrDefault();
                List <long> list      = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrderPay(num)
                    select item.OrderId).ToList();
                ViewBag.OrderIds = string.Join <long>(",", list);
                IOrderService orderService = ServiceHelper.Create <IOrderService>();
                DateTime?     nullable     = paymentInfo.TradeTime;
                orderService.PaySucceed(list, id, nullable.Value, paymentInfo.TradNo, num);
                string str = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                Cache.Insert(str, true, 15);
                Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                string            str1             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                    Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                    if (byShopId.GrantPrice > order.OrderTotalAmount)
                    {
                        continue;
                    }
                    object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str1 };
                    Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                    long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str1);
                    Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                    nums.Add(num1, byShopId);
                }
            }
            catch (Exception exception)
            {
                empty = exception.Message;
            }
            ViewBag.Error = empty;
            ViewBag.Logo  = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo;
            return(View());
        }
        public void Update(ShopBonusInfo model)
        {
            ShopBonusInfo info = Context.ShopBonusInfo.FindById(model.Id);

            info.Name        = model.Name;
            info.GrantPrice  = model.GrantPrice;
            info.DateStart   = model.DateStart;
            info.DateEnd     = model.DateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            info.ShareDetail = model.ShareDetail;
            info.ShareImg    = model.ShareImg;
            info.ShareTitle  = model.ShareTitle;

            Context.Configuration.ValidateOnSaveEnabled = false;
            Context.SaveChanges();
            Context.Configuration.ValidateOnSaveEnabled = true;
        }
示例#7
0
        public void Update(ShopBonusInfo model)
        {
            ShopBonusInfo name = context.ShopBonusInfo.FindById <ShopBonusInfo>(model.Id);

            name.Name       = model.Name;
            name.GrantPrice = model.GrantPrice;
            name.DateStart  = model.DateStart;
            DateTime dateTime  = model.DateEnd.AddHours(23);
            DateTime dateTime1 = dateTime.AddMinutes(59);

            name.DateEnd     = dateTime1.AddSeconds(59);
            name.ShareDetail = model.ShareDetail;
            name.ShareImg    = model.ShareImg;
            name.ShareTitle  = model.ShareTitle;
            context.Configuration.ValidateOnSaveEnabled = false;
            context.SaveChanges();
            context.Configuration.ValidateOnSaveEnabled = true;
        }
示例#8
0
        public void Add(ShopBonusInfo model, long shopid)
        {
            var bonus = DbFactory.Default.Get <ShopBonusInfo>().Where(p => p.ShopId == shopid).FirstOrDefault();

            if (bonus != null && bonus.IsInvalid == false && bonus.DateEnd > DateTime.Now && bonus.DateStart < DateTime.Now)
            {
                throw new HimallException("一个时间段只能新增一个随机红包");
            }
            model.DateEnd      = model.DateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            model.BonusDateEnd = model.BonusDateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            model.ShopId       = shopid;
            model.IsInvalid    = false;
            model.ReceiveCount = 0;
            model.QRPath       = "";
            if (model.SynchronizeCard)
            {
                //微信卡券同步改为自动过审后有BUG,暂时默认优惠券添加就是同步状态成功的
                model.WXCardState = WXCardLogInfo.AuditStatusEnum.Audited.GetHashCode();
            }


            DbFactory.Default.Add(model);

            #region  步微信
            if (model.SynchronizeCard == true)
            {
                WXCardLogInfo wxdata = new WXCardLogInfo();
                wxdata.CardColor     = model.CardColor;
                wxdata.CardTitle     = model.CardTitle;
                wxdata.CardSubTitle  = model.CardSubtitle;
                wxdata.CouponType    = WXCardLogInfo.CouponTypeEnum.Bonus;
                wxdata.CouponId      = model.Id;
                wxdata.ShopId        = model.ShopId;
                wxdata.Quantity      = 0; //最大库存数
                wxdata.DefaultDetail = model.RandomAmountStart.ToString("F2") + "元" + model.RandomAmountEnd.ToString("F2") + "元随机优惠券1张";
                wxdata.LeastCost     = (model.UseState == ShopBonusInfo.UseStateType.None ? 0 : (int)(model.UsrStatePrice * 100));
                wxdata.BeginTime     = model.BonusDateStart.Date;
                wxdata.EndTime       = model.BonusDateEnd.AddDays(1).AddMinutes(-1);
                ServiceProvider.Instance <IWXCardService> .Create.Add(wxdata);
            }
            #endregion
        }
        public void Add(ShopBonusInfo model, long shopid)
        {
            var bonus = Context.ShopBonusInfo.Where(p => p.ShopId == shopid).FirstOrDefault();

            if (bonus != null && !bonus.IsInvalid && bonus.DateEnd > DateTime.Now && bonus.DateStart < DateTime.Now)
            {
                throw new HimallException("一个时间段只能新增一个随机红包");
            }
            model.DateEnd      = model.DateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            model.BonusDateEnd = model.BonusDateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
            model.ShopId       = shopid;
            model.IsInvalid    = false;
            model.ReceiveCount = 0;
            model.QRPath       = "";
            model = Context.ShopBonusInfo.Add(model);
            Context.Configuration.ValidateOnSaveEnabled = false;
            Context.SaveChanges();
            Context.Configuration.ValidateOnSaveEnabled = false;
            Context.SaveChanges();

            #region  步微信
            if (model.SynchronizeCard == true)
            {
                WXCardLogInfo wxdata = new WXCardLogInfo();
                wxdata.CardColor     = model.CardColor;
                wxdata.CardTitle     = model.CardTitle;
                wxdata.CardSubTitle  = model.CardSubtitle;
                wxdata.CouponType    = ThisCouponType;
                wxdata.CouponId      = model.Id;
                wxdata.ShopId        = model.ShopId;
                wxdata.Quantity      = 0; //最大库存数
                wxdata.DefaultDetail = model.RandomAmountStart.ToString("F2") + "元" + model.RandomAmountEnd.ToString("F2") + "元随机优惠券1张";
                wxdata.LeastCost     = (model.UseState == ShopBonusInfo.UseStateType.None ? 0 : (int)(model.UsrStatePrice * 100));
                wxdata.BeginTime     = model.BonusDateStart.Date;
                wxdata.EndTime       = model.BonusDateEnd.AddDays(1).AddMinutes(-1);
                ServiceProvider.Instance <IWXCardService> .Create.Add(wxdata);
            }
            #endregion
        }
示例#10
0
        public JsonResult PayByCapital(string orderIds, string pwd, string payid)
        {
            if (ServiceHelper.Create <IMemberCapitalService>().GetMemberInfoByPayPwd(base.CurrentUser.Id, pwd) == null)
            {
                throw new HimallException("Payment Password is incorrect");
            }
            char[]             chrArray = new char[] { ',' };
            IEnumerable <long> nums     =
                from e in orderIds.Split(chrArray)
                select long.Parse(e);

            ServiceHelper.Create <IOrderService>().PayCapital(nums, null, long.Parse(payid));
            Dictionary <long, ShopBonusInfo> nums1 = new Dictionary <long, ShopBonusInfo>();
            string            str = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
            IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();

            foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(nums))
            {
                Log.Info(string.Concat("ShopID = ", order.ShopId));
                ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                if (byShopId == null)
                {
                    continue;
                }
                Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                if (byShopId.GrantPrice > order.OrderTotalAmount)
                {
                    continue;
                }
                long num = shopBonusService.GenerateBonusDetail(byShopId, base.CurrentUser.Id, order.Id, str);
                Log.Info(string.Concat("生成红包组,红包Grantid = ", num));
                nums1.Add(num, byShopId);
            }
            return(Json(new { success = true, msg = "Payment Success" }));
        }
示例#11
0
        /// <summary>
        /// 生成红包详情
        /// </summary>
        public long GenerateBonusDetail(ShopBonusInfo model, long orderid, string receiveurl)
        {
            if (model.DateEnd <= DateTime.Now || model.IsInvalid)  //过期、失效
            {
                Log.Info("此活动已过期 , shopid = " + model.ShopId);
                return(0);
            }
            else if (model.DateStart > DateTime.Now) // 未开始
            {
                Log.Info("此活动未开始 , shopid = " + model.ShopId);
                return(0);
            }

            ShopBonusGrantInfo grant = null;

            try
            {
                var order = DbFactory.Default.Get <OrderInfo>().Where(r => r.Id == orderid).FirstOrDefault();

                grant = DbFactory.Default.Get <ShopBonusGrantInfo>().Where(p => p.OrderId == orderid).FirstOrDefault();

                //if (Context.ShopBonusGrantInfo.Exist((p => p.OrderId == orderid)))
                if (DbFactory.Default.Get <ShopBonusGrantInfo>().Where(p => p.OrderId == orderid).Exist())
                {
                    Log.Info("此活动已存在防止多次添加 , shopid = " + model.ShopId);
                    return(grant.Id);
                }
                DbFactory.Default.InTransaction(() =>
                {
                    grant             = new ShopBonusGrantInfo();
                    grant.ShopBonusId = model.Id;
                    grant.UserId      = order.UserId;
                    grant.OrderId     = orderid;
                    grant.BonusQR     = "";
                    DbFactory.Default.Add(grant);

                    string path   = GenerateQR(Path.Combine(receiveurl, grant.Id.ToString()));
                    grant.BonusQR = path;
                    DbFactory.Default.Set <ShopBonusGrantInfo>().Set(e => e.BonusQR, path).Where(e => e.Id == grant.Id).Succeed();

                    for (int i = 0; i < model.Count; i++)
                    {
                        decimal randPrice           = GenerateRandomAmountPrice(model.RandomAmountStart, model.RandomAmountEnd);
                        ShopBonusReceiveInfo detail = new ShopBonusReceiveInfo
                        {
                            BonusGrantId = grant.Id,
                            Price        = randPrice,
                            OpenId       = null,
                            State        = ShopBonusReceiveInfo.ReceiveState.NotUse
                        };
                        DbFactory.Default.Add(detail);
                    }
                });
            }
            catch (Exception e)
            {
                Log.Info("错误:", e);

                var sql = DbFactory.Default.Get <ShopBonusGrantInfo>()
                          .Where <ShopBonusReceiveInfo>((sbg, sbr) => sbg.Id == sbr.BonusGrantId && sbg.ShopBonusId == model.Id);
                DbFactory.Default.Del <ShopBonusReceiveInfo>().Where(n => n.ExExists(sql)).Succeed();

                DbFactory.Default.Del <ShopBonusGrantInfo>().Where(s => s.ShopBonusId == model.Id).Succeed();
                DbFactory.Default.Del <ShopBonusInfo>().Where(s => s.Id == model.Id).Succeed();
            }
            return(grant.Id);
        }
示例#12
0
 public void Update(ShopBonusInfo model)
 {
     model.DateEnd = model.DateEnd.AddHours(23).AddMinutes(59).AddSeconds(59);
     DbFactory.Default.Update(model);
 }
示例#13
0
        /// <summary>
        /// 生成红包详情
        /// </summary>
        public long GenerateBonusDetail(ShopBonusInfo model, long orderid, string receiveurl)
        {
            if (model.DateEnd <= DateTime.Now || model.IsInvalid)   //过期、失效
            {
                Log.Info("此活动已过期 , shopid = " + model.ShopId);
                return(0);
            }
            else if (model.DateStart > DateTime.Now)  // 未开始
            {
                Log.Info("此活动未开始 , shopid = " + model.ShopId);
                return(0);
            }

            ShopBonusGrantInfo grant = null;

            try
            {
                var order = Context.OrderInfo.Where(r => r.Id == orderid).FirstOrDefault();

                grant = Context.ShopBonusGrantInfo.Where(p => p.OrderId == orderid).FirstOrDefault();
                if (Context.ShopBonusGrantInfo.Exist((p => p.OrderId == orderid)))
                {
                    Log.Info("此活动已存在防止多次添加 , shopid = " + model.ShopId);
                    return(grant.Id);
                }
                grant             = new ShopBonusGrantInfo();
                grant.ShopBonusId = model.Id;
                grant.UserId      = order.UserId;
                grant.OrderId     = orderid;
                grant.BonusQR     = "";
                grant             = Context.ShopBonusGrantInfo.Add(grant);
                Context.SaveChanges();

                string path = GenerateQR(Path.Combine(receiveurl, grant.Id.ToString()));
                grant.BonusQR = path;

                List <ShopBonusReceiveInfo> list = new List <ShopBonusReceiveInfo>();
                for (int i = 0; i < model.Count; i++)
                {
                    decimal randPrice           = GenerateRandomAmountPrice(model.RandomAmountStart, model.RandomAmountEnd);
                    ShopBonusReceiveInfo detail = new ShopBonusReceiveInfo
                    {
                        BonusGrantId = grant.Id,
                        Price        = randPrice,
                        OpenId       = null,
                        State        = ShopBonusReceiveInfo.ReceiveState.NotUse
                    };
                    list.Add(detail);
                }
                Context.ShopBonusReceiveInfo.AddRange(list);
                Context.SaveChanges();
            }
            catch (Exception e)
            {
                Log.Info("错误:", e);
                Context.ShopBonusReceiveInfo.Remove(p => p.Himall_ShopBonusGrant.ShopBonusId == model.Id);
                Context.ShopBonusGrantInfo.Remove(p => p.ShopBonusId == model.Id);
                Context.ShopBonusInfo.Remove(p => p.Id == model.Id);
                Context.SaveChanges();
            }
            return(grant.Id);
        }
示例#14
0
        public ActionResult Detail(string id = "")
        {
            decimal num;
            decimal num1;
            string  str = "";
            ProductDetailModelForWeb productDetailModelForWeb = new ProductDetailModelForWeb()
            {
                Product = new ProductInfo(),
                Shop    = new ShopInfoModel(),
                Color   = new CollectionSKU(),
                Size    = new CollectionSKU(),
                Version = new CollectionSKU()
            };
            ProductDetailModelForWeb showMobileDescription = productDetailModelForWeb;
            ProductInfo product = null;
            ShopInfo    shop    = null;
            long        num2    = 0;

            long.TryParse(id, out num2);
            if (num2 == 0)
            {
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }
            product = ServiceHelper.Create <IProductService>().GetProduct(num2);
            showMobileDescription.ProductDescription = product.ProductDescriptionInfo.ShowMobileDescription;
            if (product == null)
            {
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }
            LimitTimeMarketInfo limitTimeMarketItemByProductId = ServiceHelper.Create <ILimitTimeBuyService>().GetLimitTimeMarketItemByProductId(product.Id);

            if (limitTimeMarketItemByProductId != null)
            {
                return(RedirectToAction("Detail", "LimitTimeBuy", new { id = limitTimeMarketItemByProductId.Id }));
            }
            shop = ServiceHelper.Create <IShopService>().GetShop(product.ShopId, false);
            ShopServiceMarkModel shopComprehensiveMark = ShopServiceMark.GetShopComprehensiveMark(shop.Id);

            showMobileDescription.Shop.PackMark          = shopComprehensiveMark.PackMark;
            showMobileDescription.Shop.ServiceMark       = shopComprehensiveMark.ServiceMark;
            showMobileDescription.Shop.ComprehensiveMark = shopComprehensiveMark.ComprehensiveMark;
            IQueryable <ProductCommentInfo> commentsByProductId = ServiceHelper.Create <ICommentService>().GetCommentsByProductId(num2);

            showMobileDescription.Shop.Name        = shop.ShopName;
            showMobileDescription.Shop.ProductMark = (commentsByProductId == null || commentsByProductId.Count() == 0 ? new decimal(0) : commentsByProductId.Average <ProductCommentInfo>((ProductCommentInfo p) => (decimal)p.ReviewMark));
            showMobileDescription.Shop.Id          = product.ShopId;
            showMobileDescription.Shop.FreeFreight = shop.FreeFreight;
            ViewBag.ProductNum = ServiceHelper.Create <IProductService>().GetShopOnsaleProducts(product.ShopId);
            if (base.CurrentUser != null)
            {
                ViewBag.IsFavorite = ServiceHelper.Create <IProductService>().IsFavorite(product.Id, base.CurrentUser.Id);
            }
            else
            {
                ViewBag.IsFavorite = false;
            }
            if (product.SKUInfo != null && product.SKUInfo.Count() > 0)
            {
                long num3 = 0;
                long num4 = 0;
                long num5 = 0;
                foreach (SKUInfo sKUInfo in product.SKUInfo)
                {
                    string[] strArrays = sKUInfo.Id.Split(new char[] { '\u005F' });
                    if (strArrays.Count() > 0)
                    {
                        long.TryParse(strArrays[1], out num3);
                        if (num3 != 0)
                        {
                            if (!showMobileDescription.Color.Any((ProductSKU v) => v.Value.Equals(sKUInfo.Color)))
                            {
                                long num6 = (
                                    from s in product.SKUInfo
                                    where s.Color.Equals(sKUInfo.Color)
                                    select s).Sum <SKUInfo>((SKUInfo s) => s.Stock);
                                CollectionSKU color      = showMobileDescription.Color;
                                ProductSKU    productSKU = new ProductSKU()
                                {
                                    Name          = "选择颜色",
                                    EnabledClass  = (num6 != 0 ? "enabled" : "disabled"),
                                    SelectedClass = "",
                                    SKUId         = num3,
                                    Value         = sKUInfo.Color
                                };
                                color.Add(productSKU);
                            }
                        }
                    }
                    if (strArrays.Count() > 1)
                    {
                        long.TryParse(strArrays[2], out num4);
                        if (num4 != 0)
                        {
                            if (!showMobileDescription.Size.Any((ProductSKU v) => v.Value.Equals(sKUInfo.Size)))
                            {
                                long num7 = (
                                    from s in product.SKUInfo
                                    where s.Size.Equals(sKUInfo.Size)
                                    select s).Sum <SKUInfo>((SKUInfo s1) => s1.Stock);
                                CollectionSKU size        = showMobileDescription.Size;
                                ProductSKU    productSKU1 = new ProductSKU()
                                {
                                    Name          = "选择尺码",
                                    EnabledClass  = (num7 != 0 ? "enabled" : "disabled"),
                                    SelectedClass = "",
                                    SKUId         = num4,
                                    Value         = sKUInfo.Size
                                };
                                size.Add(productSKU1);
                            }
                        }
                    }
                    if (strArrays.Count() <= 2)
                    {
                        continue;
                    }
                    long.TryParse(strArrays[3], out num5);
                    if (num5 == 0)
                    {
                        continue;
                    }
                    if (showMobileDescription.Version.Any((ProductSKU v) => v.Value.Equals(sKUInfo.Version)))
                    {
                        continue;
                    }
                    long num8 = (
                        from s in product.SKUInfo
                        where s.Version.Equals(sKUInfo.Version)
                        select s).Sum <SKUInfo>((SKUInfo s) => s.Stock);
                    CollectionSKU version     = showMobileDescription.Version;
                    ProductSKU    productSKU2 = new ProductSKU()
                    {
                        Name          = "选择版本",
                        EnabledClass  = (num8 != 0 ? "enabled" : "disabled"),
                        SelectedClass = "",
                        SKUId         = num5,
                        Value         = sKUInfo.Version
                    };
                    version.Add(productSKU2);
                }
                decimal num9  = new decimal(0);
                decimal num10 = new decimal(0);
                num9 = (
                    from s in product.SKUInfo
                    where s.Stock >= 0
                    select s).Min <SKUInfo>((SKUInfo s) => s.SalePrice);
                num10 = (
                    from s in product.SKUInfo
                    where s.Stock >= 0
                    select s).Max <SKUInfo>((SKUInfo s) => s.SalePrice);
                if (!(num9 == new decimal(0)) || !(num10 == new decimal(0)))
                {
                    str = (num10 <= num9 ? string.Format("{0}", num9.ToString("f2")) : string.Format("{0}-{1}", num9.ToString("f2"), num10.ToString("f2")));
                }
                else
                {
                    str = product.MinSalePrice.ToString("f2");
                }
            }
            base.ViewBag.Price = (string.IsNullOrWhiteSpace(str) ? product.MinSalePrice.ToString("f2") : str);
            IQueryable <StatisticOrderCommentsInfo> shopStatisticOrderComments = ServiceHelper.Create <IShopService>().GetShopStatisticOrderComments(product.ShopId);
            StatisticOrderCommentsInfo statisticOrderCommentsInfo = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 1
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo1 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 9
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo2 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 5
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo3 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 2
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo4 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 10
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo5 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 6
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo6 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 3
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo7 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 4
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo8 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 11
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo9 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 12
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo10 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 7
                select c).FirstOrDefault();
            StatisticOrderCommentsInfo statisticOrderCommentsInfo11 = (
                from c in shopStatisticOrderComments
                where (int)c.CommentKey == 8
                select c).FirstOrDefault();
            int num11 = 5;

            if (statisticOrderCommentsInfo == null || statisticOrderCommentsInfo3 == null)
            {
                ViewBag.ProductAndDescription     = num11;
                ViewBag.ProductAndDescriptionPeer = num11;
                ViewBag.ProductAndDescriptionMin  = num11;
                ViewBag.ProductAndDescriptionMax  = num11;
            }
            else
            {
                ViewBag.ProductAndDescription     = statisticOrderCommentsInfo.CommentValue;
                ViewBag.ProductAndDescriptionPeer = statisticOrderCommentsInfo3.CommentValue;
                ViewBag.ProductAndDescriptionMin  = statisticOrderCommentsInfo7.CommentValue;
                ViewBag.ProductAndDescriptionMax  = statisticOrderCommentsInfo6.CommentValue;
            }
            if (statisticOrderCommentsInfo1 == null || statisticOrderCommentsInfo4 == null)
            {
                ViewBag.SellerServiceAttitude     = num11;
                ViewBag.SellerServiceAttitudePeer = num11;
                ViewBag.SellerServiceAttitudeMax  = num11;
                ViewBag.SellerServiceAttitudeMin  = num11;
            }
            else
            {
                ViewBag.SellerServiceAttitude     = statisticOrderCommentsInfo1.CommentValue;
                ViewBag.SellerServiceAttitudePeer = statisticOrderCommentsInfo4.CommentValue;
                ViewBag.SellerServiceAttitudeMax  = statisticOrderCommentsInfo8.CommentValue;
                ViewBag.SellerServiceAttitudeMin  = statisticOrderCommentsInfo9.CommentValue;
            }
            if (statisticOrderCommentsInfo5 == null || statisticOrderCommentsInfo2 == null)
            {
                ViewBag.SellerDeliverySpeed     = num11;
                ViewBag.SellerDeliverySpeedPeer = num11;
                ViewBag.SellerDeliverySpeedMax  = num11;
                ViewBag.sellerDeliverySpeedMin  = num11;
            }
            else
            {
                ViewBag.SellerDeliverySpeed     = statisticOrderCommentsInfo2.CommentValue;
                ViewBag.SellerDeliverySpeedPeer = statisticOrderCommentsInfo5.CommentValue;
                dynamic viewBag = base.ViewBag;
                num = (statisticOrderCommentsInfo10 != null ? statisticOrderCommentsInfo10.CommentValue : new decimal(0));
                viewBag.SellerDeliverySpeedMax = num;
                dynamic obj = base.ViewBag;
                num1 = (statisticOrderCommentsInfo11 != null ? statisticOrderCommentsInfo11.CommentValue : new decimal(0));
                obj.sellerDeliverySpeedMin = num1;
            }
            showMobileDescription.Product = product;
            ICommentService commentService = ServiceHelper.Create <ICommentService>();
            CommentQuery    commentQuery   = new CommentQuery()
            {
                ProductID = product.Id,
                PageNo    = 1,
                PageSize  = 10000
            };
            PageModel <ProductCommentInfo> comments = commentService.GetComments(commentQuery);

            ViewBag.CommentCount = comments.Total;
            IQueryable <ProductConsultationInfo> consultations = ServiceHelper.Create <IConsultationService>().GetConsultations(num2);
            double num12 = product.ChemCloud_ProductComments.Count();
            double num13 = product.ChemCloud_ProductComments.Count((ProductCommentInfo item) => item.ReviewMark >= 4);

            ViewBag.NicePercent   = num13 / num12 * 100;
            ViewBag.Consultations = consultations.Count();
            if (ServiceHelper.Create <IVShopService>().GetVShopByShopId(shop.Id) != null)
            {
                ViewBag.VShopId = ServiceHelper.Create <IVShopService>().GetVShopByShopId(shop.Id).Id;
            }
            else
            {
                ViewBag.VShopId = -1;
            }
            IEnumerable <CouponInfo> couponList = GetCouponList(shop.Id);

            if (couponList != null)
            {
                int num14 = couponList.Count();
                ViewBag.CouponCount = num14;
            }
            ShopBonusInfo byShopId = ServiceHelper.Create <IShopBonusService>().GetByShopId(shop.Id);

            if (byShopId != null)
            {
                ViewBag.BonusCount             = byShopId.Count;
                ViewBag.BonusGrantPrice        = byShopId.GrantPrice;
                ViewBag.BonusRandomAmountStart = byShopId.RandomAmountStart;
                ViewBag.BonusRandomAmountEnd   = byShopId.RandomAmountEnd;
            }
            ViewBag.CashDepositsObligation = Instance <ICashDepositsService> .Create.GetCashDepositsObligation(product.Id);

            showMobileDescription.CashDepositsServer = Instance <ICashDepositsService> .Create.GetCashDepositsObligation(product.Id);

            return(View(showMobileDescription));
        }
示例#15
0
        public ActionResult Edit(long id)
        {
            ShopBonusInfo shopBonusInfo = _bonusService.Get(id);

            return(View(new ShopBonusModel(shopBonusInfo)));
        }
示例#16
0
 /// <summary>
 /// 订单支付完成时,生成红包详情
 /// </summary>
 public static long GenerateBonusDetail(ShopBonusInfo model, long orderid, string receiveurl)
 {
     return(Service.GenerateBonusDetail(model, orderid, receiveurl));
 }
示例#17
0
 /// <summary>
 ///  修改红包
 /// </summary>
 public static void Update(ShopBonusInfo model)
 {
     Service.Update(model);
 }
示例#18
0
 /// <summary>
 ///  添加红包
 /// </summary>
 public static void Add(ShopBonusInfo model, long shopid)
 {
     Service.Add(model, shopid);
 }
示例#19
0
        public ContentResult PayNotify_Post(string id)
        {
            id = DecodePaymentId(id);
            string empty = string.Empty;
            string str   = string.Empty;

            try
            {
                Plugin <IPaymentPlugin> plugin      = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                PaymentInfo             paymentInfo = plugin.Biz.ProcessNotify(base.HttpContext.Request);
                DateTime?   tradeTime = paymentInfo.TradeTime;
                long        num       = paymentInfo.OrderIds.FirstOrDefault();
                List <long> list      = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrderPay(num)
                    select item.OrderId).ToList();
                try
                {
                    IOrderService orderService = ServiceHelper.Create <IOrderService>();
                    DateTime?     nullable     = paymentInfo.TradeTime;
                    orderService.PaySucceed(list, id, nullable.Value, paymentInfo.TradNo, num);
                    str = plugin.Biz.ConfirmPayResult();
                    string str1 = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                    Cache.Insert(str1, true, 15);
                    Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                    string            str2             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                    IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                    foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                    {
                        Log.Info(string.Concat("ShopID = ", order.ShopId));
                        ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                        Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                        Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                        if (byShopId.GrantPrice > order.OrderTotalAmount)
                        {
                            continue;
                        }
                        object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str2 };
                        Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                        long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str2);
                        Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                        nums.Add(num1, byShopId);
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    string    str3      = string.Concat(id, " ", num.ToString());
                    if (paymentInfo.TradeTime.HasValue)
                    {
                        DateTime value = paymentInfo.TradeTime.Value;
                        str3 = string.Concat(str3, " TradeTime:", value.ToString());
                    }
                    str3 = string.Concat(str3, " TradNo:", paymentInfo.TradNo);
                    Log.Error(str3, exception);
                }
            }
            catch (Exception exception3)
            {
                Exception exception2 = exception3;
                string    message    = exception2.Message;
                Log.Error("PayNotify_Post", exception2);
            }
            return(base.Content(str));
        }
示例#20
0
        public long GenerateBonusDetail(ShopBonusInfo model, long createUserid, long orderid, string receiveurl)
        {
            if (model.DateEnd <= DateTime.Now || model.IsInvalid)
            {
                Log.Info(string.Concat("此活动已过期 , shopid = ", model.ShopId));
                return(0);
            }
            if (model.DateStart > DateTime.Now)
            {
                Log.Info(string.Concat("此活动未开始 , shopid = ", model.ShopId));
                return(0);
            }
            ShopBonusGrantInfo shopBonusGrantInfo = null;

            try
            {
                shopBonusGrantInfo = (
                    from p in context.ShopBonusGrantInfo
                    where p.OrderId == orderid
                    select p).FirstOrDefault();
                if (!context.ShopBonusGrantInfo.Exist <ShopBonusGrantInfo>((ShopBonusGrantInfo p) => p.OrderId == orderid))
                {
                    shopBonusGrantInfo = new ShopBonusGrantInfo()
                    {
                        ShopBonusId = model.Id,
                        UserId      = createUserid,
                        OrderId     = orderid,
                        BonusQR     = ""
                    };
                    shopBonusGrantInfo = context.ShopBonusGrantInfo.Add(shopBonusGrantInfo);
                    context.SaveChanges();
                    long   id  = shopBonusGrantInfo.Id;
                    string str = GenerateQR(Path.Combine(receiveurl, id.ToString()));
                    shopBonusGrantInfo.BonusQR = str;
                    List <ShopBonusReceiveInfo> shopBonusReceiveInfos = new List <ShopBonusReceiveInfo>();
                    for (int i = 0; i < model.Count; i++)
                    {
                        decimal num = GenerateRandomAmountPrice(model.RandomAmountStart, model.RandomAmountEnd);
                        ShopBonusReceiveInfo shopBonusReceiveInfo = new ShopBonusReceiveInfo()
                        {
                            BonusGrantId = shopBonusGrantInfo.Id,
                            Price        = new decimal?(num),
                            OpenId       = null,
                            State        = ShopBonusReceiveInfo.ReceiveState.NotUse
                        };
                        shopBonusReceiveInfos.Add(shopBonusReceiveInfo);
                    }
                    context.ShopBonusReceiveInfo.AddRange(shopBonusReceiveInfos);
                    context.SaveChanges();
                }
                else
                {
                    Log.Info(string.Concat("此活动已存在防止多次添加 , shopid = ", model.ShopId));
                    return(shopBonusGrantInfo.Id);
                }
            }
            catch (Exception exception)
            {
                Log.Info("错误:", exception);
                context.ShopBonusReceiveInfo.OrderBy((ShopBonusReceiveInfo p) => p.ChemCloud_ShopBonusGrant.ShopBonusId == model.Id);
                context.ShopBonusGrantInfo.OrderBy((ShopBonusGrantInfo p) => p.ShopBonusId == model.Id);
                context.ShopBonusInfo.OrderBy((ShopBonusInfo p) => p.Id == model.Id);
                context.SaveChanges();
            }
            return(shopBonusGrantInfo.Id);
        }
        public ActionResult Index(long id)
        {
            ActionResult actionResult;

            Log.Info("进入ShopBonus Index");
            if (base.PlatformType != Himall.Core.PlatformType.WeiXin)
            {
                Log.Info(base.PlatformType.ToString());
                return(base.Content("只能在微信端访问"));
            }
            ShopBonusInfo byGrantId = _bonusService.GetByGrantId(id);

            if (byGrantId == null)
            {
                Log.Info(string.Concat("红包失踪,id = ", id));
                return(Redirect("/m-weixin/ShopBonus/Invalidtwo"));
            }
            string item = base.HttpContext.Request["code"];
            OAuthAccessTokenResult accessToken = null;

            if (string.IsNullOrEmpty(item))
            {
                string absoluteUri  = base.Request.Url.AbsoluteUri;
                string authorizeUrl = OAuthApi.GetAuthorizeUrl(_siteSetting.WeixinAppId.Trim(), absoluteUri, "STATE#wechat_redirect", OAuthScope.snsapi_userinfo, "code");
                return(Redirect(authorizeUrl));
            }
            try
            {
                accessToken = OAuthApi.GetAccessToken(_siteSetting.WeixinAppId.Trim(), _siteSetting.WeixinAppSecret.Trim(), item, "authorization_code");
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                actionResult = base.Content(((exception.InnerException == null ? exception : exception.InnerException)).Message);
                return(actionResult);
            }
            Log.Info("------------------------------");
            OAuthUserInfo  userInfo       = OAuthApi.GetUserInfo(accessToken.access_token, accessToken.openid, Language.zh_CN);
            ShopBonusModel shopBonusModel = new ShopBonusModel(byGrantId);

            if (shopBonusModel.DateEnd <= DateTime.Now || shopBonusModel.IsInvalid || shopBonusModel.BonusDateEnd <= DateTime.Now)
            {
                object[] objArray = new object[] { "/m-weixin/ShopBonus/Expired/", shopBonusModel.Id, "?openId=", accessToken.openid, "&grantid=", id, "&wxhead=", userInfo.headimgurl };
                return(Redirect(string.Concat(objArray)));
            }
            if (shopBonusModel.DateStart > DateTime.Now)
            {
                return(Redirect(string.Concat("/m-weixin/ShopBonus/NotStart/", shopBonusModel.Id)));
            }
            ShopReceiveModel shopReceiveModel = (ShopReceiveModel)_bonusService.Receive(id, userInfo.openid, userInfo.headimgurl, userInfo.nickname);

            Log.Info(string.Concat("获取State=", shopReceiveModel.State.ToString()));
            if (shopReceiveModel.State == ShopReceiveStatus.CanReceive)
            {
                object[] objArray1 = new object[] { "/m-weixin/ShopBonus/Completed/", shopBonusModel.Id, "?openId=", userInfo.openid, "&price=", shopReceiveModel.Price, "&user="******"&grantid=", id, "&rid=", shopReceiveModel.Id, "&wxhead=", userInfo.headimgurl, "&host=", base.Request.Url.Host };
                return(Redirect(string.Concat(objArray1)));
            }
            if (shopReceiveModel.State == ShopReceiveStatus.CanReceiveNotUser)
            {
                object[] objArray2 = new object[] { "/m-weixin/ShopBonus/CompletedNotUser/", shopBonusModel.Id, "?openId=", userInfo.openid, "&price=", shopReceiveModel.Price, "&grantid=", id, "&rid=", shopReceiveModel.Id, "&wxhead=", userInfo.headimgurl, "&host=", base.Request.Url.Host };
                return(Redirect(string.Concat(objArray2)));
            }
            if (shopReceiveModel.State == ShopReceiveStatus.Receive)
            {
                object[] objArray3 = new object[] { "/m-weixin/ShopBonus/HasReceive/", shopBonusModel.Id, "?openId=", userInfo.openid, "&grantid=", id, "&wxhead=", userInfo.headimgurl, "&host=", base.Request.Url.Host };
                return(Redirect(string.Concat(objArray3)));
            }
            if (shopReceiveModel.State == ShopReceiveStatus.HaveNot)
            {
                object[] objArray4 = new object[] { "/m-weixin/ShopBonus/HaveNot/", shopBonusModel.Id, "?openId=", userInfo.openid, "&grantid=", id, "&wxhead=", userInfo.headimgurl };
                return(Redirect(string.Concat(objArray4)));
            }
            if (shopReceiveModel.State != ShopReceiveStatus.Invalid)
            {
                throw new Exception("领取发生异常");
            }
            object[] objArray5 = new object[] { "/m-weixin/ShopBonus/Expired/", shopBonusModel.Id, "?openId=", userInfo.openid, "&grantid=", id, "&wxhead=", userInfo.headimgurl };
            return(Redirect(string.Concat(objArray5)));
        }
示例#22
0
        public ActionResult PaymentToOrders(string ids)
        {
            Log.Info(string.Concat("ids = ", ids));
            Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
            string str = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");

            if (!string.IsNullOrEmpty(ids))
            {
                string[]    strArrays  = ids.Split(new char[] { ',' });
                List <long> nums1      = new List <long>();
                string[]    strArrays1 = strArrays;
                for (int i = 0; i < strArrays1.Length; i++)
                {
                    nums1.Add(long.Parse(strArrays1[i]));
                }
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(nums1.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    if (byShopId == null)
                    {
                        continue;
                    }
                    Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                    Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                    if (byShopId.GrantPrice > order.OrderTotalAmount)
                    {
                        continue;
                    }
                    long num = shopBonusService.GenerateBonusDetail(byShopId, base.CurrentUser.Id, order.Id, str);
                    Log.Info(string.Concat("生成红包组,红包Grantid = ", num));
                    nums.Add(num, byShopId);
                }
            }
            ViewBag.Path          = str;
            ViewBag.BonusGrantIds = nums;
            ViewBag.BaseAddress   = string.Concat("http://", base.Request.Url.Host.ToString());
            SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();
            IWXApiService    wXApiService = ServiceHelper.Create <IWXApiService>();
            string           ticket       = wXApiService.GetTicket(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
            JSSDKHelper      jSSDKHelper  = new JSSDKHelper();
            string           timestamp    = JSSDKHelper.GetTimestamp();
            string           noncestr     = JSSDKHelper.GetNoncestr();
            string           signature    = jSSDKHelper.GetSignature(ticket, noncestr, timestamp, base.Request.Url.AbsoluteUri);

            ViewBag.Timestamp = timestamp;
            ViewBag.NonceStr  = noncestr;
            ViewBag.Signature = signature;
            ViewBag.AppId     = siteSettings.WeixinAppId;
            IQueryable <OrderInfo> topOrders  = ServiceHelper.Create <IOrderService>().GetTopOrders(2147483647, base.CurrentUser.Id);
            OrderQuery             orderQuery = new OrderQuery()
            {
                Status    = new OrderInfo.OrderOperateStatus?(OrderInfo.OrderOperateStatus.Finish),
                UserId    = new long?(base.CurrentUser.Id),
                PageSize  = 2147483647,
                PageNo    = 1,
                Commented = new bool?(false)
            };
            OrderQuery orderQuery1 = orderQuery;

            ViewBag.WaitingForComments = ServiceHelper.Create <IOrderService>().GetOrders <OrderInfo>(orderQuery1, null).Total;
            ServiceHelper.Create <IMemberService>().GetMember(base.CurrentUser.Id);
            ViewBag.AllOrders = topOrders.Count();
            base.ViewBag.WaitingForRecieve = topOrders.Count((OrderInfo item) => (int)item.OrderStatus == 3);
            base.ViewBag.WaitingForPay     = topOrders.Count((OrderInfo item) => (int)item.OrderStatus == 1);
            return(View("~/Areas/Mobile/Templates/Default/Views/Member/Orders.cshtml"));
        }