fix: 空SKU编码时改为自动生成避免冲突
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 50s
All checks were successful
Build and Deploy TenantApi / build-and-deploy (push) Successful in 50s
This commit is contained in:
@@ -147,7 +147,9 @@ public sealed class ProductSkuSaveService(TakeoutAppDbContext dbContext)
|
||||
continue;
|
||||
}
|
||||
|
||||
var generatedCode = normalizedSkuCode ?? GenerateUniqueSkuCode(productId, currentProductSkuCodes);
|
||||
var generatedCode = !string.IsNullOrWhiteSpace(normalizedSkuCode)
|
||||
? normalizedSkuCode
|
||||
: GenerateUniqueSkuCode(productId, currentProductSkuCodes);
|
||||
if (!plannedSkuCodes.Add(generatedCode))
|
||||
{
|
||||
throw new BusinessException(ErrorCodes.BadRequest, $"SKU 编码冲突: {generatedCode}");
|
||||
|
||||
Reference in New Issue
Block a user