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
40b40292
Commit
40b40292
authored
Nov 07, 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
d0159cc4
3c1e4e62
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
287 additions
and
345 deletions
+287
-345
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
+71
-47
center-channel/app/base/service/impl/common/qcCenterOrderSve.js
+192
-192
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+16
-16
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+4
-3
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 @
40b40292
...
...
@@ -17,42 +17,51 @@ const uappId = {
'ali'
:
"18"
,
//(阿里icp、edi)
'baidu'
:
"44"
//(百度icp、edi)
}
const
city
=
{
"1"
:
"北京"
,
"2"
:
"上海"
,
"3"
:
"福建"
,
"4"
:
"广西"
,
"5"
:
"广东"
,
"6"
:
"安徽"
,
"7"
:
"河南"
,
"8"
:
"湖北"
,
"9"
:
"浙江"
,
"10"
:
"江苏"
,
"11"
:
"山东"
,
"12"
:
"陕西"
,
"13"
:
"宁夏"
,
"14"
:
"甘肃"
,
"15"
:
"新疆"
,
"16"
:
"青海"
,
"17"
:
"天津"
,
"18"
:
"重庆"
,
"19"
:
"河北"
,
"20"
:
"山西"
,
"21"
:
"辽宁"
,
"22"
:
"吉林"
,
"23"
:
"黑龙江"
,
"24"
:
"江西"
,
"25"
:
"湖南"
,
"26"
:
"四川"
,
"27"
:
"贵州"
,
"28"
:
"云南"
,
"29"
:
"内蒙古"
,
"30"
:
"西藏"
,
"31"
:
"含外资"
,
"32"
:
"全外资"
,
"33"
:
"香港"
,
"34"
:
"海南"
//tui song baidu zhuanyong pinyin 2020-11-6
const
cityLetter
=
{
"北京"
:
"BEIJING"
,
"上海"
:
"SHANGHAI"
,
"福建"
:
"FUJIAN"
,
"广西"
:
"GUANGXI"
,
"广东"
:
"GUANGDONG"
,
"安徽"
:
"ANHUI"
,
"河南"
:
"HENAN"
,
"湖北"
:
"HUBEI"
,
"浙江"
:
"ZHEJIANG"
,
"江苏"
:
"JIANGSU"
,
"山东"
:
"SHANDONG"
,
"陕西"
:
"SHANXI_SHAN"
,
"宁夏"
:
"NINGXIA"
,
"甘肃"
:
"GANSU"
,
"新疆"
:
"XINJIANG"
,
"青海"
:
"QINGHAI"
,
"天津"
:
"TIANJIN"
,
"重庆"
:
"CHONGQING"
,
"河北"
:
"HEBEI"
,
"山西"
:
"SHANXI_JIN"
,
"辽宁"
:
"LIAONING"
,
"吉林"
:
"JILIN"
,
"黑龙江"
:
"HEILONGJIANG"
,
"江西"
:
"JIANGXI"
,
"湖南"
:
"HUNAN"
,
"四川"
:
"SUCHUAN"
,
"贵州"
:
"GUIZHOU"
,
"云南"
:
"YUANNAN"
,
"内蒙古"
:
"NEIMENGGU"
,
"西藏"
:
"XIZANG"
,
"外资"
:
"WAIZI"
,
"海南"
:
"HAINAN"
}
//baidu pinyinzhuanyong 2020-11-6
const
baiduIcpStatus
=
{
507
:
"REGISTRATION"
,
508
:
"SUBMITTED"
,
509
:
"ACCEPTED"
,
510
:
"NOT_ACCEPTED"
,
511
:
"APPROVED"
,
512
:
"NOT_APPROVED"
};
/**
* 资质信息提报相关接口(ICP\EDI)
*/
...
...
@@ -122,6 +131,8 @@ class BaseCenterOrderService extends AppServiceBase {
if
(
needinfo
.
uapp_id
==
uappId
.
baidu
){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution
.
Area
=
cityLetter
[
solution
.
Area
]
console
.
log
(
'solution.Area++'
,
solution
.
Area
)
var
pushObj
=
{
requirementId
:
needinfo
.
channelNeedNo
,
companyName
:
solution
.
CompanyName
,
...
...
@@ -219,17 +230,17 @@ class BaseCenterOrderService extends AppServiceBase {
console
.
log
(
"pushRes++++"
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
var
resData
=
pushRes
.
data
;
if
(
resData
.
bizId
)
{
if
(
resData
.
result
)
{
var
reqObj2
=
{
actionType
:
"receiveProgrammeNo"
,
appInfo
:
appInfo
,
actionBody
:
{
solutionNo
:
solutionNo
,
solutionBizId
:
resData
.
bizId
solutionBizId
:
resData
.
result
}
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
return
system
.
getResultSuccess
()
;
return
pushRes
;
}
}
}
...
...
@@ -290,9 +301,22 @@ class BaseCenterOrderService extends AppServiceBase {
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
//推送数据至百度
var
BizId
=
needsolution
.
channelSolutionNo
;
//⽅案业务ID
var
BizId
=
needsolution
.
orderChannelNo
;
console
.
log
(
'BizId++'
,
BizId
)
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
,
"corporateName"
:
material
.
CorporateName
,
"includeForeignInvestment"
:
material
.
IncludeForeignInvestment
,
...
...
@@ -301,7 +325,6 @@ class BaseCenterOrderService extends AppServiceBase {
"partnerDomainCertificate"
:
material
.
PartnerDomainCertificate
,
"partnerPreviewOtherList"
:
material
.
PartnerPreviewOtherList
||
[],
"partnerPlan"
:
material
.
PartnerPlan
||
""
,
"partnerForeignInvestment"
:
material
.
PartnerForeignInvestment
||
""
,
"partnerLaw"
:
material
.
PartnerLaw
||
""
,
"partnerStampOtherList"
:
material
.
PartnerStampOtherList
||
[],
"partnerSignOtherList"
:
material
.
PartnerSignOtherList
||
[],
...
...
@@ -309,8 +332,8 @@ class BaseCenterOrderService extends AppServiceBase {
};
var
self
=
this
;
//推送方案材料
var
r
=
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/license/material"
,
reqbody
:
pushObj
});
console
.
log
(
"r++"
,
res
)
var
r
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/license/material"
,
reqbody
:
pushObj
});
console
.
log
(
'rrrr+++++'
,
r
)
}
return
system
.
getResultSuccess
();
}
...
...
@@ -332,14 +355,15 @@ class BaseCenterOrderService extends AppServiceBase {
}
if
(
res
.
data
.
uapp_id
==
uappId
.
baidu
){
res
.
data
.
ApplicationStatus
=
baiduIcpStatus
[
res
.
data
.
ApplicationStatus
];
console
.
log
(
'res.data.channelOrderNo'
,
res
.
data
.
channelOrderNo
)
//推送数据至百度
var
pushObj
=
{
bizId
:
res
.
data
.
BizId
,
officialFileURL
:
res
.
data
.
OfficialFileURL
,
applicationStatus
:
res
.
data
.
ApplicationStatus
orderNo
:
res
.
data
.
channelOrderNo
,
status
:
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
();
}
...
...
center-channel/app/base/service/impl/common/qcCenterOrderSve.js
View file @
40b40292
...
...
@@ -27,7 +27,7 @@ class QcCenterOrderService extends AppServiceBase {
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
utilsTmAliyunSve
=
system
.
getObject
(
"service.utilsSve.utilsTmAliyunSve"
);
//测试用
this
.
opPushQueueUrl
=
settings
.
opPushQueueUrl
();
};
//调用center-order
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
...
...
@@ -60,8 +60,8 @@ class QcCenterOrderService extends AppServiceBase {
IntentionBizId
:
needinfo
.
channelNeedNo
,
CompanyName
:
solution
.
CompanyName
,
IcpType
:
solution
.
IcpType
,
CompanyAddress
:
solution
.
CompanyAddress
,
Area
:
solution
.
Area
,
Note
:
solution
.
Note
,
ActionType
:
solution
.
actionType
,
Source
:
"官网"
ActionType
:
solution
.
actionType
,
Source
:
"官网"
};
if
(
needsolution
.
channelSolutionNo
)
{
pushObj
[
"BizId"
]
=
needsolution
.
channelSolutionNo
;
...
...
@@ -196,7 +196,7 @@ class QcCenterOrderService extends AppServiceBase {
};
var
self
=
this
;
//推送方案材料
if
(
pobj
.
appInfo
.
uapp_id
==
18
)
{
if
(
pobj
.
appInfo
.
uapp_id
==
18
)
{
self
.
aliclient
.
reqbyget
({
action
:
"SavePartnerSubmitMaterial"
,
reqbody
:
pushObj
,
apiVersion
:
"2019-05-08"
});
}
return
system
.
getResultSuccess
();
...
...
@@ -210,20 +210,20 @@ class QcCenterOrderService extends AppServiceBase {
pobj
.
actionType
=
"getOrderByOrderNo"
;
let
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
let
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
orderResult
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
1
,
'查询订单失败'
)
if
(
orderResult
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
1
,
'查询订单失败'
)
}
let
uapp_id
=
orderResult
.
data
.
uapp_id
;
pobj
.
appInfo
=
{
uapp_id
:
uapp_id
};
pobj
.
appInfo
=
{
uapp_id
:
uapp_id
};
pobj
.
actionType
=
"getAppInterface"
;
var
reqUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
productItemInterfaceResult
.
status
!=
0
)
{
system
.
getResultFail
(
-
1
,
'获取接口参数失败'
)
if
(
productItemInterfaceResult
.
status
!=
0
)
{
system
.
getResultFail
(
-
1
,
'获取接口参数失败'
)
}
pobj
.
interface_info
=
productItemInterfaceResult
.
data
;
pobj
.
pushObj
=
res
.
data
;
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
'pushStatus'
,
1
);
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
'pushStatus'
,
1
);
//推送数据至阿里
// var pushObj = {
// BizId: res.data.BizId,
...
...
@@ -253,7 +253,7 @@ class QcCenterOrderService extends AppServiceBase {
return
res
;
}
// ----------- 文网文 -----------
// ----------- 文网文 -----------
//服务商提交服务操作(文网文)2020-9-26
async
serviceSubmitOption
(
pobj
)
{
...
...
@@ -265,12 +265,12 @@ class QcCenterOrderService extends AppServiceBase {
BizId
:
pobj
.
actionBody
.
orderNo
,
BizType
:
pobj
.
actionBody
.
channelType
,
OperateType
:
wangwenStatusDisct
[
resStatus
],
ExtInfo
:
pobj
.
actionBody
.
extInfo
ExtInfo
:
pobj
.
actionBody
.
extInfo
};
console
.
log
(
"fuwu++++pushObj"
,
pushObj
);
console
.
log
(
"fuwu++++pushObj"
,
pushObj
);
//推送状态变更
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"OperateProduceForPartner"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'ttttssss'
,
r
)
console
.
log
(
'ttttssss'
,
r
)
return
system
.
getResultSuccess
();
}
return
res
;
...
...
@@ -278,10 +278,10 @@ class QcCenterOrderService extends AppServiceBase {
//提交方案(文网文)2020-9-27
async
submitWangwenSolution
(
pobj
)
{
console
.
log
(
'文网文提交方案'
,
pobj
)
console
.
log
(
'文网文提交方案'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
console
.
log
(
'www'
,
res
.
data
.
needsolution
.
solutionContent
);
console
.
log
(
'www'
,
res
.
data
.
needsolution
.
solutionContent
);
var
solution
=
res
.
data
.
needsolution
.
solutionContent
;
var
needsolution
=
res
.
data
.
needsolution
;
//方案信息
solution
=
JSON
.
parse
(
solution
);
...
...
@@ -316,8 +316,8 @@ class QcCenterOrderService extends AppServiceBase {
// solution: res.data.needsolution.solutionContent
solution
:
solution
};
console
.
log
(
"wangwen"
,
pushObj
);
console
.
log
(
"wangwen"
,
pushObj
);
this
.
pushSubmitSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
return
system
.
getResultSuccess
();
}
...
...
@@ -329,7 +329,7 @@ class QcCenterOrderService extends AppServiceBase {
async
pushSubmitSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
//推送状态变更
var
pushRes
=
await
this
.
aliclient
.
reqbyget
({
action
:
"SubmitSolution"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'wangwen++++pushRespushRes'
,
pushRes
)
console
.
log
(
'wangwen++++pushRespushRes'
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
var
resData
=
pushRes
.
data
;
var
reqObj2
=
{
...
...
@@ -359,7 +359,7 @@ class QcCenterOrderService extends AppServiceBase {
pobj
.
actionType
=
"abolishIcpProgrammeByNeed"
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'www+++result'
,
result
)
console
.
log
(
'www+++result'
,
result
)
if
(
result
.
status
==
0
)
{
if
(
result
.
data
)
{
pobj
.
actionBody
.
orderNo
=
result
.
data
;
...
...
@@ -390,8 +390,8 @@ class QcCenterOrderService extends AppServiceBase {
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
// 推送ali
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntentionForPartner"
,
reqbody
:
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
BizType
:
"esp.wangwen"
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2020-03-06"
});
console
.
log
(
'alalallala'
,
a
)
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntentionForPartner"
,
reqbody
:
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
BizType
:
"esp.wangwen"
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2020-03-06"
});
console
.
log
(
'alalallala'
,
a
)
// 2020 1021 lin 新增查看日志
self
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
...
...
@@ -411,7 +411,7 @@ class QcCenterOrderService extends AppServiceBase {
//提交沟通记录
async
recordLog
(
pobj
)
{
console
.
log
(
'提交沟通记录pobj'
,
pobj
)
console
.
log
(
'提交沟通记录pobj'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100491"
);
...
...
@@ -422,7 +422,7 @@ class QcCenterOrderService extends AppServiceBase {
var
self
=
this
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'www+提交沟通记录result'
,
result
)
console
.
log
(
'www+提交沟通记录result'
,
result
)
//推送交付系统
var
reqParams
=
{
actionBody
:
{
...
...
@@ -441,7 +441,7 @@ class QcCenterOrderService extends AppServiceBase {
//提交沟通记录
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIntentionNote"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'www+提交沟通记录r'
,
r
)
console
.
log
(
'www+提交沟通记录r'
,
r
)
return
system
.
getResultSuccess
();
}
...
...
@@ -459,10 +459,10 @@ class QcCenterOrderService extends AppServiceBase {
PageSize
:
pobj
.
actionBody
.
pageSize
||
10
,
},
apiVersion
:
"2020-03-06"
});
console
.
log
(
'loglist-----'
,
res
)
if
(
res
&&
res
.
data
&&
res
.
data
.
Data
)
{
console
.
log
(
'loglist-----'
,
res
)
if
(
res
&&
res
.
data
&&
res
.
data
.
Data
)
{
var
len
=
res
.
data
.
Data
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
res
.
data
.
Data
[
i
].
CreateTime
=
res
.
data
.
Data
[
i
].
CreateTime
/
1000
}
}
...
...
@@ -470,40 +470,40 @@ class QcCenterOrderService extends AppServiceBase {
}
// ----------- 食品 -----------
// ----------- 食品 -----------
//服务商提交服务操作
async
foodServiceSubmitOption
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
//推送数据至阿里
var
resStatus
=
res
.
data
.
ApplicationStatus
;
var
pushObj
=
{
BizId
:
pobj
.
actionBody
.
orderNo
,
BizType
:
pobj
.
actionBody
.
channelTpye
,
OperateType
:
wangwenStatusDisct
[
resStatus
],
ExtInfo
:
pobj
.
actionBody
.
extInfo
};
//推送状态变更
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"OperateProduceForPartner"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'ttttssss'
,
r
)
return
system
.
getResultSuccess
();
//服务商提交服务操作
async
foodServiceSubmitOption
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
//推送数据至阿里
var
resStatus
=
res
.
data
.
ApplicationStatus
;
var
pushObj
=
{
BizId
:
pobj
.
actionBody
.
orderNo
,
BizType
:
pobj
.
actionBody
.
channelTpye
,
OperateType
:
wangwenStatusDisct
[
resStatus
],
ExtInfo
:
pobj
.
actionBody
.
extInfo
};
//推送状态变更
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"OperateProduceForPartner"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'ttttssss'
,
r
)
return
system
.
getResultSuccess
();
}
return
res
;
}
return
res
;
}
//提交方案
async
submitFoodSolution
(
pobj
)
{
console
.
log
(
'food+++pobj'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
console
.
log
(
'food+++res'
,
res
)
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
console
.
log
(
'food'
,
res
.
data
.
needsolution
.
solutionContent
);
var
solution
=
res
.
data
.
needsolution
.
solutionContent
;
var
needsolution
=
res
.
data
.
needsolution
;
//方案信息
solution
=
JSON
.
parse
(
solution
);
solution
=
solution
.
solution
solution
=
JSON
.
stringify
(
solution
)
//提交方案
async
submitFoodSolution
(
pobj
)
{
console
.
log
(
'food+++pobj'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
console
.
log
(
'food+++res'
,
res
)
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
console
.
log
(
'food'
,
res
.
data
.
needsolution
.
solutionContent
);
var
solution
=
res
.
data
.
needsolution
.
solutionContent
;
var
needsolution
=
res
.
data
.
needsolution
;
//方案信息
solution
=
JSON
.
parse
(
solution
);
solution
=
solution
.
solution
solution
=
JSON
.
stringify
(
solution
)
//推送交付系统
var
reqParams
=
{
...
...
@@ -526,142 +526,142 @@ async submitFoodSolution(pobj) {
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
//推送数据至阿里
var
pushObj
=
{
intentionBizId
:
res
.
data
.
needinfo
.
channelNeedNo
,
bizType
:
res
.
data
.
needinfo
.
channelTypeCode
,
// solution: res.data.needsolution.solutionContent
solution
:
solution
};
console
.
log
(
"food"
,
pushObj
);
this
.
pushSubmitSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
return
system
.
getResultSuccess
();
//推送数据至阿里
var
pushObj
=
{
intentionBizId
:
res
.
data
.
needinfo
.
channelNeedNo
,
bizType
:
res
.
data
.
needinfo
.
channelTypeCode
,
// solution: res.data.needsolution.solutionContent
solution
:
solution
};
console
.
log
(
"food"
,
pushObj
);
this
.
pushSubmitSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
return
system
.
getResultSuccess
();
}
return
res
;
}
return
res
;
}
//关闭需求
async
foodCloseNeed
(
pobj
)
{
//关闭需求
async
foodCloseNeed
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100395"
);
}
if
(
!
pobj
.
actionBody
.
note
)
{
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100395"
);
}
var
self
=
this
;
pobj
.
actionBody
.
intentionBizId
=
pobj
.
actionBody
.
needNo
;
pobj
.
actionType
=
"abolishIcpProgrammeByNeed"
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'food+++result'
,
result
)
if
(
result
.
status
==
0
)
{
if
(
result
.
data
)
{
pobj
.
actionBody
.
orderNo
=
result
.
data
;
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
<
0
)
{
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100395"
);
}
if
(
!
pobj
.
actionBody
.
note
)
{
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100395"
);
}
var
self
=
this
;
pobj
.
actionBody
.
intentionBizId
=
pobj
.
actionBody
.
needNo
;
pobj
.
actionType
=
"abolishIcpProgrammeByNeed"
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'food+++result'
,
result
)
if
(
result
.
status
==
0
)
{
if
(
result
.
data
)
{
pobj
.
actionBody
.
orderNo
=
result
.
data
;
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
<
0
)
{
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
}
}
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
needNo
,
status
:
"closeNeed"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
}
var
self
=
this
;
self
.
utilsPushSve
.
aliBusiness2Delivery
(
reqParams
,
"updateChanceStatus"
);
//日志记录
self
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/qcCenterOrderSve.js/foodCloseNeed"
,
content
:
JSON
.
stringify
(
reqParams
),
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
// 推送ali
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntentionForPartner"
,
reqbody
:
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
BizType
:
"esp.wangwen"
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2020-03-06"
});
self
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseFoodNeed"
);
return
system
.
getResultSuccess
();
}
else
{
return
system
.
getResult
(
null
,
"close fail 100389 "
);
}
}
//提交沟通记录
async
foodRecordLog
(
pobj
)
{
console
.
log
(
'提交沟通记录pobj'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100491"
);
}
if
(
!
pobj
.
actionBody
.
note
)
{
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100492"
);
}
var
self
=
this
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'提交沟通记录result'
,
result
)
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
needNo
,
status
:
"
closeNeed
"
status
:
"
followingUp
"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
}
var
self
=
this
;
self
.
utilsPushSve
.
aliBusiness2Delivery
(
reqParams
,
"updateChanceStatus"
);
//日志记录
self
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/qcCenterOrderSve.js/foodCloseNeed"
,
content
:
JSON
.
stringify
(
reqParams
),
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
// 推送ali
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntentionForPartner"
,
reqbody
:
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
BizType
:
"esp.wangwen"
,
Note
:
pobj
.
actionBody
.
note
},
apiVersion
:
"2020-03-06"
});
self
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseFoodNeed"
);
return
system
.
getResultSuccess
();
}
else
{
return
system
.
getResult
(
null
,
"close fail 100389 "
);
}
}
//推送数据至阿里
var
pushObj
=
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
note
:
pobj
.
actionBody
.
note
};
//提交沟通记录
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIntentionNote"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
//提交沟通记录
async
foodRecordLog
(
pobj
)
{
console
.
log
(
'提交沟通记录pobj'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/qcapi/springBoard"
);
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100491"
);
}
if
(
!
pobj
.
actionBody
.
note
)
{
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100492"
);
}
var
self
=
this
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/qcapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'提交沟通记录result'
,
result
)
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
needNo
,
status
:
"followingUp"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
console
.
log
(
'提交沟通记录r'
,
r
)
return
system
.
getResultSuccess
();
}
self
.
utilsPushSve
.
aliBusiness2Delivery
(
reqParams
,
"updateChanceStatus"
);
//推送数据至阿里
var
pushObj
=
{
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
note
:
pobj
.
actionBody
.
note
};
//提交沟通记录
var
r
=
await
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIntentionNote"
,
reqbody
:
pushObj
,
apiVersion
:
"2020-03-06"
});
console
.
log
(
'提交沟通记录r'
,
r
)
return
system
.
getResultSuccess
();
}
//查看沟通记录
async
foodRecordLogList
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100493"
);
}
let
res
=
await
this
.
aliclient
.
reqbyget
({
action
:
"ListIntentionNote"
,
reqbody
:
{
BeginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
EndTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
PageNum
:
pobj
.
actionBody
.
pageNum
||
1
,
PageSize
:
pobj
.
actionBody
.
pageSize
||
10
,
},
apiVersion
:
"2020-03-06"
});
if
(
res
&&
res
.
data
&&
res
.
data
.
Data
){
var
len
=
res
.
data
.
Data
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
){
res
.
data
.
Data
[
i
].
CreateTime
=
res
.
data
.
Data
[
i
].
CreateTime
/
1000
//查看沟通记录
async
foodRecordLogList
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100493"
);
}
let
res
=
await
this
.
aliclient
.
reqbyget
({
action
:
"ListIntentionNote"
,
reqbody
:
{
BeginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
EndTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
IntentionBizId
:
pobj
.
actionBody
.
needNo
,
PageNum
:
pobj
.
actionBody
.
pageNum
||
1
,
PageSize
:
pobj
.
actionBody
.
pageSize
||
10
,
},
apiVersion
:
"2020-03-06"
});
if
(
res
&&
res
.
data
&&
res
.
data
.
Data
)
{
var
len
=
res
.
data
.
Data
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
res
.
data
.
Data
[
i
].
CreateTime
=
res
.
data
.
Data
[
i
].
CreateTime
/
1000
}
}
return
system
.
getResultSuccess
(
res
);
}
return
system
.
getResultSuccess
(
res
);
}
//推送订单状态
async
pushOrderStatus
(
pobj
){
async
pushOrderStatus
(
pobj
)
{
if
(
!
pobj
.
interface_params
)
{
return
system
.
getResult
(
null
,
"interface_params can not be empty,100400"
);
}
let
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
action
||
interface_params_info
.
apiVersion
)
{
return
system
.
getResult
(
null
,
"interface_params(action、apiVersion) can not be empty,100430"
);
if
(
!
interface_params_info
||
!
interface_params_info
.
action
||
!
interface_params_info
.
apiVersion
)
{
return
system
.
getResult
(
null
,
"interface_params(action、apiVersion) can not be empty,100430"
);
}
let
pushObj
=
{
BizId
:
pobj
.
pushObj
.
BizId
,
...
...
@@ -669,35 +669,35 @@ async foodRecordLogList(pobj) {
ApplicationStatus
:
pobj
.
pushObj
.
ApplicationStatus
};
let
obj
=
{
action
:
interface_params_info
.
action
,
reqbody
:
pushObj
,
apiVersion
:
interface_params_info
.
apiVersion
action
:
interface_params_info
.
action
,
reqbody
:
pushObj
,
apiVersion
:
interface_params_info
.
apiVersion
}
let
result
=
await
this
.
aliclient
.
reqbyget
(
obj
);
return
result
;
}
// //推送ICP方案
// async pushIcpSolution1(pushObj, solutionNo, appInfo, self) {
// //推送方案确认信息
// var confirmRes = await this.aliclient.reqbyget({ action: "ConfirmIntention", reqbody: { BizId: pushObj.IntentionBizId }, apiVersion: "2019-05-08" });
// console.log("confirmRes",confirmRes)
// // if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
// // var confirmResData = confirmRes.data;
// // if (confirmResData.ConfirmUrl) {
// // var reqObj3 = {
// // actionType: "receiveIcpConfirmUrl",
// // appInfo: appInfo,
// // actionBody: {
// // solutionNo: solutionNo,
// // confirmUrl: confirmResData.ConfirmUrl
// // }
// // };
// // var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
// // }
// // }
// // return confirmRes;
// }
// //推送ICP方案
// async pushIcpSolution1(pushObj, solutionNo, appInfo, self) {
// //推送方案确认信息
// var confirmRes = await this.aliclient.reqbyget({ action: "ConfirmIntention", reqbody: { BizId: pushObj.IntentionBizId }, apiVersion: "2019-05-08" });
// console.log("confirmRes",confirmRes)
// // if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
// // var confirmResData = confirmRes.data;
// // if (confirmResData.ConfirmUrl) {
// // var reqObj3 = {
// // actionType: "receiveIcpConfirmUrl",
// // appInfo: appInfo,
// // actionBody: {
// // solutionNo: solutionNo,
// // confirmUrl: confirmResData.ConfirmUrl
// // }
// // };
// // var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
// // }
// // }
// // return confirmRes;
// }
}
module
.
exports
=
QcCenterOrderService
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
40b40292
...
...
@@ -499,13 +499,13 @@ class UtilsNeedService2 extends AppServiceBase {
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
//2020-10-28 laolan start
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uappIds
){
if
(
result
.
data
.
uappIds
==
uappId
.
ali
){
if
(
result
&&
result
.
status
==
0
&&
result
.
data
){
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"
});
console
.
log
(
"ali+res"
,
res
)
}
if
(
result
.
data
.
uappIds
==
uappId
.
baidu
){
var
ress
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/communication"
,
reqbody
:
{
bizId
:
pobj
.
actionBody
.
intentionBizId
,
note
:
pobj
.
actionBody
.
note
}
});
if
(
result
.
data
==
uappId
.
baidu
){
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
)
}
}
...
...
@@ -534,15 +534,16 @@ class UtilsNeedService2 extends AppServiceBase {
}
async
queryExpertApplyCommunicationLogs
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
intentionBizId
)
{
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100493"
);
}
if
(
!
pobj
.
actionBody
.
userFeedBack
)
{
return
system
.
getResult
(
null
,
"actionBody.userFeedBack can not be empty,100494"
);
}
//
if (!pobj.actionBody.intentionBizId) {
//
return system.getResult(null, "actionBody.intentionBizId can not be empty,100493");
//
}
//
if (!pobj.actionBody.userFeedBack) {
//
return system.getResult(null, "actionBody.userFeedBack can not be empty,100494");
//
}
//2020-10-28 laolan start
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need2/springBoard"
;
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
.
data
.
uapp_id
==
uappId
.
ali
){
var
res
=
await
this
.
aliclient
.
reqbyget
({
...
...
@@ -558,16 +559,15 @@ class UtilsNeedService2 extends AppServiceBase {
}
if
(
result
.
data
.
uapp_id
==
uappId
.
baidu
){
console
.
log
(
"bbbbb++"
,
pobj
)
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
:
""
,
endTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
bizId
:
pobj
.
actionBody
.
intentionBizId
,
userFeedBack
:
pobj
.
actionBody
.
userFeedBack
,
pageNum
:
pobj
.
actionBody
.
pageNum
||
1
,
pageSize
:
pobj
.
actionBody
.
pageSize
||
10
,
requirementId
:
pobj
.
actionBody
.
intentionBizId
}
});
console
.
log
(
'xxcc+++'
,
res
)
}
}
...
...
@@ -581,7 +581,7 @@ class UtilsNeedService2 extends AppServiceBase {
// var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere);
// }
// func();
return
system
.
getResultSuccess
(
res
)
;
return
res
;
}
/**
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
40b40292
...
...
@@ -66,12 +66,14 @@ class UtilsPushService extends AppServiceBase {
let
result
;
if
(
interface_list_temp
&&
interface_list_temp
.
length
==
1
)
{
const
element
=
interface_list_temp
[
0
];
var
reflexActionRes
=
await
self
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
let
reflexActionRes
=
await
self
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
self
.
execClientNew
.
execLogs
(
"pushBusInfo-reflexAction-result:"
,
pobj
,
"center-channel-reflexAction"
,
reflexActionRes
,
null
);
return
reflexActionRes
;
}
else
{
for
(
let
index
=
0
;
index
<
interface_list_temp
.
length
;
index
++
)
{
const
element
=
interface_list_temp
[
index
];
result
=
await
self
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
self
.
execClientNew
.
execLogs
(
"pushBusInfo-for---reflexAction-result:"
,
pobj
,
"center-channel-reflexAction"
,
result
,
null
);
}
return
result
;
}
...
...
@@ -84,9 +86,8 @@ class UtilsPushService extends AppServiceBase {
return
system
.
getResult
(
null
,
"暂无推送配置"
);
}
var
result
=
await
this
.
reflexAction
(
interface_info
,
pobj
.
opType
,
pobj
,
pobj
.
isDelProductInfo
||
1
);
this
.
execClientNew
.
execLogs
(
"againPushBusInfo-reflexAction-result:"
,
pobj
,
"center-channel-reflexAction"
,
result
,
null
);
if
(
result
.
status
!=
0
)
{
//TODO:记录推送失败的log
this
.
execClientNew
.
execLogs
(
"pushBusInfo-reflexAction-result:"
,
pobj
,
"center-channel-reflexAction"
,
result
,
null
);
return
result
;
}
return
system
.
getResultSuccess
();
...
...
center-channel/app/base/utils/baiduClient.js
View file @
40b40292
...
...
@@ -21,49 +21,31 @@ class baiduClient {
let
timestamp
=
new
Date
().
toISOString
()
let
site
=
timestamp
.
lastIndexOf
(
"."
);
timestamp
=
timestamp
.
substring
(
0
,
site
)
+
"Z"
// let timestamp = "2020-11-05T04:00:00Z"
console
.
log
(
'timestamp++'
,
timestamp
)
let
signedHeaders
=
"host"
;
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"
//中间结果1:规范化请求和前缀字符串
let
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
"
\
n"
+
canonicalHeaders
;
console
.
log
(
'canonicalRequest+++'
,
canonicalRequest
)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let
authStringPrefix
=
version
+
"/"
+
accessKey
+
"/"
+
timestamp
+
"/"
+
extime
;
console
.
log
(
'authStringPrefix+++'
,
authStringPrefix
)
//中间结果2:派生签名密钥 signingKey
let
signingKey
=
crypto
.
createHmac
(
'sha256'
,
secretKey
)
.
update
(
authStringPrefix
)
.
digest
(
'hex'
);
console
.
log
(
'signingKey+++'
,
signingKey
)
//中间结果3:签名摘要 signature
let
signature
=
crypto
.
createHmac
(
'sha256'
,
signingKey
)
.
update
(
canonicalRequest
)
.
digest
(
'hex'
);
console
.
log
(
'signature+++'
,
signature
)
//最终结果:认证字符串 authorization
let
authorization
=
authStringPrefix
+
"/"
+
signedHeaders
+
"/"
+
signature
;
console
.
log
(
'authorization+++'
,
authorization
)
var
baiduObj
=
{
authorization
:
authorization
,
data
:
actionBody
}
var
rtn
=
await
this
.
execClient
.
execBaiduPost
(
baiduObj
,
url
);
console
.
log
(
"baiduObj+++++"
,
baiduObj
)
console
.
log
(
"url+++++"
,
url
)
console
.
log
(
"rtn+++++"
,
rtn
)
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
...
...
@@ -73,7 +55,6 @@ class baiduClient {
//百度接口 2020-10-27 laolan
async
baiduReqbyget
(
obj
,
cbk
)
{
console
.
log
(
'obj+++'
,
obj
)
var
path
=
obj
.
path
;
var
reqbody
=
obj
.
reqbody
;
try
{
...
...
@@ -111,69 +92,5 @@ class baiduClient {
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
;
center-channel/app/config/businessConfig.js
View file @
40b40292
...
...
@@ -18,7 +18,7 @@ module.exports = {
"foodCloseNeed"
,
"foodRecordLog"
,
"foodRecordLogList"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
,
"submitIcpProgramme"
,
"serviceProviderSubmitMaterial"
,
"abolishIcpProgramme"
,
"submitService"
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
,
"submitIcpProgramme"
,
"serviceProviderSubmitMaterial"
,
"abolishIcpProgramme"
,
"submitService"
,
"serviceProviderNotification"
],
apiSecretPathList
:
[
"/api/icp/consultation/submit"
,
"/api/icp/feedback/submit"
,
"/api/icp/order/notify"
,
"/api/opreceive/service/create"
,
"/api/icp/order/close"
,
"/api/opreceive/service/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