fix-build: 补充NotifyConfig
This commit is contained in:
parent
0d9e18be49
commit
6b5742fa21
63
src/SJZY.Track.Application/Hangfire/NotifyConfig.cs
Normal file
63
src/SJZY.Track.Application/Hangfire/NotifyConfig.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
namespace SJZY.Track.Application.Hangfire;
|
||||||
|
|
||||||
|
// 发送消息接口参数
|
||||||
|
// https://centerapi.test.shijizhongyun.com/userApi/index.html?urls.primaryName=%E6%B6%88%E6%81%AF%E8%AE%A2%E9%98%85%E5%AE%9E%E4%BE%8B
|
||||||
|
/// MsgSubscribeInstance/SendMessageByTemplate
|
||||||
|
public class NotifyConfig
|
||||||
|
{
|
||||||
|
private const string ContentKey = "content"; //内容参数
|
||||||
|
|
||||||
|
public bool IsNeedToHandle { get; set; } = true; //是否需要处理(默认为未处理,传false为无需处理,针对站内信是否处理功能)
|
||||||
|
public int MsgSource { get; set; } // 消息来源:1.消息 2.任务 3.流程 4.消息提醒
|
||||||
|
public int SystemId { get; set; } = 9498; //子系统id 业务中台
|
||||||
|
public string TemplateCode { get; set; } = "TrackWarningNotify"; //模板code
|
||||||
|
public List<int> Channels { get; set; } //1:站内信 2.飞书 4.邮箱 8.短信 16.语音播报
|
||||||
|
public List<Variable> Variables { get; set; } //模板参数
|
||||||
|
public List<Receiver> Receivers { get; set; }
|
||||||
|
|
||||||
|
public sealed record Variable(string Key, string Value);
|
||||||
|
|
||||||
|
public sealed record Receiver(
|
||||||
|
int ReceiverId, //接收人id : 内部用户Id,外部用户Id,或只有邮箱跟短信时不需要接收人Id
|
||||||
|
int RecipientType = 1, //接收人类型 (1:内部用户 2.外部用户)
|
||||||
|
string? ReceiverName = null, //接收人姓名
|
||||||
|
string? Mail = null, //邮箱
|
||||||
|
string? MobilePhone = null //手机号
|
||||||
|
);
|
||||||
|
|
||||||
|
public static NotifyConfig CreateConfig(int userId, string message, List<int> notifyModes)
|
||||||
|
{
|
||||||
|
return new NotifyConfig
|
||||||
|
{
|
||||||
|
Channels = notifyModes,
|
||||||
|
Receivers = new List<Receiver>(1)
|
||||||
|
{
|
||||||
|
new Receiver(userId)
|
||||||
|
},
|
||||||
|
Variables = new List<Variable>(1)
|
||||||
|
{
|
||||||
|
new Variable(ContentKey, message)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NotifyConfig CreateConfig(int userId, string message)
|
||||||
|
{
|
||||||
|
return new NotifyConfig
|
||||||
|
{
|
||||||
|
Channels = new List<int>(2)
|
||||||
|
{
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
},
|
||||||
|
Receivers = new List<Receiver>
|
||||||
|
{
|
||||||
|
new Receiver(userId)
|
||||||
|
},
|
||||||
|
Variables = new List<Variable>
|
||||||
|
{
|
||||||
|
new Variable(ContentKey, message)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user