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
cdd4fabc
Commit
cdd4fabc
authored
Mar 19, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push2ali
parent
789fc825
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
center-channel/app/base/utils/aliyunClient.js
+31
-8
No files found.
center-channel/app/base/utils/aliyunClient.js
View file @
cdd4fabc
const
Client
=
require
(
'aliyun-api-gateway'
).
Client
;
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
const
system
=
require
(
"../system"
);
class
aliyunClient
{
constructor
()
{
this
.
aliclient
=
new
RPCClient
({
...
...
@@ -9,6 +9,7 @@ class aliyunClient {
endpoint
:
"https://companyreg.aliyuncs.com"
,
apiVersion
:
"2020-03-06"
});
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
}
async
post
(
aliReqUrl
,
key
,
secret
,
actionBody
)
{
const
client
=
new
Client
(
key
,
secret
);
...
...
@@ -28,13 +29,35 @@ class aliyunClient {
async
reqbyget
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
return
this
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'GET'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
try
{
var
res
=
await
this
.
aliclient
.
request
(
action
,
reqbody
,
{
timeout
:
3000
,
// default 3000 ms
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'GET'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
this
.
pushlogSve
.
createDb
({
op
:
"推送阿里信息返回:"
+
action
,
content
:
JSON
.
stringify
(
obj
),
resultInfo
:
JSON
.
stringify
(
res
),
returnType
:
'1'
,
logLevel
:
'1'
,
opTitle
:
"推送阿里信息返回成功"
});
return
system
.
getResultSuccess
(
res
);
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
op
:
"推送阿里信息返回:"
+
action
,
content
:
JSON
.
stringify
(
obj
),
resultInfo
:
JSON
.
stringify
(
e
.
stack
),
returnType
:
'0'
,
logLevel
:
'3'
,
opTitle
:
"推送阿里信息返回异常"
});
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
}
...
...
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