Commit 38818e16 authored by qinhaitao's avatar qinhaitao

Merge branch 'c_server_ts_perf-phone' into 'c_server_ts_perf'

云告警增加phone

See merge request !46
parents a38f24a6 65818afe
......@@ -5,6 +5,7 @@
"main": "index.js",
"title": "测试活动",
"author": "duiba",
"phone": "13184232663",
"license": "ISC",
"sdkVersion": "*",
"dependencies": {
......
......@@ -4,8 +4,7 @@ const configPackage = require('../../../package.json')
* @param message
*/
export const cloundAlarm = async (context: IContext<IParams>, message: string, stack: string) => {
console.warn(configPackage)
const { title, author } = configPackage
const { title, author, phone } = configPackage
const envTxt = {
'test': '测试环境',
'pre': '预发环境',
......@@ -22,7 +21,8 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
},
"at": { "isAtAll": false, "atMobiles": [], "atUserIds": [] }
}
const result = await context.cloud.httpApi.invoke(
const result = await Promise.all([
context.cloud.httpApi.invoke(
{
'domain':'https://oapi.dingtalk.com',
'path': '/robot/send',
......@@ -34,6 +34,24 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
'Content-Type':'application/json;charset=UTF-8',
},
'body': text
});
}),
context.cloud.httpApi.invoke(
{
'domain':'https://oapi.dingtalk.com',
'path': '/robot/send',
'params': {
'access_token': 'f6d0d8ecdab3ad77dc51b5173f630f1c0e0fcbe90e994d0a642fb0b516dfd24c'
},
'method':'POST',
'headers': {
'Content-Type':'application/json;charset=UTF-8',
},
'body': {
"msgtype": "text",
"at": { "isAtAll": false, "atMobiles": [ phone ], "atUserIds": [] },
"text": { 'content': '云告警'}
}
})
])
return result
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment