コード例 #1
0
 public MemberController(
     IOrderService iOrderService,
     IMemberService iMemberService,
     IMemberCapitalService iMemberCapitalService,
     ICouponService iCouponService,
     IShopBonusService iShopBonusService,
     IVShopService iVShopService,
     IProductService iProductService,
     IShippingAddressService iShippingAddressService,
     IMessageService iMessageService,
     IDistributionService iDistributionService,
     IMemberSignInService iMemberSignInService,
     IRefundService iRefundService,
     ICommentService iCommentService
     )
 {
     _iOrderService           = iOrderService;
     _iMemberService          = iMemberService;
     _iMemberCapitalService   = iMemberCapitalService;
     _iCouponService          = iCouponService;
     _iShopBonusService       = iShopBonusService;
     _iVShopService           = iVShopService;
     _iProductService         = iProductService;
     _iShippingAddressService = iShippingAddressService;
     _iMessageService         = iMessageService;
     _iMemberSignInService    = iMemberSignInService;
     _iDistributionService    = iDistributionService;
     _iRefundService          = iRefundService;
     _iCommentService         = iCommentService;
 }
コード例 #2
0
 public UserOrderController(
     IShopBonusService iShopBonusService,
     ICashDepositsService iCashDepositsService,
     ISiteSettingService iSiteSettingService,
     IOrderService iOrderService,
     IRefundService iRefundService,
     ICustomerService iCustomerService,
     IProductService iProductService,
     ICouponService iCouponService,
     ICommentService iCommentService,
     IFightGroupService iFightGroupService, ITypeService iTypeService
     )
 {
     _iShopBonusService    = iShopBonusService;
     _iCashDepositsService = iCashDepositsService;
     _iSiteSettingService  = iSiteSettingService;
     _iOrderService        = iOrderService;
     _iRefundService       = iRefundService;
     _iCustomerService     = iCustomerService;
     _iProductService      = iProductService;
     _iCouponService       = iCouponService;
     _iCommentService      = iCommentService;
     _iFightGroupService   = iFightGroupService;
     _iTypeService         = iTypeService;
 }
コード例 #3
0
        public ProductPartialController(
            IMemberIntegralService iMemberIntegralService,
            IProductService iProductService,
            ICouponService iCouponService,
            IShopBonusService iShopBonusService,
            IArticleService iArticleService,
            IArticleCategoryService iArticleCategoryService,
            INavigationService iNavigationService,
            IHomeCategoryService iHomeCategoryService,
            IBrandService iBrandService,
            ICategoryService iCategoryService,
            ICustomerService iCustomerService,
            ISlideAdsService iSlideAdsService

            )
        {
            _iMemberIntegralService  = iMemberIntegralService;
            _iProductService         = iProductService;
            _iCouponService          = iCouponService;
            _iShopBonusService       = iShopBonusService;
            _iArticleService         = iArticleService;
            _iArticleCategoryService = iArticleCategoryService;
            _iNavigationService      = iNavigationService;
            _iHomeCategoryService    = iHomeCategoryService;
            _iBrandService           = iBrandService;
            _iCategoryService        = iCategoryService;
            _iCustomerService        = iCustomerService;
            _iSlideAdsService        = iSlideAdsService;
        }
コード例 #4
0
 public ShopBonusController()
 {
     _siteSetting = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();
     if (string.IsNullOrWhiteSpace(_siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(_siteSetting.WeixinAppSecret))
     {
         throw new HimallException("未配置公众号参数");
     }
     _bonusService = ServiceHelper.Create <IShopBonusService>();
     ser_wxcard    = ServiceHelper.Create <IWXCardService>();
 }
コード例 #5
0
 public SideController(IMemberIntegralService iMemberIntegralService,
                       IProductService iProductService,
                       IShopBonusService iShopBonusService,
                       ICouponService iCouponService
                       )
 {
     _iMemberIntegralService = iMemberIntegralService;
     _iProductService        = iProductService;
     _iShopBonusService      = iShopBonusService;
     _iCouponService         = iCouponService;
 }
コード例 #6
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());
        }
コード例 #7
0
 public CouponController(ICouponService iCouponService,
                         IVShopService iVShopService,
                         IShopService iShopService,
                         IShopBonusService iShopBonusService,
                         IMemberService iMemberService
                         )
 {
     _iCouponService    = iCouponService;
     _iShopService      = iShopService;
     _iVShopService     = iVShopService;
     _iShopBonusService = iShopBonusService;
     _iMemberService    = iMemberService;
 }
コード例 #8
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());
        }
コード例 #9
0
 public ShopBonusController(IShopBonusService iShopBonusService,
                            IWXCardService iWXCardService,
                            IVShopService iVShopService,
                            IShopService iShopService
                            )
 {
     this._siteSetting = CurrentSiteSetting;
     if (string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppSecret))
     {
         throw new HimallException("未配置公众号参数");
     }
     this._bonusService   = iShopBonusService;
     this._iWXCardService = iWXCardService;
     _iVShopService       = iVShopService;
     _iShopService        = iShopService;
 }
コード例 #10
0
        public ShopBonusController(IShopBonusService iShopBonusService,
                                   IWXCardService iWXCardService,
                                   IVShopService iVShopService,
                                   IShopService iShopService
                                   )
        {
            var settings = SiteSettingApplication.SiteSettings;

            if (string.IsNullOrWhiteSpace(settings.WeixinAppId) || string.IsNullOrWhiteSpace(settings.WeixinAppSecret))
            {
                throw new MallException("未配置公众号参数");
            }
            this._bonusService   = iShopBonusService;
            this._iWXCardService = iWXCardService;
            _iVShopService       = iVShopService;
            _iShopService        = iShopService;
        }
コード例 #11
0
 public HomeController(
     IMemberService iMemberService,
     ISlideAdsService iSlideAdsService,
     IFloorService iFloorService,
     IArticleCategoryService iArticleCategoryService,
     IArticleService iArticleService,
     IBrandService iBrandService,
     ILimitTimeBuyService iLimitTimeBuyService,
     IShopBonusService iShopBonusService)
 {
     _iMemberService          = iMemberService;
     _iSlideAdsService        = iSlideAdsService;
     _iFloorService           = iFloorService;
     _iArticleCategoryService = iArticleCategoryService;
     _iArticleService         = iArticleService;
     _iBrandService           = iBrandService;
     _iLimitTimeBuyService    = iLimitTimeBuyService;
     _iShopBonusService       = iShopBonusService;
 }
コード例 #12
0
 public BranchOrderController()
 {
     _iOrderService = new OrderService();
     _iCartService = new CartService();
     _iMemberService = new MemberService();
     _iProductService = new ProductService();
     _iPaymentConfigService = new PaymentConfigService();
     _iCashDepositsService = new CashDepositsService();
     _iShopService = ServiceProvider.Instance<IShopService>.Create;
     _iLimitTimeBuyService = new LimitTimeBuyService();
     _iCouponService = new CouponService();
     _iShopBonusService = new ShopBonusService();
     _iCollocationService = new CollocationService();
     _iMemberCapitalService = new MemberCapitalService();
     _iShippingAddressService = new ShippingAddressService();
     _iMemberIntegralService = new MemberIntegralService();
     _iRegionService = new RegionService();
     _iVShopService = new VShopService();
     _iRefundService = new RefundService();
     _iFightGroupService = new FightGroupService();
 }
コード例 #13
0
 public BranchOrderController()
 {
     this._iOrderService           = (IOrderService) new OrderService();
     this._iCartService            = (ICartService) new CartService();
     this._iMemberService          = (IMemberService) new MemberService();
     this._iProductService         = (IProductService) new ProductService();
     this._iPaymentConfigService   = (IPaymentConfigService) new PaymentConfigService();
     this._iCashDepositsService    = (ICashDepositsService) new CashDepositsService();
     this._iSiteSettingService     = (ISiteSettingService) new SiteSettingService();
     this._iShopService            = (IShopService) new ShopService();
     this._iLimitTimeBuyService    = (ILimitTimeBuyService) new LimitTimeBuyService();
     this._iCouponService          = (ICouponService) new CouponService();
     this._iShopBonusService       = (IShopBonusService) new ShopBonusService();
     this._iCollocationService     = (ICollocationService) new CollocationService();
     this._iMemberCapitalService   = (IMemberCapitalService) new MemberCapitalService();
     this._iShippingAddressService = (IShippingAddressService) new ShippingAddressService();
     this._iMemberIntegralService  = (IMemberIntegralService) new MemberIntegralService();
     this._iRegionService          = (IRegionService) new RegionService();
     this._iVShopService           = (IVShopService) new VShopService();
     this._iRefundService          = (IRefundService) new RefundService();
     this._iFightGroupService      = (IFightGroupService) new FightGroupService();
 }
コード例 #14
0
        public ActionResult Detail(long id)
        {
            OrderInfo       order          = ServiceHelper.Create <IOrderService>().GetOrder(id, base.CurrentUser.Id);
            IShopService    shopService    = ServiceHelper.Create <IShopService>();
            IProductService productService = ServiceHelper.Create <IProductService>();
            OrderDetail     orderDetail    = new OrderDetail()
            {
                ShopName   = shopService.GetShop(order.ShopId, false).ShopName,
                ShopId     = order.ShopId,
                OrderItems =
                    from item in order.OrderItemInfo
                    select new OrderItem()
                {
                    ProductId    = item.ProductId,
                    ProductName  = item.ProductName,
                    Count        = item.Quantity,
                    Price        = item.SalePrice,
                    ProductImage = productService.GetProduct(item.ProductId).GetImage(ProductInfo.ImageSize.Size_100, 1)
                }
            };

            ViewBag.Detail = orderDetail;
            ViewBag.Bonus  = (dynamic)null;
            if (base.PlatformType == ChemCloud.Core.PlatformType.WeiXin)
            {
                IShopBonusService  shopBonusService = ServiceHelper.Create <IShopBonusService>();
                ShopBonusGrantInfo grantByUserOrder = shopBonusService.GetGrantByUserOrder(id, base.CurrentUser.Id);

                if (grantByUserOrder != null)
                {
                    ViewBag.Bonus = grantByUserOrder;
                    dynamic  viewBag = base.ViewBag;
                    object[] host    = new object[] { "http://", base.Request.Url.Host, "/m-weixin/shopbonus/index/", shopBonusService.GetGrantIdByOrderId(id) };
                    viewBag.ShareHref = string.Concat(host);
                }
            }
            ViewBag.Logo = base.CurrentSiteSetting.Logo;
            return(View(order));
        }
コード例 #15
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" }));
        }
コード例 #16
0
        public ActionResult Index(string orderDate, string keywords, string orderids, DateTime?startDateTime, DateTime?endDateTime, int?orderStatus, int pageNo = 1, int pageSize = 10)
        {
            OrderInfo.OrderOperateStatus?nullable;
            ViewBag.Grant = (object)null;
            if (!string.IsNullOrEmpty(orderids) && orderids.IndexOf(',') <= 0)
            {
                ViewBag.Grant = ServiceHelper.Create <IShopBonusService>().GetByOrderId(long.Parse(orderids));
            }
            DateTime?nullable1 = startDateTime;
            DateTime?nullable2 = endDateTime;

            if (!string.IsNullOrEmpty(orderDate) && orderDate.ToLower() != "all")
            {
                string lower = orderDate.ToLower();
                string str   = lower;
                if (lower != null)
                {
                    if (str == "threemonth")
                    {
                        nullable1 = new DateTime?(DateTime.Now.AddMonths(-3));
                    }
                    else if (str == "halfyear")
                    {
                        nullable1 = new DateTime?(DateTime.Now.AddMonths(-6));
                    }
                    else if (str == "year")
                    {
                        nullable1 = new DateTime?(DateTime.Now.AddYears(-1));
                    }
                    else if (str == "yearago")
                    {
                        nullable2 = new DateTime?(DateTime.Now.AddYears(-1));
                    }
                }
            }
            if (orderStatus.HasValue)
            {
                int?nullable3 = orderStatus;
                if ((nullable3.GetValueOrDefault() != 0 ? false : nullable3.HasValue))
                {
                    orderStatus = null;
                }
            }
            OrderQuery orderQuery = new OrderQuery()
            {
                StartDate = nullable1,
                EndDate   = nullable2
            };
            OrderQuery orderQuery1 = orderQuery;
            int?       nullable4   = orderStatus;

            if (nullable4.HasValue)
            {
                nullable = new OrderInfo.OrderOperateStatus?((OrderInfo.OrderOperateStatus)nullable4.GetValueOrDefault());
            }
            else
            {
                nullable = null;
            }
            orderQuery1.Status        = nullable;
            orderQuery.UserId         = new long?(base.CurrentUser.Id);
            orderQuery.SearchKeyWords = keywords;
            orderQuery.PageSize       = pageSize;
            orderQuery.PageNo         = pageNo;
            PageModel <OrderInfo> orders     = ServiceHelper.Create <IOrderService>().GetOrders <OrderInfo>(orderQuery, null);
            PagingInfo            pagingInfo = new PagingInfo()
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = orders.Total
            };

            ViewBag.pageInfo = pagingInfo;
            ViewBag.UserId   = base.CurrentUser.Id;
            SiteSettingsInfo  siteSettings     = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();
            IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();

            ViewBag.SalesRefundTimeout = siteSettings.SalesReturnTimeout;
            List <OrderInfo>             list           = orders.Models.ToList();
            ICashDepositsService         create         = Instance <ICashDepositsService> .Create;
            IEnumerable <OrderListModel> orderListModel =
                from item in list
                select new OrderListModel()
            {
                Id                 = item.Id,
                ActiveType         = item.ActiveType,
                OrderType          = item.OrderType,
                Address            = item.Address,
                CellPhone          = item.CellPhone,
                CloseReason        = item.CloseReason,
                CommisTotalAmount  = item.CommisAmount,
                DiscountAmount     = item.DiscountAmount,
                ExpressCompanyName = item.ExpressCompanyName,
                FinishDate         = item.FinishDate,
                Freight            = item.Freight,
                GatewayOrderId     = item.GatewayOrderId,
                IntegralDiscount   = item.IntegralDiscount,
                UserId             = item.UserId,
                ShopId             = item.ShopId,
                ShopName           = item.ShopName,
                ShipTo             = item.ShipTo,
                OrderTotalAmount   = item.OrderTotalAmount,
                PaymentTypeName    = item.PaymentTypeName,
                OrderStatus        = item.OrderStatus,
                RefundStats        = item.RefundStats,
                OrderCommentInfo   = item.OrderCommentInfo,
                OrderDate          = item.OrderDate,
                OrderItemList      =
                    from oItem in item.OrderItemInfo
                    select new OrderItemListModel()
                {
                    ProductId              = oItem.ProductId,
                    Color                  = oItem.Color,
                    Size                   = oItem.Size,
                    Version                = oItem.Version,
                    ProductName            = oItem.ProductName,
                    ThumbnailsUrl          = oItem.ThumbnailsUrl,
                    SalePrice              = oItem.SalePrice,
                    SkuId                  = oItem.SkuId,
                    Quantity               = oItem.Quantity,
                    CashDepositsObligation = create.GetCashDepositsObligation(oItem.ProductId)
                },
                ReceiveBonus = shopBonusService.GetGrantByUserOrder(item.Id, CurrentUser.Id)
            };
            List <long> nums = (
                from d in list
                select d.Id).ToList();

            if (nums.Count > 0)
            {
                RefundQuery refundQuery = new RefundQuery()
                {
                    OrderId     = new long?(nums[0]),
                    MoreOrderId = nums,
                    PageNo      = 1,
                    PageSize    = list.Count
                };
                List <OrderRefundInfo> orderRefundInfos = (
                    from d in ServiceHelper.Create <IRefundService>().GetOrderRefunds(refundQuery).Models
                    where (int)d.RefundMode == 1
                    select d).ToList();

                if (orderRefundInfos.Count > 0)
                {
                    foreach (OrderRefundInfo orderRefundInfo in orderRefundInfos)
                    {
                        OrderInfo orderInfo = list.FirstOrDefault((OrderInfo d) => d.Id == orderRefundInfo.OrderId);
                        if (orderInfo == null)
                        {
                            continue;
                        }
                        orderInfo.RefundStats = (int)(orderRefundInfo.SellerAuditStatus);
                    }
                }
            }
            return(View(orderListModel.ToList()));
        }
コード例 #17
0
 public ShopBonusController()
 {
     _bonusService = ServiceHelper.Create <IShopBonusService>();
 }
コード例 #18
0
 public UserCouponController(ICouponService iCouponService, IShopBonusService iShopBonusService)
 {
     _iCouponService    = iCouponService;
     _iShopBonusService = iShopBonusService;
 }
コード例 #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 ShopBonusController(IShopBonusService iShopBonusService, IMarketService iMarketService)
 {
     this._bonusService = iShopBonusService;
     _iMarketService    = iMarketService;
 }
コード例 #21
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"));
        }