remove logs; fixes;
This commit is contained in:
parent
2a3fc24632
commit
d1cdb62e64
|
|
@ -70,7 +70,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components
|
||||||
{
|
{
|
||||||
|
|
||||||
//await base.InvokeAsync(widgetZone, additionalData);
|
//await base.InvokeAsync(widgetZone, additionalData);
|
||||||
await _logger.InformationAsync($"Admin auction widget called from {widgetZone}!");
|
//await _logger.InformationAsync($"AuctionAdminViewComponent.InvokeAsync(); Admin auction widget called from {widgetZone}!");
|
||||||
|
|
||||||
if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName))
|
if (!await _widgetPluginManager.IsPluginActiveAsync(AuctionDefaults.SystemName))
|
||||||
return Content(string.Empty);
|
return Content(string.Empty);
|
||||||
|
|
||||||
|
|
@ -83,14 +84,19 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components
|
||||||
var productId = 0;
|
var productId = 0;
|
||||||
if (!widgetZone.Equals(AdminWidgetZones.ProductDetailsButtons))
|
if (!widgetZone.Equals(AdminWidgetZones.ProductDetailsButtons))
|
||||||
{
|
{
|
||||||
await _logger.InformationAsync($"Admin auction widget not in the right widgetzone {widgetZone}!");
|
await _logger.InformationAsync($"AuctionAdminViewComponent.InvokeAsync(); Admin auction widget not in the right widgetzone {widgetZone}!");
|
||||||
return Content(string.Empty);
|
return Content(string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
var product = (additionalData as ProductModel);
|
|
||||||
//ProductDetailsModel detailsModel = await _productModelFactory.PrepareProductDetailsModelAsync(product.Price);
|
//ProductDetailsModel detailsModel = await _productModelFactory.PrepareProductDetailsModelAsync(product.Price);
|
||||||
|
|
||||||
productId = product.Id;
|
if (additionalData is not ProductModel productModel)
|
||||||
|
{
|
||||||
|
await _logger.ErrorAsync($"AuctionAdminViewComponent.InvokeAsync(); (productModel == null); widgetZone: {widgetZone};");
|
||||||
|
return Content(string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
productId = productModel.Id;
|
||||||
|
|
||||||
var auctions = await _auctionService.GetAllAuctionsAsync() ?? new List<Auction>();
|
var auctions = await _auctionService.GetAllAuctionsAsync() ?? new List<Auction>();
|
||||||
|
|
||||||
|
|
@ -98,12 +104,12 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Components
|
||||||
ViewBag.Auctions = auctions;
|
ViewBag.Auctions = auctions;
|
||||||
ProductAssignToAuctionViewModel viewModel = new ProductAssignToAuctionViewModel();
|
ProductAssignToAuctionViewModel viewModel = new ProductAssignToAuctionViewModel();
|
||||||
viewModel.ProductId = productId;
|
viewModel.ProductId = productId;
|
||||||
viewModel.StartingPrice = product.OldPrice;
|
viewModel.StartingPrice = productModel.OldPrice;
|
||||||
viewModel.BidPrice = product.OldPrice;
|
viewModel.BidPrice = productModel.OldPrice;
|
||||||
//viewModel.InAuctions = await _auctionService.GetAllAuctionsAsync()
|
//viewModel.InAuctions = await _auctionService.GetAllAuctionsAsync()
|
||||||
viewModel.InAuctions = [];
|
viewModel.InAuctions = [];
|
||||||
|
|
||||||
await _logger.InformationAsync($"Admin auction widget called from {widgetZone}! II. ");
|
//await _logger.InformationAsync($"AuctionAdminViewComponent.InvokeAsync(); Admin auction widget called from {widgetZone}! II. ");
|
||||||
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml", viewModel);
|
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/AdminProductAuctionSettingsBox.cshtml", viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class AuctionViewComponent : NopViewComponent
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData)
|
public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData)
|
||||||
{
|
{
|
||||||
await _logger.InformationAsync("Auction widget called");
|
//await _logger.InformationAsync("Auction widget called");
|
||||||
|
|
||||||
//ensure that a widget is active and enabled
|
//ensure that a widget is active and enabled
|
||||||
var customer = await _workContext.GetCurrentCustomerAsync();
|
var customer = await _workContext.GetCurrentCustomerAsync();
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class AuctionController(AuctionService auctionService, ILogger logger, IP
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> RefreshAuctionWidget([FromBody] RefreshWidgetRequest request)
|
public async Task<IActionResult> RefreshAuctionWidget([FromBody] RefreshWidgetRequest request)
|
||||||
{
|
{
|
||||||
await logger.InformationAsync($"Refresh auction widget called from {request.WidgetZone} with data of {request.ProductId}");
|
//await logger.InformationAsync($"Refresh auction widget called from {request.WidgetZone} with data of {request.ProductId}");
|
||||||
|
|
||||||
var product = await productService.GetProductByIdAsync(request.ProductId);
|
var product = await productService.GetProductByIdAsync(request.ProductId);
|
||||||
var detailsModel = await productModelFactory.PrepareProductDetailsModelAsync(product);
|
var detailsModel = await productModelFactory.PrepareProductDetailsModelAsync(product);
|
||||||
|
|
|
||||||
|
|
@ -29,38 +29,43 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
_signalRMessageHandler = signalRMessageHandler;
|
_signalRMessageHandler = signalRMessageHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task OnConnectedAsync()
|
public override async Task OnConnectedAsync()
|
||||||
{
|
{
|
||||||
|
var connectionId = Context.ConnectionId;
|
||||||
//await _logger.InformationAsync($"Caller connected: id{_hubCallerContext.ConnectionId}");
|
|
||||||
var userId = Context.ConnectionId;
|
|
||||||
await _logger.InformationAsync($"Caller connected with id: {userId}");
|
|
||||||
var userName = Context.GetHttpContext().Request.Query["ConnectionId"];
|
|
||||||
if (!string.IsNullOrEmpty(userName))
|
|
||||||
{
|
|
||||||
await _logger.InformationAsync($"Caller connected with name: {userName}");
|
|
||||||
}
|
|
||||||
await base.OnConnectedAsync();
|
|
||||||
|
|
||||||
|
//await _logger.InformationAsync($"AuctionHub.OnConnectedAsync(); Caller connected with id: {connectionId}");
|
||||||
|
|
||||||
|
var httpContext = Context.GetHttpContext();
|
||||||
|
if (httpContext == null)
|
||||||
|
{
|
||||||
|
await _logger.WarningAsync($"AuctionHub.OnConnectedAsync(); (httpContext == null); connectionId: {connectionId}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var userName = httpContext.Request.Query["ConnectionId"];
|
||||||
|
if (!string.IsNullOrEmpty(userName))
|
||||||
|
{
|
||||||
|
await _logger.InformationAsync($"AuctionHub.OnConnectedAsync(); Caller connected with name: {userName}; connectionId: {connectionId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await base.OnConnectedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReceiveRegularMessageFromClient(string message)
|
public async Task ReceiveRegularMessageFromClient(string message)
|
||||||
{
|
{
|
||||||
await _logger.InformationAsync(message);
|
//await _logger.InformationAsync($"AuctionHub.OnConnectedAsync(); message: {message}");
|
||||||
// Broadcast the message received from the client to all clients
|
|
||||||
Console.Write($"Received message: {message}");
|
Console.Write($"Received message: {message}");
|
||||||
await Clients.All.SendAsync("Send", message);
|
await Clients.All.SendAsync("Send", message);
|
||||||
//await _signalRservice.TestHub();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReceiveMessageFromClient(MessageWrapper message)
|
public async Task ReceiveMessageFromClient(MessageWrapper message)
|
||||||
{
|
{
|
||||||
// Log the message type and data
|
// Log the message type and data
|
||||||
await _logger.InformationAsync($"Received message of type: {message.MessageType}");
|
//await _logger.InformationAsync($"AuctionHub.OnConnectedAsync(); Received message of type: {message.MessageType}");
|
||||||
|
|
||||||
await _signalRMessageHandler.HandleMessage(message);
|
await _signalRMessageHandler.HandleMessage(message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
|
||||||
await auctionService.UpdateProductToAuctionMappingAsync(productToAuction);
|
await auctionService.UpdateProductToAuctionMappingAsync(productToAuction);
|
||||||
}
|
}
|
||||||
|
|
||||||
var bidsCount = await auctionService.GetBidsCountByProductToAuctionIdAsync(productToAuction.Id);
|
var bidsCount = productToAuction.BidsCount;//await auctionService.GetBidsCountByProductToAuctionIdAsync(productToAuction.Id);
|
||||||
var productToauctionChangedNotification = new MessageWrapper
|
var productToauctionChangedNotification = new MessageWrapper
|
||||||
{
|
{
|
||||||
MessageType = nameof(ProductToAuctionStatusNotification),
|
MessageType = nameof(ProductToAuctionStatusNotification),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue