临时提交

This commit is contained in:
李鹏军 2024-03-15 09:53:24 +08:00
parent 8f0f40cc56
commit f50dccebe8
3 changed files with 25 additions and 1 deletions

View File

@ -9,6 +9,14 @@ public interface ITrackPushCacheService
/// <returns></returns>
Task<bool> IsPushAsync(int customId);
/// <summary>
/// 判断客户是否需要推送
/// </summary>
/// <param name="subSystemId"></param>
/// <param name="customId"></param>
/// <returns></returns>
Task<bool> IsPushAsync(int subSystemId, int customId);
/// <summary>
/// 更新缓存
/// </summary>

View File

@ -99,7 +99,8 @@ public class TrackUpsertEventHandler : ITransientDependency, ICapSubscribe
};
// todo:推送只做新增的,更新和删除的不做先
if (!@event.IsPushCompleted && await _trackPushCacheService.IsPushAsync(@event.CustomId))
if (!@event.IsPushCompleted &&
await _trackPushCacheService.IsPushAsync(@event.SubSystemId, @event.CustomId))
{
//await PushTrack();
}

View File

@ -32,6 +32,21 @@ public class TrackPushCacheService : ITrackPushCacheService, ITransientDependenc
return (bool)isPush;
}
public async Task<bool> IsPushAsync(int subSystemId, int customId)
{
var isPush =
await RedisHelper.Client.GetAsync<bool?>(RedisKey(customId));
if (isPush == null)
{
isPush = await _trackPushConfigQuery.GetFirstAsync(x => x.CustomId == customId,
x => x.IsAutoPush);
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);
}
return (bool)isPush;
}
public async Task UpdateAsync(int customId, bool isPush)
{
await RedisHelper.Client.SetAsync(RedisKey(customId), isPush);