38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using BaseOUDAL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using YLErp.Abstract;
|
|
using YLErp.Helpers;
|
|
using YLErp.Model;
|
|
|
|
namespace YLErp.Modules.SystemModule
|
|
{
|
|
public class SysUserKafkaService
|
|
{
|
|
private IKafkaProduce kafkaProduceHelper;
|
|
private string topic = string.Empty;
|
|
public SysUserKafkaService(IKafkaProduce kafkaProduce)
|
|
{
|
|
kafkaProduceHelper = kafkaProduce;
|
|
topic = Environment.GetEnvironmentVariable("KafkaConfig_YiLian_SysUserInfoChangeTopic");
|
|
}
|
|
public SysUserKafkaService()
|
|
{
|
|
kafkaProduceHelper = new KafkaProduceHelper();
|
|
topic = Environment.GetEnvironmentVariable("KafkaConfig_YiLian_SysUserInfoChangeTopic");
|
|
}
|
|
public void Send(SysUserChangeInfo sysUser)
|
|
{
|
|
SysUserChangeKafkaRequest sysUserChangeKafkaRequest = new SysUserChangeKafkaRequest();
|
|
sysUserChangeKafkaRequest.Id = sysUser.Id;
|
|
if (!string.IsNullOrEmpty(topic))
|
|
{
|
|
kafkaProduceHelper.Produce(topic, JsonHelper.Serialize(sysUserChangeKafkaRequest));
|
|
}
|
|
}
|
|
}
|
|
}
|