From 038c495dfaa547e839f5d41a10584efec405c547 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, 20 Mar 2024 17:23:08 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=98=AF=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/ITrackPushCacheService.cs | 2 +-
.../EventHandlers/TrackUpsertEventHandler.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
index a4a57bc0..ab34ac01 100644
--- a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
@@ -19,7 +19,7 @@ public interface ITrackPushCacheService
/// 服务商id
///
///
- Task GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
+ Task GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
///
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null
diff --git a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
index 208b3a85..7410c881 100644
--- a/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
+++ b/src/SJZY.Track.Application/EventHandlers/TrackUpsertEventHandler.cs
@@ -162,7 +162,7 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
{
config = await _trackPushCacheService.GetPushContentConfigAsync(
@event.SubSystemId, @event.CustomId, track.TrackContentId);
- if (!config.IsCanUpdate) return;
+ if (config == null || !config.IsCanUpdate) return;
}
else
{
From 07572a58380c44d684436599fbe5ff6df76acd99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com>
Date: Wed, 20 Mar 2024 17:26:59 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E9=80=81?=
=?UTF-8?q?=E7=BC=93=E5=AD=98=E8=BF=94=E5=9B=9E=E5=80=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Services/ITrackPushCacheService.cs | 2 +-
.../Services/TrackPush/TrackPushCacheService.cs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
index a4a57bc0..ab34ac01 100644
--- a/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
+++ b/src/SJZY.Track.Application.Contract/Services/ITrackPushCacheService.cs
@@ -19,7 +19,7 @@ public interface ITrackPushCacheService
/// 服务商id
///
///
- Task GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
+ Task GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
///
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null
diff --git a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
index 46155e2e..5dc319f8 100644
--- a/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
+++ b/src/SJZY.Track.Application/Services/TrackPush/TrackPushCacheService.cs
@@ -28,12 +28,12 @@ public class TrackPushCacheService : ApplicationService, ITrackPushCacheService
}
[NonAction]
- public async Task GetPushContentConfigAsync(int subSystemId, int customId,
+ public async Task GetPushContentConfigAsync(int subSystemId, int customId,
int trackContentId)
{
var data = await GetPushContentConfigsAsync(subSystemId, customId);
- return data.Single(x => x.TrackContentId == trackContentId);
+ return data?.FirstOrDefault(x => x.TrackContentId == trackContentId);
}
[NonAction]