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
d9be0933
Commit
d9be0933
authored
Jun 01, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
3678af0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
68 deletions
+77
-68
center-channel/app/base/service/app.base.js
+28
-28
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
+16
-10
center-channel/app/base/utils/aliyunClient.js
+33
-30
No files found.
center-channel/app/base/service/app.base.js
View file @
d9be0933
...
...
@@ -156,34 +156,34 @@ class AppServiceBase {
return
system
.
getResult
(
null
,
errorMsg
);
}
}
/**
* 阿里RPC调用-post请求
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async
opAliyunRpcReqByPost
(
pobj
,
params
)
{
try
{
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var
aliyunClient
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
await
aliyunClient
.
reqCustomByPost
(
params
);
return
rtn
;
}
catch
(
e
)
{
var
errorMsg
=
"error:"
+
e
.
stack
;
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost"
,
content
:
errorMsg
,
// clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常->opAliyunRpcReqByPost"
,
});
return
system
.
getResult
(
null
,
errorMsg
);
}
}
/
/ /
**
//
* 阿里RPC调用-post请求
//
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
//
* @param {*} params {为阿里的接口参数}
//
*/
//
async opAliyunRpcReqByPost(pobj, params) {
//
try {
//
// var action = obj.action;
//
// var reqbody = obj.reqbody;
//
// var rpcParam = obj.rpcParam;
//
var aliyunClient = system.getObject("util.aliyunClient");
//
var rtn = await aliyunClient.reqCustomByPost(params);
//
return rtn;
//
} catch (e) {
//
var errorMsg = "error:" + e.stack;
//
//日志记录
//
this.logCtl.error({
//
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
//
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
//
requestId: pobj.requestId || "",
//
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
//
content: errorMsg,
//
// clientIp: pobj.clientIp,
//
optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
//
});
//
return system.getResult(null, errorMsg);
//
}
//
}
/**
* 处理成功后的信息
* @param {*} pobj
...
...
center-channel/app/base/service/impl/utilsSve/utilsTmAliyunSve.js
View file @
d9be0933
...
...
@@ -657,18 +657,24 @@ class UtilsTmAliyunService extends AppServiceBase {
self
.
disposePushResultFail
(
pobj
,
getDingTmStatusResult
,
"ali->opAliTmUpdateTask->getDingTmStatusResult"
,
self
.
pushlogFailType
.
FAILLOG
);
break
;
}
if
(
getDingTmStatusResult
.
data
.
TrademarkApplications
.
TrademarkApplication
[
0
].
Note
)
{
var
opNoteInfo
=
JSON
.
parse
(
getDingTmStatusResult
.
data
.
TrademarkApplications
.
TrademarkApplication
[
0
].
Note
);
if
(
opNoteInfo
.
txt
)
{
var
txtList
=
opNoteInfo
.
txt
.
split
(
'
\
n'
);
var
txtStr
=
""
;
for
(
let
l
=
0
;
l
<
txtList
.
length
;
l
++
)
{
const
temptxtStr
=
txtList
[
l
];
if
(
temptxtStr
)
{
txtStr
=
txtStr
+
temptxtStr
;
var
noteStr
=
getDingTmStatusResult
.
data
.
TrademarkApplications
.
TrademarkApplication
[
0
].
Note
;
if
(
noteStr
)
{
if
(
noteStr
.
lastIndexOf
(
'}'
)
<
0
)
{
element
.
deliveryContent
.
tm
[
i
].
Note
=
noteStr
;
}
else
{
var
opNoteInfo
=
JSON
.
parse
(
noteStr
);
if
(
opNoteInfo
.
txt
)
{
var
txtList
=
opNoteInfo
.
txt
.
split
(
'
\
n'
);
var
txtStr
=
""
;
for
(
let
l
=
0
;
l
<
txtList
.
length
;
l
++
)
{
const
temptxtStr
=
txtList
[
l
];
if
(
temptxtStr
)
{
txtStr
=
txtStr
+
temptxtStr
;
}
}
element
.
deliveryContent
.
tm
[
i
].
Note
=
txtStr
;
}
element
.
deliveryContent
.
tm
[
i
].
Note
=
txtStr
;
}
}
element
.
deliveryContent
.
tm
[
i
].
BizId
=
getDingTmStatusResult
.
data
.
TrademarkApplications
.
TrademarkApplication
[
0
].
BizId
;
...
...
center-channel/app/base/utils/aliyunClient.js
View file @
d9be0933
...
...
@@ -3,13 +3,16 @@ var RPCClient = require('@alicloud/pop-core').RPCClient;
const
system
=
require
(
"../system"
);
class
aliyunClient
{
constructor
()
{
this
.
aliclient
=
new
RPCClient
({
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
}
getAliClient
()
{
return
new
RPCClient
({
accessKeyId
:
"LTAI1pJs7KQizBe2"
,
//对应的aliuid 是 30039057
accessKeySecret
:
"MMNibebAPqR9AnX5YWHnSL2tHMSIoL"
,
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
);
...
...
@@ -30,7 +33,7 @@ class aliyunClient {
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
try
{
var
reqAliclient
=
{
...
this
.
aliclient
};
var
reqAliclient
=
this
.
getAliClient
();
//
{ ... this.aliclient };
if
(
obj
.
apiVersion
)
{
reqAliclient
.
apiVersion
=
obj
.
apiVersion
;
}
...
...
@@ -70,7 +73,7 @@ class aliyunClient {
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
var
rpcParam
=
obj
.
rpcParam
;
var
reqAliclient
=
{
...
this
.
aliclient
};
var
reqAliclient
=
this
.
getAliClient
();
// { ...self
.aliclient };
if
(
rpcParam
.
accessKeyId
)
{
reqAliclient
.
accessKeyId
=
rpcParam
.
accessKeyId
;
}
...
...
@@ -94,31 +97,31 @@ class aliyunClient {
console
.
log
(
reqbody
,
"reqbody..........."
);
return
system
.
getResultSuccess
(
res
);
}
async
reqCustomByPost
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
var
rpcParam
=
obj
.
rpcParam
;
var
reqAliclient
=
{
...
this
.
aliclient
};
if
(
rpcParam
.
accessKeyId
)
{
reqAliclient
.
accessKeyId
=
rpcParam
.
accessKeyId
;
}
if
(
rpcParam
.
accessKeySecret
)
{
reqAliclient
.
accessKeySecret
=
rpcParam
.
accessKeySecret
;
}
if
(
rpcParam
.
endpoint
)
{
reqAliclient
.
endpoint
=
rpcParam
.
endpoint
;
}
if
(
rpcParam
.
apiVersion
)
{
reqAliclient
.
apiVersion
=
rpcParam
.
apiVersion
;
}
var
res
=
await
reqAliclient
.
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
:
'POST'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
return
system
.
getResultSuccess
(
res
);
}
//
async reqCustomByPost(obj, cbk) {
//
var action = obj.action;
//
var reqbody = obj.reqbody;
//
var rpcParam = obj.rpcParam;
//
var reqAliclient = { ... this.aliclient };
//
if (rpcParam.accessKeyId) {
//
reqAliclient.accessKeyId = rpcParam.accessKeyId;
//
}
//
if (rpcParam.accessKeySecret) {
//
reqAliclient.accessKeySecret = rpcParam.accessKeySecret;
//
}
//
if (rpcParam.endpoint) {
//
reqAliclient.endpoint = rpcParam.endpoint;
//
}
//
if (rpcParam.apiVersion) {
//
reqAliclient.apiVersion = rpcParam.apiVersion;
//
}
//
var res = await reqAliclient.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: 'POST', // set the http method, default is GET
//
headers: {}, // set the http request headers
//
});
//
return system.getResultSuccess(res);
//
}
}
module
.
exports
=
aliyunClient
;
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