塔网消息发送平台 使用说明

消息发送平台目前支持 短信、邮件、企业微信通知服务,调用方式支持http post和rabbitmq消耗模式

一、配置说明

主程序文件 tn_notify_serv.exe
依赖的配置文件 tn_notify_config.ini

二、参数说明

send_type 发送类型 短信sms 邮件email 微信wechat
send_time 发送时间,必须为2020-12-12 12:12:12格式,短信模板中time参数
receiver 接收者,填写接收信息的手机号、邮箱或者企业微信号,多个接收者使用英文;分号分隔
subject 主题,邮件中的标题,短信模板中title参数
subject 发送内容,短信模板中info参数
msg_type 发送内容类型,微信使用,text为文本消息,img为图片消息,file为发送文件
//HTTP POS参数
{
    "send_type":"email",
    "send_time":"2020-12-27 12:30:01",
    "receiver":"liangtf@zjtouchnet.com",
    "subject":"塔网科技消息类型,短信模板中的title参数,邮件中的标题",
    "message":"短信内容,塔网科技测试短信,短信模板中的info参数"
}
--HTTP POST短信和邮件在脚本中调用
local sFor = [[{"send_type":"email","send_time":"%s","receiver":"%s","subject":"%s","message":"%s"}]]
local sBody = string.format(sFor, cutil:getSys14Time(), 'liangtf@zjtouchnet.com', '塔网科技消息类型,短信模板中的title参数,邮件中的标题', [[短信内容,塔网科技测试短信,短信模板中的info参数]]);
local sOut = CTNString();
cutil:httpPost("http://127.0.0.1:8780", sOut, sBody);
print(cutil:u2a(sOut:get())) --返回的数据为utf8格式,需要转成gb2312
--服务中调用方式
local itSendMsg = CIntent();
itSendMsg:set('send_type','email');
itSendMsg:set('send_time',cutil:getSys14Time());
itSendMsg:set('receiver','liangtf@zjtouchnet.com');
itSendMsg:set('subject', '塔网科技消息类型,短信模板中的title参数');
itSendMsg:set('message', '短信内容,塔网科技测试短信,短信模板中的info参数');

local mq = CTNLuaRabbitMQ();
mq:setLuaID(luaid());
local sMQServer = getConfigure('mq_server','mq');
local iMQPort = getConfigure('mq_port','mq');
local sMQUser = getConfigure('mq_user','mq');
local sMQPass = getConfigure('mq_pass','mq');
mq:setServer(sMQServer,iMQPort,sMQUser,sMQPass);
mq:publish(cutil:toBase64_v2(itSendMsg:toString()),'sms_que');
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:06

results matching ""

    No results matching ""