Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
e09a889c
Commit
e09a889c
authored
Sep 26, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-channel' of
http://gitlab.gongsibao.com/jiangyong/zhichan
into center-channel
parents
03c22fdf
a9aecfcd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
center-channel/app/base/utils/execClient.js
+11
-8
No files found.
center-channel/app/base/utils/execClient.js
View file @
e09a889c
...
...
@@ -9,7 +9,7 @@ class ExecClient {
this
.
cmdPushDataPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
this
.
cmdFeishuGetPattern
=
"curl -X GET -k -H 'Content-Type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url} "
;
this
.
cmdFeishuPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}"
;
}
getUUID
()
{
var
uuid
=
uuidv4
();
...
...
@@ -17,7 +17,7 @@ class ExecClient {
return
u
;
}
async
exec
(
cmd
)
{
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//await后面表达式返回的promise对象,
是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
);
return
{
stdout
,
stderr
};
...
...
@@ -38,7 +38,7 @@ class ExecClient {
FetchFeishuPostCmd
(
subData
,
url
)
{
var
data
=
JSON
.
stringify
(
subData
);
var
cmd
=
this
.
cmdFeishuPostPattern
.
replace
(
/
\{
data
\}
/g
,
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
token
);
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
token
);
console
.
log
(
cmd
);
return
cmd
;
}
...
...
@@ -62,7 +62,10 @@ class ExecClient {
}
async
execPushDataPost
(
subData
,
url
,
token
,
requestId
)
{
let
cmd
=
this
.
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
);
var
result
=
await
this
.
exec
(
cmd
);
var
options
=
{
maxBuffer
:
1024
*
1024
*
20
};
var
result
=
await
this
.
exec
(
cmd
,
options
);
return
result
;
}
async
execPost2
(
subData
,
url
)
{
...
...
@@ -78,7 +81,7 @@ class ExecClient {
return
cmd
;
}
FetchFqGetCmd
(
subData
,
url
)
{
var
cmd
=
this
.
cmdFeishuGetPattern
.
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
Authorization
);
var
cmd
=
this
.
cmdFeishuGetPattern
.
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
Authorization
);
console
.
log
(
cmd
);
return
cmd
;
}
...
...
@@ -86,7 +89,7 @@ class ExecClient {
//飞书小程序GET请求
FetchFeishuGetCmd
(
subData
,
url
)
{
var
cmd
=
this
.
cmdFeishuGetPattern
.
replace
(
/
\{
data
\}
/g
,
subData
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
user_access_token
);
/
\{
data
\}
/g
,
subData
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
"Bearer "
+
subData
.
user_access_token
);
console
.
log
(
cmd
);
return
cmd
;
}
...
...
@@ -103,8 +106,8 @@ class ExecClient {
return
result
;
}
async
execFqGet
(
subData
,
url
)
{
let
cmd
=
this
.
FetchFqGetCmd
(
subData
,
url
);
async
execFqGet
(
subData
,
url
)
{
let
cmd
=
this
.
FetchFqGetCmd
(
subData
,
url
);
console
.
log
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
...
...
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