diff --git a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs index 2349273..4b1bfb2 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Domains/Dtos/ProductToAuctionDto.cs @@ -52,6 +52,7 @@ public class ProductToAuctionDto : IProductToAuctionDto CurrentPrice = productToAuction.CurrentPrice; ProductAmount = productToAuction.ProductAmount; SortIndex = productToAuction.SortIndex; + WinnerCustomerId = productToAuction.WinnerCustomerId; } public ProductToAuctionMapping CreateMainEntity() @@ -66,6 +67,7 @@ public class ProductToAuctionDto : IProductToAuctionDto mainEntity.CurrentPrice = CurrentPrice; mainEntity.ProductAmount = ProductAmount; mainEntity.SortIndex = SortIndex; + mainEntity.WinnerCustomerId = WinnerCustomerId; return mainEntity; } diff --git a/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs b/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs index 948eab8..9ea2ee9 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs +++ b/Nop.Plugin.Misc.AuctionPlugin/Hubs/SignalRMessageHandler.cs @@ -114,7 +114,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs return; } - await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product); + await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product, revertLastBid.CustomerId); await SendAuctionBidMessageAsync(revertLastBid, productToAuction, product, customer.Id); } catch (Exception ex) @@ -236,7 +236,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs var activeProductAuction = (await auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(bidRequestMessage.AuctionId, bidRequestMessage.ProductId, true)).FirstOrDefault(); 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. } @@ -257,7 +257,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs await auctionService.InsertBidAsync(auctionBid); 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); } @@ -289,7 +289,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs await hubContext.Clients.All.SendAsync("send", bidMessage.ToJson()); } - private async Task SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product) + private async Task SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product, int lastBidCustomerId) { try { @@ -298,6 +298,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs //activeProductAuction.StartingPrice = product.OldPrice; //TODO: ez biztosan kezelve van mikor összerendeljük? - J. productToAuction.CurrentPrice = product.Price; + productToAuction.WinnerCustomerId = lastBidCustomerId; await auctionService.UpdateProductToAuctionMappingAsync(productToAuction); return true; diff --git a/Nop.Plugin.Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml b/Nop.Plugin.Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml index e1e6d91..05a45ef 100644 --- a/Nop.Plugin.Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml +++ b/Nop.Plugin.Misc.AuctionPlugin/Views/PublicProductBidBox.cshtml @@ -394,14 +394,14 @@ signalRResetItemButton: true, }, [AuctionStatus.Pause]: { - signalRBidButton: true, - signalRFirstWarningButton: true, - signalRSecondWarningButton: true, - signalROpenItemButton: false, - signalRCloseItemButton: true, - signalRPauseItemButton: true, - signalRRevertBidButton: true, - signalRResetItemButton: true, + signalRBidButton: true, + signalRFirstWarningButton: true, + signalRSecondWarningButton: true, + signalROpenItemButton: false, + signalRCloseItemButton: true, + signalRPauseItemButton: true, + signalRRevertBidButton: false, + signalRResetItemButton: false, }, [AuctionStatus.Sold]: { signalRBidButton: true,