Merge pull request 'S02-轨迹中台第二部分' (#63) from S02-轨迹中台第二部分 into dev

Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/63
This commit is contained in:
liuwenxiang 2024-03-20 17:45:11 +08:00
commit 3070193228
3 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ public interface ITrackPushCacheService
/// <param name="customId">服务商id</param>
/// <param name="trackContentId"></param>
/// <returns></returns>
Task<TrackPushContentConfigDto> GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
Task<TrackPushContentConfigDto?> GetPushContentConfigAsync(int subSystemId, int customId, int trackContentId);
/// <summary>
/// 根据轨迹代码推断下一个(升序)要推送的内容,如果找不到或者已经是最后一个了,返回null

View File

@ -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
{

View File

@ -28,12 +28,12 @@ public class TrackPushCacheService : ApplicationService, ITrackPushCacheService
}
[NonAction]
public async Task<TrackPushContentConfigDto> GetPushContentConfigAsync(int subSystemId, int customId,
public async Task<TrackPushContentConfigDto?> 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]