Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
38818e16
Commit
38818e16
authored
Sep 16, 2021
by
qinhaitao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'c_server_ts_perf-phone' into 'c_server_ts_perf'
云告警增加phone See merge request
!46
parents
a38f24a6
65818afe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
package.json
v2.0/package.json
+1
-0
dingTalk.ts
v2.0/src/utils/common/dingTalk.ts
+22
-4
No files found.
v2.0/package.json
View file @
38818e16
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"title"
:
"测试活动"
,
"title"
:
"测试活动"
,
"author"
:
"duiba"
,
"author"
:
"duiba"
,
"phone"
:
"13184232663"
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"sdkVersion"
:
"*"
,
"sdkVersion"
:
"*"
,
"dependencies"
:
{
"dependencies"
:
{
...
...
v2.0/src/utils/common/dingTalk.ts
View file @
38818e16
...
@@ -4,8 +4,7 @@ const configPackage = require('../../../package.json')
...
@@ -4,8 +4,7 @@ const configPackage = require('../../../package.json')
* @param message
* @param message
*/
*/
export
const
cloundAlarm
=
async
(
context
:
IContext
<
IParams
>
,
message
:
string
,
stack
:
string
)
=>
{
export
const
cloundAlarm
=
async
(
context
:
IContext
<
IParams
>
,
message
:
string
,
stack
:
string
)
=>
{
console
.
warn
(
configPackage
)
const
{
title
,
author
,
phone
}
=
configPackage
const
{
title
,
author
}
=
configPackage
const
envTxt
=
{
const
envTxt
=
{
'test'
:
'测试环境'
,
'test'
:
'测试环境'
,
'pre'
:
'预发环境'
,
'pre'
:
'预发环境'
,
...
@@ -22,7 +21,8 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
...
@@ -22,7 +21,8 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
},
},
"at"
:
{
"isAtAll"
:
false
,
"atMobiles"
:
[],
"atUserIds"
:
[]
}
"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'
,
'domain'
:
'https://oapi.dingtalk.com'
,
'path'
:
'/robot/send'
,
'path'
:
'/robot/send'
,
...
@@ -34,6 +34,24 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
...
@@ -34,6 +34,24 @@ export const cloundAlarm = async (context: IContext<IParams>, message: string, s
'Content-Type'
:
'application/json;charset=UTF-8'
,
'Content-Type'
:
'application/json;charset=UTF-8'
,
},
},
'body'
:
text
'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
return
result
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment