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
3a5d86af
Commit
3a5d86af
authored
Nov 06, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
baidu
parent
2d2e7c32
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
150 deletions
+91
-150
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
+71
-47
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+16
-16
center-channel/app/base/utils/baiduClient.js
+3
-86
center-channel/app/config/businessConfig.js
+1
-1
No files found.
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
View file @
3a5d86af
...
@@ -17,42 +17,51 @@ const uappId = {
...
@@ -17,42 +17,51 @@ const uappId = {
'ali'
:
"18"
,
//(阿里icp、edi)
'ali'
:
"18"
,
//(阿里icp、edi)
'baidu'
:
"44"
//(百度icp、edi)
'baidu'
:
"44"
//(百度icp、edi)
}
}
const
city
=
{
//tui song baidu zhuanyong pinyin 2020-11-6
"1"
:
"北京"
,
const
cityLetter
=
{
"2"
:
"上海"
,
"北京"
:
"BEIJING"
,
"3"
:
"福建"
,
"上海"
:
"SHANGHAI"
,
"4"
:
"广西"
,
"福建"
:
"FUJIAN"
,
"5"
:
"广东"
,
"广西"
:
"GUANGXI"
,
"6"
:
"安徽"
,
"广东"
:
"GUANGDONG"
,
"7"
:
"河南"
,
"安徽"
:
"ANHUI"
,
"8"
:
"湖北"
,
"河南"
:
"HENAN"
,
"9"
:
"浙江"
,
"湖北"
:
"HUBEI"
,
"10"
:
"江苏"
,
"浙江"
:
"ZHEJIANG"
,
"11"
:
"山东"
,
"江苏"
:
"JIANGSU"
,
"12"
:
"陕西"
,
"山东"
:
"SHANDONG"
,
"13"
:
"宁夏"
,
"陕西"
:
"SHANXI_SHAN"
,
"14"
:
"甘肃"
,
"宁夏"
:
"NINGXIA"
,
"15"
:
"新疆"
,
"甘肃"
:
"GANSU"
,
"16"
:
"青海"
,
"新疆"
:
"XINJIANG"
,
"17"
:
"天津"
,
"青海"
:
"QINGHAI"
,
"18"
:
"重庆"
,
"天津"
:
"TIANJIN"
,
"19"
:
"河北"
,
"重庆"
:
"CHONGQING"
,
"20"
:
"山西"
,
"河北"
:
"HEBEI"
,
"21"
:
"辽宁"
,
"山西"
:
"SHANXI_JIN"
,
"22"
:
"吉林"
,
"辽宁"
:
"LIAONING"
,
"23"
:
"黑龙江"
,
"吉林"
:
"JILIN"
,
"24"
:
"江西"
,
"黑龙江"
:
"HEILONGJIANG"
,
"25"
:
"湖南"
,
"江西"
:
"JIANGXI"
,
"26"
:
"四川"
,
"湖南"
:
"HUNAN"
,
"27"
:
"贵州"
,
"四川"
:
"SUCHUAN"
,
"28"
:
"云南"
,
"贵州"
:
"GUIZHOU"
,
"29"
:
"内蒙古"
,
"云南"
:
"YUANNAN"
,
"30"
:
"西藏"
,
"内蒙古"
:
"NEIMENGGU"
,
"31"
:
"含外资"
,
"西藏"
:
"XIZANG"
,
"32"
:
"全外资"
,
"外资"
:
"WAIZI"
,
"33"
:
"香港"
,
"海南"
:
"HAINAN"
"34"
:
"海南"
}
}
//baidu pinyinzhuanyong 2020-11-6
const
baiduIcpStatus
=
{
507
:
"REGISTRATION"
,
508
:
"SUBMITTED"
,
509
:
"ACCEPTED"
,
510
:
"NOT_ACCEPTED"
,
511
:
"APPROVED"
,
512
:
"NOT_APPROVED"
};
/**
/**
* 资质信息提报相关接口(ICP\EDI)
* 资质信息提报相关接口(ICP\EDI)
*/
*/
...
@@ -122,6 +131,8 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -122,6 +131,8 @@ class BaseCenterOrderService extends AppServiceBase {
if
(
needinfo
.
uapp_id
==
uappId
.
baidu
){
if
(
needinfo
.
uapp_id
==
uappId
.
baidu
){
//推送数据至baidu
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
// var bizType = needinfo.channelTypeCode;//业务类型里
solution
.
Area
=
cityLetter
[
solution
.
Area
]
console
.
log
(
'solution.Area++'
,
solution
.
Area
)
var
pushObj
=
{
var
pushObj
=
{
requirementId
:
needinfo
.
channelNeedNo
,
requirementId
:
needinfo
.
channelNeedNo
,
companyName
:
solution
.
CompanyName
,
companyName
:
solution
.
CompanyName
,
...
@@ -219,17 +230,17 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -219,17 +230,17 @@ class BaseCenterOrderService extends AppServiceBase {
console
.
log
(
"pushRes++++"
,
pushRes
)
console
.
log
(
"pushRes++++"
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
var
resData
=
pushRes
.
data
;
var
resData
=
pushRes
.
data
;
if
(
resData
.
bizId
)
{
if
(
resData
.
result
)
{
var
reqObj2
=
{
var
reqObj2
=
{
actionType
:
"receiveProgrammeNo"
,
actionType
:
"receiveProgrammeNo"
,
appInfo
:
appInfo
,
appInfo
:
appInfo
,
actionBody
:
{
actionBody
:
{
solutionNo
:
solutionNo
,
solutionNo
:
solutionNo
,
solutionBizId
:
resData
.
bizId
solutionBizId
:
resData
.
result
}
}
};
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
return
system
.
getResultSuccess
()
;
return
pushRes
;
}
}
}
}
}
}
...
@@ -290,9 +301,22 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -290,9 +301,22 @@ class BaseCenterOrderService extends AppServiceBase {
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
//推送数据至百度
//推送数据至百度
var
BizId
=
needsolution
.
channelSolutionNo
;
//⽅案业务ID
var
BizId
=
needsolution
.
orderChannelNo
;
console
.
log
(
'BizId++'
,
BizId
)
var
pushObj
=
{
var
pushObj
=
{
"bizId"
:
BizId
,
"businessLicense"
:
{
"createdAt"
:
material
.
BusinessLicense
.
CreatedAt
,
"enterpriseCode"
:
material
.
BusinessLicense
.
EnterpriseCode
,
"legalRepresentative"
:
material
.
BusinessLicense
.
LegalRepresentative
,
"address"
:
material
.
BusinessLicense
.
Address
,
"registeredCapital"
:
material
.
BusinessLicense
.
RegisteredCapital
,
"name"
:
material
.
BusinessLicense
.
Name
,
"businessTerm"
:
material
.
BusinessLicense
.
BusinessTerm
,
"type"
:
material
.
BusinessLicense
.
Type
,
"scopeBusiness"
:
material
.
BusinessLicense
.
ScopeBusiness
},
"partnerForeignInvestment"
:
material
.
PartnerForeignInvestment
||
""
,
"orderNo"
:
BizId
,
"domain"
:
material
.
Domain
,
"domain"
:
material
.
Domain
,
"corporateName"
:
material
.
CorporateName
,
"corporateName"
:
material
.
CorporateName
,
"includeForeignInvestment"
:
material
.
IncludeForeignInvestment
,
"includeForeignInvestment"
:
material
.
IncludeForeignInvestment
,
...
@@ -301,7 +325,6 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -301,7 +325,6 @@ class BaseCenterOrderService extends AppServiceBase {
"partnerDomainCertificate"
:
material
.
PartnerDomainCertificate
,
"partnerDomainCertificate"
:
material
.
PartnerDomainCertificate
,
"partnerPreviewOtherList"
:
material
.
PartnerPreviewOtherList
||
[],
"partnerPreviewOtherList"
:
material
.
PartnerPreviewOtherList
||
[],
"partnerPlan"
:
material
.
PartnerPlan
||
""
,
"partnerPlan"
:
material
.
PartnerPlan
||
""
,
"partnerForeignInvestment"
:
material
.
PartnerForeignInvestment
||
""
,
"partnerLaw"
:
material
.
PartnerLaw
||
""
,
"partnerLaw"
:
material
.
PartnerLaw
||
""
,
"partnerStampOtherList"
:
material
.
PartnerStampOtherList
||
[],
"partnerStampOtherList"
:
material
.
PartnerStampOtherList
||
[],
"partnerSignOtherList"
:
material
.
PartnerSignOtherList
||
[],
"partnerSignOtherList"
:
material
.
PartnerSignOtherList
||
[],
...
@@ -309,8 +332,8 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -309,8 +332,8 @@ class BaseCenterOrderService extends AppServiceBase {
};
};
var
self
=
this
;
var
self
=
this
;
//推送方案材料
//推送方案材料
var
r
=
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/license/material"
,
reqbody
:
pushObj
});
var
r
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/license/material"
,
reqbody
:
pushObj
});
console
.
log
(
"r++"
,
res
)
console
.
log
(
'rrrr+++++'
,
r
)
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
@@ -332,14 +355,15 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -332,14 +355,15 @@ class BaseCenterOrderService extends AppServiceBase {
}
}
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
res
.
data
.
ApplicationStatus
=
baiduIcpStatus
[
res
.
data
.
ApplicationStatus
];
console
.
log
(
'res.data.channelOrderNo'
,
res
.
data
.
channelOrderNo
)
//推送数据至百度
//推送数据至百度
var
pushObj
=
{
var
pushObj
=
{
bizId
:
res
.
data
.
BizId
,
orderNo
:
res
.
data
.
channelOrderNo
,
officialFileURL
:
res
.
data
.
OfficialFileURL
,
status
:
res
.
data
.
ApplicationStatus
applicationStatus
:
res
.
data
.
ApplicationStatus
};
};
//推送状态变更
//推送状态变更
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/
requirement
/update"
,
reqbody
:
pushObj
});
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/
license
/update"
,
reqbody
:
pushObj
});
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
3a5d86af
...
@@ -499,13 +499,13 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -499,13 +499,13 @@ class UtilsNeedService2 extends AppServiceBase {
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
//2020-10-28 laolan start
//2020-10-28 laolan start
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uappIds
){
if
(
result
&&
result
.
status
==
0
&&
result
.
data
){
if
(
result
.
data
.
uappIds
==
uappId
.
ali
){
if
(
result
.
data
==
uappId
.
aliConfirmResult
){
var
res
=
await
self
.
aliclient
.
reqbyget
({
action
:
"writeCommunicationLog"
,
reqbody
:
{
BizId
:
pobj
.
actionBody
.
intentionBizId
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
var
res
=
await
self
.
aliclient
.
reqbyget
({
action
:
"writeCommunicationLog"
,
reqbody
:
{
BizId
:
pobj
.
actionBody
.
intentionBizId
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"ali+res"
,
res
)
console
.
log
(
"ali+res"
,
res
)
}
}
if
(
result
.
data
.
uappIds
==
uappId
.
baidu
){
if
(
result
.
data
==
uappId
.
baidu
){
var
ress
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication"
,
reqbody
:
{
bizId
:
pobj
.
actionBody
.
intentionBizId
,
note
:
pobj
.
actionBody
.
note
}
});
var
ress
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication"
,
reqbody
:
{
requirementId
:
pobj
.
actionBody
.
intentionBizId
,
content
:
pobj
.
actionBody
.
note
}
});
console
.
log
(
"baidu+res"
,
ress
)
console
.
log
(
"baidu+res"
,
ress
)
}
}
}
}
...
@@ -534,15 +534,16 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -534,15 +534,16 @@ class UtilsNeedService2 extends AppServiceBase {
}
}
async
queryExpertApplyCommunicationLogs
(
pobj
)
{
async
queryExpertApplyCommunicationLogs
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
intentionBizId
)
{
//
if (!pobj.actionBody.intentionBizId) {
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100493"
);
//
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
}
//
}
if
(
!
pobj
.
actionBody
.
userFeedBack
)
{
//
if (!pobj.actionBody.userFeedBack) {
return
system
.
getResult
(
null
,
"actionBody.userFeedBack can not be empty,100494"
);
//
return system.getResult(null, "actionBody.userFeedBack can not be empty,100494");
}
//
}
//2020-10-28 laolan start
//2020-10-28 laolan start
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'jilu+++result++++'
,
result
)
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
){
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
){
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
){
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
){
var
res
=
await
this
.
aliclient
.
reqbyget
({
var
res
=
await
this
.
aliclient
.
reqbyget
({
...
@@ -558,16 +559,15 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -558,16 +559,15 @@ class UtilsNeedService2 extends AppServiceBase {
}
}
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
){
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
){
console
.
log
(
"bbbbb++"
,
pobj
)
var
res
=
await
this
.
baiduclient
.
baiduReqbyget
({
var
res
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/providerommunication/list"
,
reqbody
:
{
path
:
"/api/bla/provider
/c
ommunication/list"
,
reqbody
:
{
beginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
beginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
endTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
endTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
bizId
:
pobj
.
actionBody
.
intentionBizId
,
requirementId
:
pobj
.
actionBody
.
intentionBizId
userFeedBack
:
pobj
.
actionBody
.
userFeedBack
,
pageNum
:
pobj
.
actionBody
.
pageNum
||
1
,
pageSize
:
pobj
.
actionBody
.
pageSize
||
10
,
}
}
});
});
console
.
log
(
'xxcc+++'
,
res
)
}
}
}
}
...
@@ -581,7 +581,7 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -581,7 +581,7 @@ class UtilsNeedService2 extends AppServiceBase {
// var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere);
// var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere);
// }
// }
// func();
// func();
return
system
.
getResultSuccess
(
res
)
;
return
res
;
}
}
/**
/**
...
...
center-channel/app/base/utils/baiduClient.js
View file @
3a5d86af
...
@@ -21,49 +21,31 @@ class baiduClient {
...
@@ -21,49 +21,31 @@ class baiduClient {
let
timestamp
=
new
Date
().
toISOString
()
let
timestamp
=
new
Date
().
toISOString
()
let
site
=
timestamp
.
lastIndexOf
(
"."
);
let
site
=
timestamp
.
lastIndexOf
(
"."
);
timestamp
=
timestamp
.
substring
(
0
,
site
)
+
"Z"
timestamp
=
timestamp
.
substring
(
0
,
site
)
+
"Z"
// let timestamp = "2020-11-05T04:00:00Z"
console
.
log
(
'timestamp++'
,
timestamp
)
let
signedHeaders
=
"host"
;
let
signedHeaders
=
"host"
;
let
extime
=
1800
;
let
extime
=
1800
;
// 因为是post,所以CanonicalQueryString为空
// var signArr = [];
// var keys = Object.keys(actionBody).sort();
// if (keys.length == 0) {
// return system.getResult(null, "请求参数信息为空");
// }
// for (let k = 0; k < keys.length; k++) {
// const tKey = keys[k];
// if (tKey != "sign" && actionBody[tKey] && !(typeof (actionBody[tKey]) === "object")) {
// signArr.push(urlencode(tKey) + "=" + urlencode(actionBody[tKey]));
// }
// }
// let resultSignStr = signArr.join("&");
// console.log('resultSignStr+++',resultSignStr)
let
canonicalHeaders
=
"host:gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
let
canonicalHeaders
=
"host:gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
//中间结果1:规范化请求和前缀字符串
//中间结果1:规范化请求和前缀字符串
let
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
"
\
n"
+
canonicalHeaders
;
let
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
"
\
n"
+
canonicalHeaders
;
console
.
log
(
'canonicalRequest+++'
,
canonicalRequest
)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let
authStringPrefix
=
version
+
"/"
+
accessKey
+
"/"
+
timestamp
+
"/"
+
extime
;
let
authStringPrefix
=
version
+
"/"
+
accessKey
+
"/"
+
timestamp
+
"/"
+
extime
;
console
.
log
(
'authStringPrefix+++'
,
authStringPrefix
)
//中间结果2:派生签名密钥 signingKey
//中间结果2:派生签名密钥 signingKey
let
signingKey
=
crypto
.
createHmac
(
'sha256'
,
secretKey
)
let
signingKey
=
crypto
.
createHmac
(
'sha256'
,
secretKey
)
.
update
(
authStringPrefix
)
.
update
(
authStringPrefix
)
.
digest
(
'hex'
);
.
digest
(
'hex'
);
console
.
log
(
'signingKey+++'
,
signingKey
)
//中间结果3:签名摘要 signature
//中间结果3:签名摘要 signature
let
signature
=
crypto
.
createHmac
(
'sha256'
,
signingKey
)
let
signature
=
crypto
.
createHmac
(
'sha256'
,
signingKey
)
.
update
(
canonicalRequest
)
.
update
(
canonicalRequest
)
.
digest
(
'hex'
);
.
digest
(
'hex'
);
console
.
log
(
'signature+++'
,
signature
)
//最终结果:认证字符串 authorization
//最终结果:认证字符串 authorization
let
authorization
=
authStringPrefix
+
"/"
+
signedHeaders
+
"/"
+
signature
;
let
authorization
=
authStringPrefix
+
"/"
+
signedHeaders
+
"/"
+
signature
;
console
.
log
(
'authorization+++'
,
authorization
)
var
baiduObj
=
{
var
baiduObj
=
{
authorization
:
authorization
,
authorization
:
authorization
,
data
:
actionBody
data
:
actionBody
}
}
var
rtn
=
await
this
.
execClient
.
execBaiduPost
(
baiduObj
,
url
);
var
rtn
=
await
this
.
execClient
.
execBaiduPost
(
baiduObj
,
url
);
console
.
log
(
"baiduObj+++++"
,
baiduObj
)
console
.
log
(
"url+++++"
,
url
)
console
.
log
(
"rtn+++++"
,
rtn
)
if
(
!
rtn
||
!
rtn
.
stdout
)
{
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
}
...
@@ -73,7 +55,6 @@ class baiduClient {
...
@@ -73,7 +55,6 @@ class baiduClient {
//百度接口 2020-10-27 laolan
//百度接口 2020-10-27 laolan
async
baiduReqbyget
(
obj
,
cbk
)
{
async
baiduReqbyget
(
obj
,
cbk
)
{
console
.
log
(
'obj+++'
,
obj
)
var
path
=
obj
.
path
;
var
path
=
obj
.
path
;
var
reqbody
=
obj
.
reqbody
;
var
reqbody
=
obj
.
reqbody
;
try
{
try
{
...
@@ -111,69 +92,5 @@ class baiduClient {
...
@@ -111,69 +92,5 @@ class baiduClient {
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
}
}
async
test
(){
var
obj
=
{
path
:
"/api/bla/provider/plan"
,
reqbody
:{
"area"
:
"北京"
,
"companyName"
:
"demoData"
,
"companyAddress"
:
"demoData"
,
"requirementId"
:
"TRE-nmnHtEoTjeE"
,
"type"
:
"ICP"
}
};
var
actionBody
=
obj
.
reqbody
;
var
path
=
obj
.
path
;
let
domain
=
"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
;
let
url
=
domain
+
path
;
let
version
=
"bce-auth-v1"
;
let
accessKey
=
"ed0f5c4c7c2d4e87aa335d9b07bf9bd4"
;
let
secretKey
=
"f600c4e91f6d43998d637401e6e34ef9"
;
let
timestamp
=
new
Date
().
toISOString
();
let
signedHeaders
=
"host"
;
let
extime
=
1800
;
var
signArr
=
[];
var
keys
=
Object
.
keys
(
actionBody
).
sort
();
if
(
keys
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
actionBody
[
tKey
]
&&
!
(
typeof
(
actionBody
[
tKey
])
===
"object"
))
{
signArr
.
push
(
urlencode
(
tKey
)
+
"="
+
urlencode
(
actionBody
[
tKey
]));
}
}
let
resultSignStr
=
signArr
.
join
(
"&"
);
console
.
log
(
'resultSignStr+++'
,
resultSignStr
)
let
canonicalHeaders
=
"host:gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
//中间结果1:规范化请求和前缀字符串
let
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
resultSignStr
+
"
\
n"
+
canonicalHeaders
;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let
authStringPrefix
=
version
+
"/"
+
accessKey
+
"/"
+
timestamp
+
"/"
+
extime
;
//中间结果2:派生签名密钥 signingKey
let
signingKey
=
crypto
.
createHmac
(
'sha256'
,
secretKey
)
.
update
(
authStringPrefix
)
.
digest
(
'hex'
);
//中间结果3:签名摘要 signature
let
signature
=
crypto
.
createHmac
(
'sha256'
,
signingKey
)
.
update
(
canonicalRequest
)
.
digest
(
'hex'
);
//最终结果:认证字符串 authorization
let
authorization
=
authStringPrefix
+
"/"
+
signedHeaders
+
"/"
+
signature
;
var
baiduObj
=
{
authorization
:
authorization
,
data
:
actionBody
}
var
rtn
=
await
this
.
execClient
.
execBaiduPost
(
baiduObj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
!
result
||
!
result
.
result
){
return
system
.
getResultFail
(
"推送失败"
);
}
return
system
.
getResultSuccess
();
}
}
}
module
.
exports
=
baiduClient
;
module
.
exports
=
baiduClient
;
center-channel/app/config/businessConfig.js
View file @
3a5d86af
...
@@ -18,7 +18,7 @@ module.exports = {
...
@@ -18,7 +18,7 @@ module.exports = {
"foodCloseNeed"
,
"foodRecordLog"
,
"foodRecordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"foodCloseNeed"
,
"foodRecordLog"
,
"foodRecordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
"putUserPwdByMobile"
,
"icpNotifyNew"
],
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
,
"submitIcpProgramme"
,
"serviceProviderSubmitMaterial"
,
"abolishIcpProgramme"
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
,
"submitIcpProgramme"
,
"serviceProviderSubmitMaterial"
,
"abolishIcpProgramme"
,
"serviceProviderNotification"
],
apiSecretPathList
:
[
"/api/icp/consultation/submit"
,
"/api/icp/feedback/submit"
,
"/api/icp/order/notify"
]
apiSecretPathList
:
[
"/api/icp/consultation/submit"
,
"/api/icp/feedback/submit"
,
"/api/icp/order/notify"
]
}
}
}
}
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