Browse Source

Improve FlashSales `ErrorCodes` and `GetList`

pull/184/head
Jadyn 4 years ago
parent
commit
ccf853287a
  1. 3
      plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/FlashSalesOrderCreationAuthorizationHandler.cs
  2. 2
      plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml
  3. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application.Contracts/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/Dtos/FlashSalesPlanGetListInput.cs
  4. 50
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlanAppService.cs
  5. 11
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/UnexpectedInventoryStrategyException.cs
  6. 14
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalesErrorCodes.cs
  7. 16
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json
  8. 14
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json
  9. 14
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json
  10. 12
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs
  11. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs
  12. 12
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/InvalidEndTimeException.cs
  13. 6
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js

3
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, StoreId = resource.Input.StoreId,
ProductId = orderLine.ProductId, ProductId = orderLine.ProductId,
ProductSkuId = orderLine.ProductSkuId, ProductSkuId = orderLine.ProductSkuId
OnlyShowPublished = true
}); });
if (plans.Items.Count > 0) if (plans.Items.Count > 0)
{ {

2
plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/FodyWeavers.xml

@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait /> <ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers> </Weavers>

2
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 Guid? ProductSkuId { get; set; }
public bool OnlyShowPublished { get; set; } public bool IncludeUnpublished { get; set; }
public DateTime? Start { get; set; } public DateTime? Start { get; set; }

50
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<IQueryable<FlashSalesPlan>> CreateFilteredQueryAsync(FlashSalesPlanGetListInput input) protected override async Task<IQueryable<FlashSalesPlan>> CreateFilteredQueryAsync(FlashSalesPlanGetListInput input)
{ {
if (!input.OnlyShowPublished) if (input.IncludeUnpublished)
{ {
await CheckPolicyAsync(FlashSalesPermissions.FlashSalesPlan.Manage); await CheckPolicyAsync(FlashSalesPermissions.FlashSalesPlan.Manage);
} }
@ -166,7 +166,7 @@ public class FlashSalesPlanAppService :
.WhereIf(input.StoreId.HasValue, x => x.StoreId == input.StoreId.Value) .WhereIf(input.StoreId.HasValue, x => x.StoreId == input.StoreId.Value)
.WhereIf(input.ProductId.HasValue, x => x.ProductId == input.ProductId.Value) .WhereIf(input.ProductId.HasValue, x => x.ProductId == input.ProductId.Value)
.WhereIf(input.ProductSkuId.HasValue, x => x.ProductSkuId == input.ProductSkuId.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.Start.HasValue, x => x.BeginTime >= input.Start.Value)
.WhereIf(input.End.HasValue, x => x.BeginTime <= input.End.Value); .WhereIf(input.End.HasValue, x => x.BeginTime <= input.End.Value);
} }
@ -184,7 +184,7 @@ public class FlashSalesPlanAppService :
if (product.InventoryStrategy != InventoryStrategy.FlashSales) if (product.InventoryStrategy != InventoryStrategy.FlashSales)
{ {
throw new BusinessException(FlashSalesErrorCodes.ProductInventoryStrategyIsNotFlashSales); throw new UnexpectedInventoryStrategyException(InventoryStrategy.FlashSales);
} }
if (!plan.IsPublished) if (!plan.IsPublished)
@ -192,9 +192,9 @@ public class FlashSalesPlanAppService :
throw new EntityNotFoundException(typeof(FlashSalesPlan), id); 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) if (productSku.Inventory < 1)
@ -210,26 +210,46 @@ public class FlashSalesPlanAppService :
var plan = await GetFlashSalesPlanCacheAsync(id); var plan = await GetFlashSalesPlanCacheAsync(id);
if (Clock.Now > plan.EndTime) if (Clock.Now > plan.EndTime)
{ {
throw new BusinessException(FlashSalesErrorCodes.FlashSalesPlanIsExpired); throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver);
} }
var cacheHashToken = await GetCacheHashTokenAsync(plan); var cacheHashToken = await GetCacheHashTokenAsync(plan);
if (cacheHashToken.IsNullOrWhiteSpace()) if (cacheHashToken.IsNullOrWhiteSpace())
{ {
throw new BusinessException(FlashSalesErrorCodes.PreOrderExpried); throw new BusinessException(FlashSalesErrorCodes.PreOrderExpired);
} }
var product = await ProductAppService.GetAsync(plan.ProductId); var product = await ProductAppService.GetAsync(plan.ProductId);
var productSku = product.GetSkuById(plan.ProductSkuId); 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) if (now > plan.EndTime)
{ {
throw new BusinessException(FlashSalesErrorCodes.FlashSalesPlanIsExpired); throw new BusinessException(FlashSalesErrorCodes.FlashSaleIsOver);
} }
var cacheHashToken = await GetCacheHashTokenAsync(plan); var cacheHashToken = await GetCacheHashTokenAsync(plan);
if (cacheHashToken.IsNullOrWhiteSpace()) if (cacheHashToken.IsNullOrWhiteSpace())
{ {
throw new BusinessException(FlashSalesErrorCodes.PreOrderExpried); throw new BusinessException(FlashSalesErrorCodes.PreOrderExpired);
} }
await RemoveCacheHashTokenAsync(plan); await RemoveCacheHashTokenAsync(plan);
@ -355,7 +375,7 @@ public class FlashSalesPlanAppService :
if (handle == null) if (handle == null)
{ {
throw new BusinessException(FlashSalesErrorCodes.CreateFlashSalesOrderBusy); throw new BusinessException(FlashSalesErrorCodes.BusyToCreateFlashSaleOrder);
} }
// Prevent repeat submit // 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)) 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( var result = new FlashSalesResult(

11
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);
}
}

14
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 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)}"; 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 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)}";
} }

16
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/en.json

@ -1,17 +1,17 @@
{ {
"culture": "en", "culture": "en",
"texts": { "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:ProductIsNotInThisStore": "Product '{productId}' is not in this store '{storeId}'",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "ProductSku '{productSkuId}' is not found", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "ProductSku '{productSkuId}' is not found",
"EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "Product is not published", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "Product is not published",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "Product SKU inventory exceeded", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "ProductSku inventory exceeded",
"EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "Product inventory strategy is not flash-sales", "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "Only the specified inventory strategy {expectedInventoryStrategy} is allowed.",
"EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "Pre order expired", "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "Pre order expired",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "FlashSales plan is not start", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "Flash-sale not started",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "FlashSales plan is expired", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "Flash-sale is over",
"EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "Create flash-sales order busy", "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "Busy to create flash-sale Order",
"EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "Already submit create flash-sales order", "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "Duplicate flash-sales order",
"ExistFlashSalesPlanProduct": "Exist unexpected flash-sales plan product", "ExistFlashSalesPlanProduct": "Exist unexpected flash-sales plan product",
"Menu:FlashSalesManagement": "FlashSales Management", "Menu:FlashSalesManagement": "FlashSales Management",
"Permission:FlashSalesPlan": "FlashSales Plan", "Permission:FlashSalesPlan": "FlashSales Plan",

14
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hans.json

@ -1,17 +1,17 @@
{ {
"culture": "zh-Hans", "culture": "zh-Hans",
"texts": { "texts": {
"EasyAbp.EShop.Plugins.FlashSales:EndTimeMustBeLaterThanBeginTime": "结束时间必须晚于开始时间", "EasyAbp.EShop.Plugins.FlashSales:InvalidEndTime": "结束时间必须晚于开始时间",
"EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "产品'{productId}'不在此店铺'{storeId}'中", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "产品'{productId}'不在此店铺'{storeId}'中",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "产品SKU'{productSkuId}'不存在", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "产品SKU'{productSkuId}'不存在",
"EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "产品尚未发布", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "产品尚未发布",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "产品SKU库存不足", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "产品SKU库存不足",
"EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "产品库存策略不是闪购", "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "只允许使用指定的{expectedInventoryStrategy}库存策略",
"EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "预下单已过期", "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "预下单已过期",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "闪购计划尚未开始", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "闪购尚未开始",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "闪购计划已经结束", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "闪购已经结束",
"EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "闪购计划下单繁忙", "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "闪购下单繁忙",
"EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "已经提交闪购下单", "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "重复闪购下单",
"ExistFlashSalesPlanProduct": "清單中不允許存在閃購計畫中的產品", "ExistFlashSalesPlanProduct": "清單中不允許存在閃購計畫中的產品",
"Menu:FlashSalesManagement": "闪购", "Menu:FlashSalesManagement": "闪购",
"Permission:FlashSalesPlan": "闪购计划", "Permission:FlashSalesPlan": "闪购计划",

14
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/Localization/zh-Hant.json

@ -1,17 +1,17 @@
{ {
"culture": "zh-Hant", "culture": "zh-Hant",
"texts": { "texts": {
"EasyAbp.EShop.Plugins.FlashSales:EndTimeMustBeLaterThanBeginTime": "結束時間必須晚於開始時間", "EasyAbp.EShop.Plugins.FlashSales:InvalidEndTime": "結束時間必須晚於開始時間",
"EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "產品'{productId}'不在此店鋪'{storeId}'中", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotInThisStore": "產品'{productId}'不在此店鋪'{storeId}'中",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "產品SKU'{productSkuId}'不存在", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuIsNotFound": "產品SKU'{productSkuId}'不存在",
"EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "產品尚未發佈", "EasyAbp.EShop.Plugins.FlashSales:ProductIsNotPublished": "產品尚未發佈",
"EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "產品SKU庫存不足", "EasyAbp.EShop.Plugins.FlashSales:ProductSkuInventoryExceeded": "產品SKU庫存不足",
"EasyAbp.EShop.Plugins.FlashSales:ProductInventoryStrategyIsNotFlashSales": "產品庫存策略不是閃購", "EasyAbp.EShop.Plugins.FlashSales:UnexpectedInventoryStrategy": "只允許使用指定的{expectedInventoryStrategy}庫存策略",
"EasyAbp.EShop.Plugins.FlashSales:PreOrderExpried": "預下單已過期", "EasyAbp.EShop.Plugins.FlashSales:PreOrderExpired": "預下單已過期",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsNotStart": "閃購計畫尚未開始", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleNotStarted": "閃購尚未開始",
"EasyAbp.EShop.Plugins.FlashSales:FlashSalesPlanIsExpired": "閃購計畫已經結束", "EasyAbp.EShop.Plugins.FlashSales:FlashSaleIsOver": "閃購已經結束",
"EasyAbp.EShop.Plugins.FlashSales:CreateFlashSalesOrderBusy": "閃購計畫下單繁忙", "EasyAbp.EShop.Plugins.FlashSales:BusyToCreateFlashSaleOrder": "閃購下單繁忙",
"EasyAbp.EShop.Plugins.FlashSales:AlreadySubmitCreateFlashSalesOrder": "已經提交閃購下單", "EasyAbp.EShop.Plugins.FlashSales:DuplicateFlashSalesOrder": "重複閃購下單",
"ExistFlashSalesPlanProduct": "清单中不允许存在闪购计划中的产品", "ExistFlashSalesPlanProduct": "清单中不允许存在闪购计划中的产品",
"Menu:FlashSalesManagement": "閃購管理", "Menu:FlashSalesManagement": "閃購管理",
"Permission:FlashSalesPlan": "閃購計畫", "Permission:FlashSalesPlan": "閃購計畫",

12
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/EndTimeMustBeLaterThanBeginTimeException.cs

@ -1,12 +0,0 @@
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
public class EndTimeMustBeLaterThanBeginTimeException : BusinessException
{
public EndTimeMustBeLaterThanBeginTimeException()
: base(FlashSalesErrorCodes.EndTimeMustBeLaterThanBeginTime)
{
}
}

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan.cs

@ -37,7 +37,7 @@ public class FlashSalesPlan : FullAuditedAggregateRoot<Guid>, IMultiTenant
{ {
if (beginTime > endTime) if (beginTime > endTime)
{ {
throw new EndTimeMustBeLaterThanBeginTimeException(); throw new InvalidEndTimeException();
} }
BeginTime = beginTime; BeginTime = beginTime;

12
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)
{
}
}

6
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalesPlans/FlashSalesPlan/index.js

@ -14,7 +14,11 @@ $(function () {
autoWidth: false, autoWidth: false,
scrollCollapse: true, scrollCollapse: true,
order: [[2, "asc"]], 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: [ columnDefs: [
{ {
rowAction: { rowAction: {

Loading…
Cancel
Save