fix:轨迹刷新没有拉取配置的case

This commit is contained in:
李鹏军 2024-03-28 11:08:23 +08:00
parent f9c61219e9
commit c8b3b99633
3 changed files with 7 additions and 6 deletions

View File

@ -19,7 +19,8 @@ public interface ITrackPullCacheService
/// <param name="subSystemId">子系统id</param> /// <param name="subSystemId">子系统id</param>
/// <param name="serviceProviderId">服务商id</param> /// <param name="serviceProviderId">服务商id</param>
/// <returns></returns> /// <returns></returns>
Task<TrackPullParamWithContentConfigDto> GetPullParamWithContentConfigAsync(int subSystemId, int serviceProviderId); Task<TrackPullParamWithContentConfigDto?>
GetPullParamWithContentConfigAsync(int subSystemId, int serviceProviderId);
/// <summary> /// <summary>
/// 设置拉取配置缓存 /// 设置拉取配置缓存
@ -28,6 +29,6 @@ public interface ITrackPullCacheService
/// <param name="subSystemId">子系统id</param> /// <param name="subSystemId">子系统id</param>
/// <param name="serviceProviderId">服务商id</param> /// <param name="serviceProviderId">服务商id</param>
/// <returns></returns> /// <returns></returns>
Task<TrackPullParamWithContentConfigDto> SetPullConfigAsync(int? id = null, int? subSystemId = null, Task<TrackPullParamWithContentConfigDto?> SetPullConfigAsync(int? id = null, int? subSystemId = null,
int? serviceProviderId = null); int? serviceProviderId = null);
} }

View File

@ -35,10 +35,11 @@ public class TrackRefreshEventHandler : ITransientDependency, ICapSubscribe
{ {
var attach = Base64Helper.DeSerialize<TrackRefreshAttach>(@event.Attach); var attach = Base64Helper.DeSerialize<TrackRefreshAttach>(@event.Attach);
if (attach is null) return; if (attach is null) return;
var config = await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId, var config = await _trackPullCacheService.GetPullParamWithContentConfigAsync(attach.SubSystemId,
attach.ServiceProviderId); attach.ServiceProviderId);
if (@event.Data == null || config == null) return;
if (@event.Data == null) return;
var data = JObject.Parse(@event.Data); var data = JObject.Parse(@event.Data);
var orderToken = data[config.ParamConfig.OrderPath]; var orderToken = data[config.ParamConfig.OrderPath];
if (orderToken is JArray orderTokens) if (orderToken is JArray orderTokens)

View File

@ -35,7 +35,7 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService
} }
[NonAction] [NonAction]
public async Task<TrackPullParamWithContentConfigDto> GetPullParamWithContentConfigAsync(int subSystemId, public async Task<TrackPullParamWithContentConfigDto?> GetPullParamWithContentConfigAsync(int subSystemId,
int serviceProviderId) int serviceProviderId)
{ {
var data = await RedisHelper.Client.GetAsync<TrackPullParamWithContentConfigDto>(TrackPullContentKey( var data = await RedisHelper.Client.GetAsync<TrackPullParamWithContentConfigDto>(TrackPullContentKey(
@ -48,7 +48,7 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService
} }
[NonAction] [NonAction]
public async Task<TrackPullParamWithContentConfigDto> SetPullConfigAsync(int? id = null, int? subSystemId = null, public async Task<TrackPullParamWithContentConfigDto?> SetPullConfigAsync(int? id = null, int? subSystemId = null,
int? serviceProviderId = null) int? serviceProviderId = null)
{ {
var data = new TrackPullParamWithContentConfigDto(); var data = new TrackPullParamWithContentConfigDto();
@ -62,7 +62,6 @@ public class TrackPullCacheService : ApplicationService, ITrackPullCacheService
if (trackPullConfigEntity == null) return data; if (trackPullConfigEntity == null) return data;
var trackPullConfigDetail = await _trackPullConfigRepository.GetDetailAsync(trackPullConfigEntity.Id); var trackPullConfigDetail = await _trackPullConfigRepository.GetDetailAsync(trackPullConfigEntity.Id);
if (trackPullConfigDetail is null) return data;
var trackPullContentList = await _trackPullConfigRepository.GetContentListCacheAsync(trackPullConfigEntity.Id); var trackPullContentList = await _trackPullConfigRepository.GetContentListCacheAsync(trackPullConfigEntity.Id);
if (trackPullContentList.Count == 0) return data; if (trackPullContentList.Count == 0) return data;