Ejemplo n.º 1
0
        public ShopController(ISessionValueProviderService sessionService, IShopService shopService,
                              ISearchService searchService, IShopClientService clientService, IShopActionService shopActionService,
                              IShopCategoryService shopCategoryService, IShopManufacturerService shopManufacturerService,
                              IPrincipalResolver principalResolver, IHeartService heartService, IShopOrderService shopOrderService, IShopPickupPointService pickupPointService)
        {
            _sessionService          = sessionService;
            _shopService             = shopService;
            _searchService           = searchService;
            _clientService           = clientService;
            _shopActionService       = shopActionService;
            _shopCategoryService     = shopCategoryService;
            _shopManufacturerService = shopManufacturerService;
            _principalResolver       = principalResolver;
            _heartService            = heartService;
            _shopOrderService        = shopOrderService;
            _pickupPointService      = pickupPointService;


            var service = DependencyResolver.Current.GetService <IShopSettingsService>();

            try
            {
                var settings = service.GetShopSettings();
                _shopUrl = String.IsNullOrEmpty(settings.ShopUrl) ? "catalog" : settings.ShopUrl;
            }
            catch
            {
                _shopUrl = "catalog";
            }
        }
Ejemplo n.º 2
0
 public CartApiController(ICartService cartService, ISessionValueProviderService sessionService, IShopService shopService, ISecurityService securityService, IShopOrderService shopOrderService, ILogService logService)
 {
     _cartService      = cartService;
     _sessionService   = sessionService;
     _shopService      = shopService;
     _securityService  = securityService;
     _shopOrderService = shopOrderService;
     _logService       = logService;
 }
Ejemplo n.º 3
0
        public static IShopOrderService CreateOrderService(PlatformType type)
        {
            IShopOrderService orderService = null;

            switch (type)
            {
            case PlatformType.Shopify:
                orderService = new ShopifyOrderService(new ShopifyClient());
                break;

            case PlatformType.XShoppy:
                orderService = new XShoppyOrderService(new XShoppyClient());
                break;

            default:
                break;
            }
            return(orderService);
        }
        public async Task <bool> Handle(OrderAsyncCommand request, CancellationToken cancellationToken)
        {
            var shops = await _basicApiService.GetAllShop();

            foreach (var item in shops)
            {
                var platformType = item.Types == (int)PlatformType.Shopify ? (int)PlatformType.Shopify : (int)PlatformType.XShoppy;

                if (item.Types == (int)PlatformType.Shopify)
                {
                    _shopOrderService = Services.ServiceFactory.CreateOrderService(PlatformType.Shopify);
                }
                if (item.Types == (int)PlatformType.XShoppy)
                {
                    _shopOrderService = Services.ServiceFactory.CreateOrderService(PlatformType.XShoppy);
                }
                //如果数据库的这种平台这个店铺的订单为0,获取全量订单,如果数据库这个种平台这个店铺的订单数不为0,获取增量订单
                var orders = _orderRepository.GetAll().Where(p => p.PlatformType == item.Types && p.ShopId == item.Id);

                var shopOrderList = new List <OrderAsyncModel>();

                //增量订单
                if (orders.Any())
                {
                    shopOrderList = await _shopOrderService.GetOrderList(item, DateTime.Now.AddDays(-1), DateTime.Now);
                }
                else//全量订单
                {
                    shopOrderList = await _shopOrderService.GetOrderList(item, DateTime.Now.AddYears(-1), DateTime.Now);
                }
                var eventModel = new OrderAsyncIntegrationEventModel();
                eventModel.ShopId = item.Id;
                eventModel.list   = shopOrderList;
                _eventBus.Publish(new OrderAsyncIntegrationEvent(eventModel));
            }
            return(await CommitAsync());
        }
Ejemplo n.º 5
0
 public OrderApiController(IShopOrderService shopOrderService)
 {
     _shopOrderService = shopOrderService;
 }