7、通知
更新时间: 2024-05-06 浏览次数: {{ hits }}

类名

H3.Notification.INotifier

接口清单

序号

接口名称

说明

1

Send

通知对外发送消息

基本用法

上述清单中的接口均归属在this.Engine.Notifier下,具体用法详见于接口说明的示例部分。

接口说明

1. Send(UserMessage[] messages)

1.1. 说明

通知对外发送消息。

1.2. 参数

参数名

说明

messages

要发送的消息,细节详见H3.Notification.UserMessage

1.3. 返回值

类型

说明

1.4. 示例

例如在表单提交时发送短信,代码发送短信和配置发送短信效果一样,不支持自定义前缀,并且消耗短信条数余量。

//定义一个待发送消息的集合
List < H3.Notification.UserMessage > umList = new List<H3.Notification.UserMessage>();

string sendUserId = H3.Organization.User.SystemUserId;//消息发送人氚云用户Id
string receivePhone = "12345678901";//接收短信的手机号
string prefix = "氚云";//短信前缀(由于运营商管控,目前已不支持自定义短信前缀,统一前缀为“氚云”)
string sendContent = "短信内容";

//将本次发送的消息添加到集合
umList.Add(new H3.Notification.UserMessage(sendUserId, receivePhone, prefix, sendContent));

//通过消息通知引擎发送
this.Engine.Notifier.Send(umList.ToArray());