From ccf853287ae77352fa7a468785e8866aba0cb128 Mon Sep 17 00:00:00 2001 From: Jadyn Date: Wed, 6 Jul 2022 10:22:43 +0800 Subject: [PATCH] Improve FlashSales `ErrorCodes` and `GetList` --- ...hSalesOrderCreationAuthorizationHandler.cs | 3 +- .../FodyWeavers.xml | 2 +- .../Dtos/FlashSalesPlanGetListInput.cs | 2 +- .../FlashSalesPlanAppService.cs | 50 +++++++++++++------ .../UnexpectedInventoryStrategyException.cs | 11 ++++ .../FlashSales/FlashSalesErrorCodes.cs | 14 +++--- .../Plugins/FlashSales/Localization/en.json | 16 +++--- .../FlashSales/Localization/zh-Hans.json | 14 +++--- .../FlashSales/Localization/zh-Hant.json | 14 +++--- ...ndTimeMustBeLaterThanBeginTimeException.cs | 12 ----- .../FlashSalesPlans/FlashSalesPlan.cs | 2 +- .../InvalidEndTimeException.cs | 12 +++++ .../FlashSalesPlans/FlashSalesPlan/index.js | 6 ++- 13 files changed, 96 insertions(+), 62 deletions(-) create mode 100644 plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/UnexpectedInventoryStrategyException.cs delete mode 100644 plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs create mode 100644 plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/InvalidEndTimeException.cs diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/FlashSalesOrderCreationAuthorizationHandler.cs b/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/FlashSalesOrderCreationAuthorizationHandler.cs index cd7f0044..42505195 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/FlashSalesOrderCreationAuthorizationHandler.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/FlashSalesOrderCreationAuthorizationHandler.cs @@ -42,8 +42,7 @@ public class FlashSalesOrderCreationAuthorizationHandler : OrderCreationAuthoriz { StoreId = resource.Input.StoreId, ProductId = orderLine.ProductId, - ProductSkuId = orderLine.ProductSkuId, - OnlyShowPublished = true + ProductSkuId = orderLine.ProductSkuId }); if (plans.Items.Count > 0) { diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml b/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml index 00e1d9a1..be0de3a9 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml +++ b/plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml @@ -1,3 +1,3 @@  - + \ No newline at end of file diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/Dtos/FlashSalesPlanGetListInput.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/Dtos/FlashSalesPlanGetListInput.cs index e1b4f1fe..13a623dd 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/Dtos/FlashSalesPlanGetListInput.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/Dtos/FlashSalesPlanGetListInput.cs @@ -12,7 +12,7 @@ public class FlashSalesPlanGetListInput : ExtensiblePagedAndSortedResultRequestD public Guid? ProductSkuId { get; set; } - public bool OnlyShowPublished { get; set; } + public bool IncludeUnpublished { get; set; } public DateTime? Start { get; set; } diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlanAppService.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlanAppService.cs index c51f6579..4c06e0ab 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlanAppService.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlanAppService.cs @@ -157,7 +157,7 @@ public class FlashSalesPlanAppService : protected override async Task> CreateFilteredQueryAsync(FlashSalesPlanGetListInput input) { - if (!input.OnlyShowPublished) + if (input.IncludeUnpublished) { await CheckPolicyAsync(FlashSalesPermissions.FlashSalesPlan.Manage); } @@ -166,7 +166,7 @@ public class FlashSalesPlanAppService : .WhereIf(input.StoreId.HasValue, x => x.StoreId == input.StoreId.Value) .WhereIf(input.ProductId.HasValue, x => x.ProductId == input.ProductId.Value) .WhereIf(input.ProductSkuId.HasValue, x => x.ProductSkuId == input.ProductSkuId.Value) - .WhereIf(input.OnlyShowPublished, x => x.IsPublished) + .WhereIf(!input.IncludeUnpublished , x => x.IsPublished) .WhereIf(input.Start.HasValue, x => x.BeginTime >= input.Start.Value) .WhereIf(input.End.HasValue, x => x.BeginTime <= input.End.Value); } @@ -184,7 +184,7 @@ public class FlashSalesPlanAppService : if (product.InventoryStrategy != InventoryStrategy.FlashSales) { - throw new BusinessException(FlashSalesErrorCodes.ProductInventoryStrategyIsNotFlashSales); + throw new UnexpectedInventoryStrategyException(InventoryStrategy.FlashSales); } if (!plan.IsPublished) @@ -192,9 +192,9 @@ public class FlashSalesPlanAppService : throw new EntityNotFoundException(typeof(FlashSalesPlan), id); } - if (Clock.Now > plan.EndTime) + if (Clock.Now >= plan.EndTime) { - throw new BusinessException(FlashSalesErrorCodes.FlashSalesPlanIsExpired); + throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver); } if (productSku.Inventory < 1) @@ -210,26 +210,46 @@ public class FlashSalesPlanAppService : var plan = await GetFlashSalesPlanCacheAsync(id); if (Clock.Now > plan.EndTime) { - throw new BusinessException(FlashSalesErrorCodes.FlashSalesPlanIsExpired); + throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver); } var cacheHashToken = await GetCacheHashTokenAsync(plan); if (cacheHashToken.IsNullOrWhiteSpace()) { - throw new BusinessException(FlashSalesErrorCodes.PreOrderExpried); + throw new BusinessException(FlashSalesErrorCodes.PreOrderExpired); } var product = await ProductAppService.GetAsync(plan.ProductId); var productSku = product.GetSkuById(plan.ProductSkuId); - if (productSku.Inventory < 1) + if (!await CompareHashTokenAsync(cacheHashToken, plan, product, productSku)) { - throw new BusinessException(FlashSalesErrorCodes.ProductSkuInventoryExceeded); + throw new BusinessException(FlashSalesErrorCodes.PreOrderExpired); } - if (!await CompareHashTokenAsync(cacheHashToken, plan, product, productSku)) + if (!product.IsPublished) + { + throw new BusinessException(FlashSalesErrorCodes.ProductIsNotPublished); + } + + if (product.InventoryStrategy != InventoryStrategy.FlashSales) + { + throw new UnexpectedInventoryStrategyException(InventoryStrategy.FlashSales); + } + + if (!plan.IsPublished) + { + throw new EntityNotFoundException(typeof(FlashSalesPlan), id); + } + + if (Clock.Now >= plan.EndTime) + { + throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver); + } + + if (productSku.Inventory < 1) { - throw new BusinessException(FlashSalesErrorCodes.PreOrderExpried); + throw new BusinessException(FlashSalesErrorCodes.ProductSkuInventoryExceeded); } } @@ -244,13 +264,13 @@ public class FlashSalesPlanAppService : if (now > plan.EndTime) { - throw new BusinessException(FlashSalesErrorCodes.FlashSalesPlanIsExpired); + throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver); } var cacheHashToken = await GetCacheHashTokenAsync(plan); if (cacheHashToken.IsNullOrWhiteSpace()) { - throw new BusinessException(FlashSalesErrorCodes.PreOrderExpried); + throw new BusinessException(FlashSalesErrorCodes.PreOrderExpired); } await RemoveCacheHashTokenAsync(plan); @@ -355,7 +375,7 @@ public class FlashSalesPlanAppService : if (handle == null) { - throw new BusinessException(FlashSalesErrorCodes.CreateFlashSalesOrderBusy); + throw new BusinessException(FlashSalesErrorCodes.BusyToCreateFlashSaleOrder); } // Prevent repeat submit @@ -363,7 +383,7 @@ public class FlashSalesPlanAppService : x.PlanId == plan.Id && x.UserId == userId && (x.Status == FlashSalesResultStatus.Successful || x.Status == FlashSalesResultStatus.Pending)) ) { - throw new BusinessException(FlashSalesErrorCodes.AlreadySubmitCreateFlashSalesOrder); + throw new BusinessException(FlashSalesErrorCodes.DuplicateFlashSalesOrder); } var result = new FlashSalesResult( diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/UnexpectedInventoryStrategyException.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/UnexpectedInventoryStrategyException.cs new file mode 100644 index 00000000..bb2f6508 --- /dev/null +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/UnexpectedInventoryStrategyException.cs @@ -0,0 +1,11 @@ +using EasyAbp.EShop.Products.Products; +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans; +public class UnexpectedInventoryStrategyException : BusinessException +{ + public UnexpectedInventoryStrategyException(InventoryStrategy expectedInventoryStrategy) : base(FlashSalesErrorCodes.UnexpectedInventoryStrategy) + { + WithData(nameof(expectedInventoryStrategy), expectedInventoryStrategy); + } +} diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalesErrorCodes.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalesErrorCodes.cs index a445de23..ec85d72c 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalesErrorCodes.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalesErrorCodes.cs @@ -4,7 +4,7 @@ public static class FlashSalesErrorCodes { public const string Namespace = "EasyAbp.EShop.Plugins.FlashSales"; - public const string EndTimeMustBeLaterThanBeginTime = $"{Namespace}:{nameof(EndTimeMustBeLaterThanBeginTime)}"; + public const string InvalidEndTime = $"{Namespace}:{nameof(InvalidEndTime)}"; public const string ProductIsNotInThisStore = $"{Namespace}:{nameof(ProductIsNotInThisStore)}"; @@ -14,15 +14,15 @@ public static class FlashSalesErrorCodes public const string ProductSkuInventoryExceeded = $"{Namespace}:{nameof(ProductSkuInventoryExceeded)}"; - public const string ProductInventoryStrategyIsNotFlashSales = $"{Namespace}:{nameof(ProductInventoryStrategyIsNotFlashSales)}"; + public const string UnexpectedInventoryStrategy = $"{Namespace}:{nameof(UnexpectedInventoryStrategy)}"; - public const string PreOrderExpried = $"{Namespace}:{nameof(PreOrderExpried)}"; + public const string PreOrderExpired = $"{Namespace}:{nameof(PreOrderExpired)}"; - public const string FlashSalesPlanIsNotStart = $"{Namespace}:{nameof(FlashSalesPlanIsNotStart)}"; + public const string FlashSaleNotStarted = $"{Namespace}:{nameof(FlashSaleNotStarted)}"; - public const string FlashSalesPlanIsExpired = $"{Namespace}:{nameof(FlashSalesPlanIsExpired)}"; + public const string FlashSaleIsOver = $"{Namespace}:{nameof(FlashSaleIsOver)}"; - public const string CreateFlashSalesOrderBusy = $"{Namespace}:{nameof(CreateFlashSalesOrderBusy)}"; + public const string BusyToCreateFlashSaleOrder = $"{Namespace}:{nameof(BusyToCreateFlashSaleOrder)}"; - public const string AlreadySubmitCreateFlashSalesOrder = $"{Namespace}:{nameof(AlreadySubmitCreateFlashSalesOrder)}"; + public const string DuplicateFlashSalesOrder = $"{Namespace}:{nameof(DuplicateFlashSalesOrder)}"; } diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json index 7bd649b8..ff582ce7 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json @@ -1,17 +1,17 @@ { "culture": "en", "texts": { - "EasyAbp.EShop.Plugins.FlashSales:EndTimeMustBeLaterThanBeginTime": "End time must be later than start time", + "EasyAbp.EShop.Plugins.FlashSales:InvalidEndTime": "End time must be later than start time", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "Product '{productId}' is not in this store '{storeId}'", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "ProductSku '{productSkuId}' is not found", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "Product is not published", - "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "Product SKU inventory exceeded", - "EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "Product inventory strategy is not flash-sales", - "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "Pre order expired", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "FlashSales plan is not start", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "FlashSales plan is expired", - "EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "Create flash-sales order busy", - "EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "Already submit create flash-sales order", + "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "ProductSku inventory exceeded", + "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "Only the specified inventory strategy {expectedInventoryStrategy} is allowed.", + "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "Pre order expired", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "Flash-sale not started", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "Flash-sale is over", + "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "Busy to create flash-sale Order", + "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "Duplicate flash-sales order", "ExistFlashSalesPlanProduct": "Exist unexpected flash-sales plan product", "Menu:FlashSalesManagement": "FlashSales Management", "Permission:FlashSalesPlan": "FlashSales Plan", diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json index c13420e7..aef15648 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json @@ -1,17 +1,17 @@ { "culture": "zh-Hans", "texts": { - "EasyAbp.EShop.Plugins.FlashSales:EndTimeMustBeLaterThanBeginTime": "结束时间必须晚于开始时间", + "EasyAbp.EShop.Plugins.FlashSales:InvalidEndTime": "结束时间必须晚于开始时间", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "产品'{productId}'不在此店铺'{storeId}'中", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "产品SKU'{productSkuId}'不存在", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "产品尚未发布", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "产品SKU库存不足", - "EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "产品库存策略不是闪购", - "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "预下单已过期", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "闪购计划尚未开始", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "闪购计划已经结束", - "EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "闪购计划下单繁忙", - "EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "已经提交闪购下单", + "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "只允许使用指定的{expectedInventoryStrategy}库存策略", + "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "预下单已过期", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "闪购尚未开始", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "闪购已经结束", + "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "闪购下单繁忙", + "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "重复闪购下单", "ExistFlashSalesPlanProduct": "清單中不允許存在閃購計畫中的產品", "Menu:FlashSalesManagement": "闪购", "Permission:FlashSalesPlan": "闪购计划", diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json index 2311abec..81f10e24 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json @@ -1,17 +1,17 @@ { "culture": "zh-Hant", "texts": { - "EasyAbp.EShop.Plugins.FlashSales:EndTimeMustBeLaterThanBeginTime": "結束時間必須晚於開始時間", + "EasyAbp.EShop.Plugins.FlashSales:InvalidEndTime": "結束時間必須晚於開始時間", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "產品'{productId}'不在此店鋪'{storeId}'中", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "產品SKU'{productSkuId}'不存在", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "產品尚未發佈", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "產品SKU庫存不足", - "EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "產品庫存策略不是閃購", - "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "預下單已過期", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "閃購計畫尚未開始", - "EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "閃購計畫已經結束", - "EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "閃購計畫下單繁忙", - "EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "已經提交閃購下單", + "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "只允許使用指定的{expectedInventoryStrategy}庫存策略", + "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "預下單已過期", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "閃購尚未開始", + "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "閃購已經結束", + "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "閃購下單繁忙", + "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "重複閃購下單", "ExistFlashSalesPlanProduct": "清单中不允许存在闪购计划中的产品", "Menu:FlashSalesManagement": "閃購管理", "Permission:FlashSalesPlan": "閃購計畫", diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs deleted file mode 100644 index 7d3b0938..00000000 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp; - -namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans; - -public class EndTimeMustBeLaterThanBeginTimeException : BusinessException -{ - public EndTimeMustBeLaterThanBeginTimeException() - : base(FlashSalesErrorCodes.EndTimeMustBeLaterThanBeginTime) - { - - } -} diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs index e52b4c1d..a11acd7a 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs @@ -37,7 +37,7 @@ public class FlashSalesPlan : FullAuditedAggregateRoot, IMultiTenant { if (beginTime > endTime) { - throw new EndTimeMustBeLaterThanBeginTimeException(); + throw new InvalidEndTimeException(); } BeginTime = beginTime; diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/InvalidEndTimeException.cs b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/InvalidEndTimeException.cs new file mode 100644 index 00000000..e3721b43 --- /dev/null +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/InvalidEndTimeException.cs @@ -0,0 +1,12 @@ +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans; + +public class InvalidEndTimeException : BusinessException +{ + public InvalidEndTimeException() + : base(FlashSalesErrorCodes.InvalidEndTime) + { + + } +} diff --git a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js index 9845f13f..04d2156e 100644 --- a/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js +++ b/plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js @@ -14,7 +14,11 @@ $(function () { autoWidth: false, scrollCollapse: true, order: [[2, "asc"]], - ajax: abp.libs.datatables.createAjax(service.getList), + ajax: abp.libs.datatables.createAjax(service.getList, function () { + return { + includeUnpublished: abp.auth.isGranted('EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlan.Manage') + }; + }), columnDefs: [ { rowAction: {