添加、修改、删除 消息变更 订阅获取
private readonly ISubscribePublish _subscribePublishRedis;
/// <summary>
/// 注入服务
/// </summary>
/// <param name="db"></param>
public OperateLogProvider(ISubscribePublishRedis subscribePublishRedis)
{
_subscribePublishRedis = subscribePublishRedis;
}
//订阅消息
_subscribePublishRedis.Subscribe(pf, $"operate-log-{item.OwnerId ?? pf.OwnerId}-mkey-{item.Mkey ?? pf.ModuleKey}", (channel, result) =>
{
var subResult = (SubResult)result;
if (channel == $"operate-log-{pf.OwnerId}-mkey-{pf.ModuleKey}")
{
}
});
//订阅消息
_subscribePublishRedis.Subscribe(pf, $"operate-log-{item.OwnerId ?? pf.OwnerId}-mkey", (channel, result) =>
{
var subResult = (SubResult)result;
if (channel == $"operate-log-{pf.OwnerId}-mkey")
{
}
});
}
推送代码
//根据模块精确定位
_subscribePublishRedis.Publish<SubResult>(pf, $"operate-log-{pf.OwnerId}-mkey-{pf.ModuleKey}", new SubResult
{
ModuleKey = pf.ModuleKey,
OwnerId = pf.OwnerId,
SysId = pf.SysId,
UserId = pf.UserId,
ReponseField = pf.ReponseField,
LastDate = DateTime.Now
});
//推送消息
_subscribePublishRedis.Publish<SubResult>(pf, $"operate-log-{pf.OwnerId}-mkey", new SubResult
{
ModuleKey = pf.ModuleKey,
OwnerId = pf.OwnerId,
SysId = pf.SysId,
UserId = pf.UserId,
ReponseField = pf.ReponseField,
LastDate = DateTime.Now
});
文档更新时间: 2021-08-25 08:00 作者:admin