From 09881a3932fc172d8c77227d7a417b0c0fb3f3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=86=9B?= <2357729423@qq.com> Date: Wed, 24 Apr 2024 21:44:08 +0800 Subject: [PATCH] attach --- .../EventHandlers/TrackPushCompletedEventHandler.cs | 6 ++++-- .../EventHandlers/TrackPushEventHandler.cs | 9 +++++---- .../Repositories/TrackPushRecordsRepository.cs | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushCompletedEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushCompletedEventHandler.cs index ce7e5f3c..022c1b36 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackPushCompletedEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackPushCompletedEventHandler.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using SJZY.InterfaceRelay.Application.Contracts; using SJZY.Track.Application.Contract.Dtos.TrackPush; +using SJZY.Track.Application.Helpers; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; using SJZY.Track.Domain.Consts; @@ -26,11 +27,12 @@ public class TrackPushCompletedEventHandler : ITransientDependency, ICapSubscrib public async Task ConsumerAsync(InterfaceRelayForwardReplayEvent @event) { string logStr = null; - if (@event.Attach == OptionType.新增.ToString()) + var optionType = Base64Helper.DeSerialize(@event.Attach); + if (optionType == OptionType.新增.ToString()) { logStr = JsonConvert.DeserializeObject(@event.RequestParams)!.Log; } - else if (@event.Attach == OptionType.修改.ToString()) + else if (optionType == OptionType.修改.ToString()) { logStr = JsonConvert.DeserializeObject(@event.RequestParams)!.Log; } diff --git a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs index 555511d9..3d7ae977 100644 --- a/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs +++ b/src/SJZY.Track.Application/EventHandlers/TrackPushEventHandler.cs @@ -1,11 +1,11 @@ -using System.Text; -using DotNetCore.CAP; +using DotNetCore.CAP; using Newtonsoft.Json; using SJZY.Expand.ABP.Core.PublicMethords; using SJZY.InterfaceRelay.Application.Contracts; using SJZY.Track.Application.Contract.Dtos.TrackPush; using SJZY.Track.Application.Contract.Events; using SJZY.Track.Application.Contract.Services; +using SJZY.Track.Application.Helpers; using SJZY.Track.Domain.Aggregates.OrderAggregate; using SJZY.Track.Domain.Aggregates.TrackDetailsAggregate; using SJZY.Track.Domain.Aggregates.TrackPushAggregate; @@ -144,9 +144,9 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe } } - byte[] asciiBytes = Encoding.ASCII.GetBytes(OptionType.新增.ToString()); - string asciiString = Encoding.ASCII.GetString(asciiBytes); + string asciiString = Base64Helper.SerializeObject(OptionType.新增.ToString()); + if (items.Count == 0) return; await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.PushTrackInterfaceCode, _pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe, attach: asciiString); @@ -178,6 +178,7 @@ public class TrackPushEventHandler : ITransientDependency, ICapSubscribe items.Add(item); } + if (items.Count == 0) return; await _httpClientProxy.Service.BatchForwardThenPushToQueueAsync(InterfaceRelayConst.TrackUpdateInterfaceCode, _pushConfigs.First().ServiceProviderCode, items, GlobalConst.TrackPushCompletedSubscribe, attach: OptionType.修改.ToString()); diff --git a/src/SJZY.Track.Repository/Repositories/TrackPushRecordsRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackPushRecordsRepository.cs index 760614e9..044f8753 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackPushRecordsRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackPushRecordsRepository.cs @@ -16,7 +16,7 @@ public class TrackPushRecordsRepository : ElasticSearchContextAbstract request