improvements, fixes
This commit is contained in:
parent
5a0031f9a4
commit
1953c6d9ba
|
|
@ -52,6 +52,7 @@ public class ProductToAuctionDto : IProductToAuctionDto
|
||||||
CurrentPrice = productToAuction.CurrentPrice;
|
CurrentPrice = productToAuction.CurrentPrice;
|
||||||
ProductAmount = productToAuction.ProductAmount;
|
ProductAmount = productToAuction.ProductAmount;
|
||||||
SortIndex = productToAuction.SortIndex;
|
SortIndex = productToAuction.SortIndex;
|
||||||
|
WinnerCustomerId = productToAuction.WinnerCustomerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProductToAuctionMapping CreateMainEntity()
|
public ProductToAuctionMapping CreateMainEntity()
|
||||||
|
|
@ -66,6 +67,7 @@ public class ProductToAuctionDto : IProductToAuctionDto
|
||||||
mainEntity.CurrentPrice = CurrentPrice;
|
mainEntity.CurrentPrice = CurrentPrice;
|
||||||
mainEntity.ProductAmount = ProductAmount;
|
mainEntity.ProductAmount = ProductAmount;
|
||||||
mainEntity.SortIndex = SortIndex;
|
mainEntity.SortIndex = SortIndex;
|
||||||
|
mainEntity.WinnerCustomerId = WinnerCustomerId;
|
||||||
|
|
||||||
return mainEntity;
|
return mainEntity;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product);
|
await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product, revertLastBid.CustomerId);
|
||||||
await SendAuctionBidMessageAsync(revertLastBid, productToAuction, product, customer.Id);
|
await SendAuctionBidMessageAsync(revertLastBid, productToAuction, product, customer.Id);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -236,7 +236,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
var activeProductAuction = (await auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(bidRequestMessage.AuctionId, bidRequestMessage.ProductId, true)).FirstOrDefault();
|
var activeProductAuction = (await auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(bidRequestMessage.AuctionId, bidRequestMessage.ProductId, true)).FirstOrDefault();
|
||||||
if (activeProductAuction is not { IsActiveItem: true } || activeProductAuction.WinnerCustomerId == customer.Id)
|
if (activeProductAuction is not { IsActiveItem: true } || activeProductAuction.WinnerCustomerId == customer.Id)
|
||||||
{
|
{
|
||||||
logger.Warning($"SignalRMessageHandler.HandleBidRequest(); (activeProductAuction is not {{ IsActiveItem: true }} || activeProductAuction.WinnerCustomerId == customer.Id); AuctionStatus: {activeProductAuction?.AuctionStatus}; WinnerCustomerId: {activeProductAuction?.WinnerCustomerId}", null, customer);
|
logger.Warning($"SignalRMessageHandler.HandleBidRequest(); (activeProductAuction is not {{ IsActiveItem: true }}); AuctionStatus: {activeProductAuction?.AuctionStatus};", null, customer);
|
||||||
return; //TODO: - J.
|
return; //TODO: - J.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
await auctionService.InsertBidAsync(auctionBid);
|
await auctionService.InsertBidAsync(auctionBid);
|
||||||
|
|
||||||
activeProductAuction.AuctionStatus = AuctionStatus.Active;
|
activeProductAuction.AuctionStatus = AuctionStatus.Active;
|
||||||
if (!await SetAuctionBidPrice(bidRequestMessage.BidPrice, activeProductAuction, product)) return;
|
if (!await SetAuctionBidPrice(bidRequestMessage.BidPrice, activeProductAuction, product, customer.Id)) return;
|
||||||
|
|
||||||
await SendAuctionBidMessageAsync(auctionBid, activeProductAuction, product, customer.Id);
|
await SendAuctionBidMessageAsync(auctionBid, activeProductAuction, product, customer.Id);
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +289,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
await hubContext.Clients.All.SendAsync("send", bidMessage.ToJson());
|
await hubContext.Clients.All.SendAsync("send", bidMessage.ToJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product)
|
private async Task<bool> SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product, int lastBidCustomerId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -298,6 +298,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
|
|
||||||
//activeProductAuction.StartingPrice = product.OldPrice; //TODO: ez biztosan kezelve van mikor összerendeljük? - J.
|
//activeProductAuction.StartingPrice = product.OldPrice; //TODO: ez biztosan kezelve van mikor összerendeljük? - J.
|
||||||
productToAuction.CurrentPrice = product.Price;
|
productToAuction.CurrentPrice = product.Price;
|
||||||
|
productToAuction.WinnerCustomerId = lastBidCustomerId;
|
||||||
await auctionService.UpdateProductToAuctionMappingAsync(productToAuction);
|
await auctionService.UpdateProductToAuctionMappingAsync(productToAuction);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -394,14 +394,14 @@
|
||||||
signalRResetItemButton: true,
|
signalRResetItemButton: true,
|
||||||
},
|
},
|
||||||
[AuctionStatus.Pause]: {
|
[AuctionStatus.Pause]: {
|
||||||
signalRBidButton: true,
|
signalRBidButton: true,
|
||||||
signalRFirstWarningButton: true,
|
signalRFirstWarningButton: true,
|
||||||
signalRSecondWarningButton: true,
|
signalRSecondWarningButton: true,
|
||||||
signalROpenItemButton: false,
|
signalROpenItemButton: false,
|
||||||
signalRCloseItemButton: true,
|
signalRCloseItemButton: true,
|
||||||
signalRPauseItemButton: true,
|
signalRPauseItemButton: true,
|
||||||
signalRRevertBidButton: true,
|
signalRRevertBidButton: false,
|
||||||
signalRResetItemButton: true,
|
signalRResetItemButton: false,
|
||||||
},
|
},
|
||||||
[AuctionStatus.Sold]: {
|
[AuctionStatus.Sold]: {
|
||||||
signalRBidButton: true,
|
signalRBidButton: true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue