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
4f72dd0b
Commit
4f72dd0b
authored
Nov 03, 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
4067b167
3e7d9833
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
192 additions
and
99 deletions
+192
-99
center-channel/app/base/api/impl/opreceive/need2.js
+118
-0
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
+15
-76
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+4
-11
center-channel/app/base/utils/baiduClient.js
+54
-11
center-channel/app/config/businessConfig.js
+1
-1
No files found.
center-channel/app/base/api/impl/opreceive/need2.js
0 → 100644
View file @
4f72dd0b
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
Need2
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
this
.
centerorderSve
=
system
.
getObject
(
"service.common.centerorderSve"
);
this
.
utilsNeedSve2
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve2"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionProcess
)
{
return
system
.
getResult
(
null
,
"actionProcess参数不能为空"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionProcess
,
pobj
.
actionType
,
pobj
.
actionBody
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_process
,
action_type
,
action_body
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
self
=
this
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"submitNeedH5"
:
//提交需求----del
opResult
=
await
this
.
utilsNeedSve
.
submitNeedH5
(
pobj
,
pobj
.
actionBody
);
break
;
//--------------------------------------跟ali合作---------------------------
case
"submitNeed"
:
//提交需求
opResult
=
await
this
.
utilsNeedSve
.
submitNeed
(
pobj
,
pobj
.
actionBody
);
break
;
case
"needClose"
:
//关闭需求
opResult
=
await
this
.
utilsNeedSve
.
needClose
(
pobj
,
pobj
.
actionBody
);
break
;
case
"needCloseIcp"
:
//关闭需求
opResult
=
await
this
.
utilsNeedSve
.
needCloseIcp
(
pobj
,
pobj
.
actionBody
);
break
;
case
"needDetailByChannelNo"
:
opResult
=
await
this
.
utilsNeedSve
.
needDetailByChannelNo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getItemByChannelNeedNo"
:
opResult
=
await
this
.
utilsNeedSve
.
getItemByChannelNeedNo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getItemByNeedNo"
:
opResult
=
await
this
.
utilsNeedSve
.
getItemByNeedNo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"receiveFeedback"
:
//接收方案反馈信息
opResult
=
await
this
.
centerorderSve
.
reqCenterOrderApi
(
pobj
);
break
;
case
"getItemByChannelSolutionNo"
:
opResult
=
await
this
.
utilsNeedSve
.
getItemByChannelSolutionNo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"icpFeedbackSubmit"
:
//icp接收方案反馈信息
pobj
.
actionType
=
"receiveIcpFeedback"
;
opResult
=
await
this
.
utilsNeedSve
.
reqCenterOrderQcApi
(
pobj
);
break
;
case
"icpNotify"
:
//icp方案更新
opResult
=
await
this
.
utilsNeedSve
.
icpNotify
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
&&
pobj
.
actionBody
.
status
==
1
)
{
opResult
=
await
self
.
centerorderSve
.
icppaysuccess
(
pobj
,
pobj
.
actionBody
);
}
break
;
case
"writeCommunicationLog"
:
//icp接收方案反馈信息2020-11-2 laolan 写入沟通记录
opResult
=
await
this
.
utilsNeedSve2
.
writeCommunicationLog
(
pobj
);
break
;
case
"queryExpertApplyCommunicationLogs"
:
//icp接收方案反馈信息 2020-11-2 laolan 查询沟通记录
opResult
=
await
this
.
utilsNeedSve2
.
queryExpertApplyCommunicationLogs
(
pobj
);
break
;
case
"getaliicpProduce"
:
//方案询价
opResult
=
await
this
.
centerorderSve
.
getaliicpProduce
(
pobj
);
break
;
case
"submitIcpIntention"
:
// 2020 0827 lin 新增 4.1 提交需求
opResult
=
await
this
.
utilsNeedSve
.
submitIcpIntention
(
pobj
,
pobj
.
actionBody
);
break
;
case
"queryIntentionList"
:
// 2020 0827 lin 新增 4.2 需求列表查询
opResult
=
await
this
.
utilsNeedSve
.
queryIntentionList
(
pobj
,
pobj
.
actionBody
);
break
;
case
"confirmIcpIntention"
:
// 2020 0827 lin 新增 4.3 用户需求确认
opResult
=
await
this
.
utilsNeedSve
.
confirmIcpIntention
(
pobj
,
pobj
.
actionBody
);
break
;
case
"needBatchUpload"
:
// 2020 0914 lin 新增 刷单一条龙服务
opResult
=
await
this
.
utilsNeedSve
.
needBatchUpload
(
pobj
,
pobj
.
actionBody
);
break
;
case
"testsymq"
:
opResult
=
await
this
.
utilsNeedSve
.
testsymq
(
pobj
);
break
;
//-----------接入百度ICP------start----zhuangbing--2020.10.22----------------------------
case
"submitIcpNeed"
:
//提交需求
opResult
=
await
this
.
utilsNeedSve
.
submitNeed2
(
pobj
,
pobj
.
actionBody
);
break
;
case
"icpFeedbackSubmitNew"
:
//icp接收方案反馈信息
pobj
.
actionType
=
"receiveIcpFeedback"
;
opResult
=
await
this
.
utilsNeedSve
.
reqCenterOrderQcApi
(
pobj
);
break
;
case
"icpNotifyNew"
:
//icp方案更新
opResult
=
await
this
.
utilsNeedSve
.
icpNotifyNew
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
&&
pobj
.
actionBody
.
status
==
1
)
{
opResult
=
await
self
.
centerorderSve
.
icppaysuccessNew
(
pobj
,
pobj
.
actionBody
);
}
break
;
//-----------接入百度ICP------end----------------------------------
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
Need2
;
\ No newline at end of file
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
View file @
4f72dd0b
...
@@ -87,12 +87,11 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -87,12 +87,11 @@ class BaseCenterOrderService extends AppServiceBase {
//推送数据至baidu
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
// var bizType = needinfo.channelTypeCode;//业务类型里
var
pushObj
=
{
var
pushObj
=
{
intentionBiz
Id
:
needinfo
.
channelNeedNo
,
requirement
Id
:
needinfo
.
channelNeedNo
,
companyName
:
solution
.
CompanyName
,
companyName
:
solution
.
CompanyName
,
icpType
:
solution
.
IcpType
,
companyAddress
:
solution
.
CompanyAddress
,
companyAddress
:
solution
.
CompanyAddress
,
area
:
solution
.
Area
,
area
:
solution
.
Area
,
actionT
ype
:
solution
.
ActionType
t
ype
:
solution
.
ActionType
};
};
if
(
needsolution
.
channelSolutionNo
)
{
if
(
needsolution
.
channelSolutionNo
)
{
pushObj
[
"bizId"
]
=
needsolution
.
channelSolutionNo
;
pushObj
[
"bizId"
]
=
needsolution
.
channelSolutionNo
;
...
@@ -178,7 +177,8 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -178,7 +177,8 @@ class BaseCenterOrderService extends AppServiceBase {
//推送ICP方案baidu 2020-10-26 laolan
//推送ICP方案baidu 2020-10-26 laolan
async
pushBaiduIcpSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
async
pushBaiduIcpSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
//推送方案信息
//推送方案信息
var
pushRes
=
await
self
.
baiduclient
.
baiduReqbyget
({
action
:
"submitIcpSolution"
,
reqbody
:
pushObj
});
var
pushRes
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/plan"
,
reqbody
:
pushObj
});
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
.
bizId
)
{
...
@@ -191,51 +191,13 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -191,51 +191,13 @@ class BaseCenterOrderService extends AppServiceBase {
}
}
};
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
//百度不用我们确认方案,所以注释掉
return
pushRes
;
// if (a && a.status == 0) {
// //推送方案确认信息
// var confirmRes = await self.baiduclient.baiduReqbyget({ action: "confirmIntention", reqbody: { bizId: pushObj.intentionBizId } });
// 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;
// }
return
system
.
getResultSuccess
();
}
}
}
}
}
}
//服务商icp方案关闭
//服务商icp方案关闭
2020-10-26 laolan
async
abolishIcpProgramme
(
pobj
)
{
async
abolishIcpProgramme
(
pobj
)
{
// var res = await this.reqCenterOrderApi(pobj, "action/baseapi/springBoard");
// if (res && res.status == 0 && res.data) {
// var needsolution = res.data;//方案信息
// var ab = pobj.actionBody;
// if (typeof (ab.material) == "string") {
// ab.material = JSON.parse(ab.material);
// }
// //推送数据至阿里
// var pushObj = {
// BizId: ab.BizId, Note: ab.Note
// };
// //关闭方案
// this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
// return system.getResultSuccess();
// }
// return res;
//2020-10-26 laolan
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/baseapi/springBoard"
);
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/baseapi/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
var
needsolution
=
res
.
data
;
//方案信息
var
needsolution
=
res
.
data
;
//方案信息
...
@@ -260,7 +222,7 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -260,7 +222,7 @@ class BaseCenterOrderService extends AppServiceBase {
note
:
ab
.
Note
note
:
ab
.
Note
};
};
//关闭方案
//关闭方案
this
.
baidu
u
client
.
baiduReqbyget
({
action
:
"closeIcpProduce"
,
reqbody
:
pushObj
});
this
.
baiduclient
.
baiduReqbyget
({
action
:
"closeIcpProduce"
,
reqbody
:
pushObj
});
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
@@ -322,7 +284,8 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -322,7 +284,8 @@ class BaseCenterOrderService extends AppServiceBase {
};
};
var
self
=
this
;
var
self
=
this
;
//推送方案材料
//推送方案材料
self
.
baiduclient
.
baiduReqbyget
({
action
:
"savePartnerSubmitMaterial"
,
reqbody
:
pushObj
});
var
r
=
self
.
baiduclient
.
baiduReqbyget
({
action
:
"savePartnerSubmitMaterial"
,
reqbody
:
pushObj
});
console
.
log
(
"r++"
,
res
)
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
@@ -360,39 +323,15 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -360,39 +323,15 @@ class BaseCenterOrderService extends AppServiceBase {
//交付单关闭
//交付单关闭
async
closeOrderDelivery
(
pobj
)
{
async
closeOrderDelivery
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/baseapi/springBoard"
);
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/baseapi/springBoard"
);
// if (res && res.status == 0 && res.data) {
// var needsolution = res.data;//方案信息
// var ab = pobj.actionBody;
// //推送数据至阿里
// var pushObj = {
// BizId: needsolution.channelSolutionNo, Note: ab.note
// };
// //关闭方案
// this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
// return system.getResultSuccess();
// }
//2020-10-27 laolan 区分渠道
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
var
needsolution
=
res
.
data
;
//方案信息
var
needsolution
=
res
.
data
;
//方案信息
var
ab
=
pobj
.
actionBody
;
var
ab
=
pobj
.
actionBody
;
var
uappIds
=
res
.
data
.
uapp_id
;
//推送数据至阿里
if
(
uappIds
==
uappId
.
ali
){
var
pushObj
=
{
//推送数据至阿里
BizId
:
needsolution
.
channelSolutionNo
,
Note
:
ab
.
note
var
pushObj
=
{
};
BizId
:
needsolution
.
channelSolutionNo
,
Note
:
ab
.
note
//关闭方案
};
this
.
aliclient
.
reqbyget
({
action
:
"CloseIcpProduce"
,
reqbody
:
pushObj
,
apiVersion
:
"2019-05-08"
});
//关闭方案
this
.
aliclient
.
reqbyget
({
action
:
"CloseIcpProduce"
,
reqbody
:
pushObj
,
apiVersion
:
"2019-05-08"
});
}
if
(
uappIds
==
uappId
.
baidu
){
//推送数据至baidu
var
pushObj
=
{
bizId
:
needsolution
.
channelSolutionNo
,
note
:
ab
.
note
};
//关闭方案
this
.
baiduclient
.
baiduReqbyget
({
action
:
"closeOrder"
,
reqbody
:
pushObj
});
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
return
res
;
return
res
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
4f72dd0b
...
@@ -281,8 +281,7 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -281,8 +281,7 @@ class UtilsNeedService2 extends AppServiceBase {
});
});
if
(
result
.
status
==
0
)
{
if
(
result
.
status
==
0
)
{
if
(
result
.
data
)
{
if
(
result
.
data
)
{
// pobj.actionBody.orderNo = result.data;
pobj
.
actionBody
.
orderNo
=
result
.
data
;
pobj
.
actionBody
.
orderNo
=
result
.
data
.
orderNo
;
//laolan 2020-10-29
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
<
0
)
{
if
(
orderrtn
.
status
<
0
)
{
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
...
@@ -309,16 +308,9 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -309,16 +308,9 @@ class UtilsNeedService2 extends AppServiceBase {
resultInfo
:
""
,
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
});
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
){
// 推送ali
// 推送ali
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntention"
,
reqbody
:
{
BizId
:
actionBody
.
channelNeedNo
,
Note
:
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
var
a
=
await
self
.
aliclient
.
reqbyget
({
action
:
"CloseIntention"
,
reqbody
:
{
BizId
:
actionBody
.
channelNeedNo
,
Note
:
actionBody
.
note
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
a
);
console
.
log
(
a
);
}
if
(
result
.
data
.
uapp_id
==
uappId
.
ali
){
// 推送baidu
var
b
=
await
self
.
baiduclient
.
baiduReqbyget
({
action
:
"closeIntention"
,
reqbody
:
{
bizId
:
actionBody
.
channelNeedNo
,
note
:
actionBody
.
note
}
});
console
.
log
(
b
);
}
self
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseICPNeed"
);
self
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseICPNeed"
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
else
{
}
else
{
...
@@ -504,7 +496,7 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -504,7 +496,7 @@ class UtilsNeedService2 extends AppServiceBase {
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100492"
);
return
system
.
getResult
(
null
,
"actionBody.note can not be empty,100492"
);
}
}
var
self
=
this
;
var
self
=
this
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need
2
/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
&&
result
.
data
.
uappIds
){
...
@@ -661,10 +653,11 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -661,10 +653,11 @@ class UtilsNeedService2 extends AppServiceBase {
// 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");
// }
// }
console
.
log
(
'xxxqqqq+++chaxun+++'
,
pobj
)
pobj
.
actionBody
.
data
=
[];
pobj
.
actionBody
.
data
=
[];
await
this
.
queryByAli
(
pobj
,
1
);
await
this
.
queryByAli
(
pobj
,
1
);
pobj
.
actionType
=
"getUnCreated"
;
pobj
.
actionType
=
"getUnCreated"
;
let
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
let
reqUrl
=
this
.
centerOrderUrl
+
"action/need
2
/springBoard"
;
let
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
let
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
if
(
result
.
status
==
0
)
{
pobj
.
actionBody
=
{
pobj
.
actionBody
=
{
...
...
center-channel/app/base/utils/baiduClient.js
View file @
4f72dd0b
const
co
=
require
(
"co"
);
var
request
=
require
(
"request"
);
const
sha256
=
require
(
'sha256'
);
var
urlencode
=
require
(
'urlencode'
);
const
system
=
require
(
"../system"
);
const
system
=
require
(
"../system"
);
class
baiduClient
{
class
baiduClient
{
constructor
()
{
constructor
()
{
...
@@ -5,35 +9,74 @@ class baiduClient {
...
@@ -5,35 +9,74 @@ class baiduClient {
}
}
//2020 1027 laolan 调用百度网关
//2020 1027 laolan 调用百度网关
async
baiduPost
(
baidRreqUrl
,
accessKeyId
,
accessKeySecret
,
endpoint
,
actionBody
)
{
async
baiduPost
(
path
,
actionBody
)
{
accessKeyId
=
"ff2571490b4c4fb5add57385dc5e8f66"
;
console
.
log
(
'actionBody++'
,
actionBody
)
accessKeySecret
=
"9d86f04a85db4cdfa95ba8ad28009188"
;
let
domain
=
"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
;
endpoint
=
"https://iam.bj.baidubce.com"
;
let
authorization
=
"bce-auth-v1"
;
let
accessKey
=
"ff2571490b4c4fb5add57385dc5e8f66"
;
let
secretKey
=
"9d86f04a85db4cdfa95ba8ad28009188"
;
let
timestamp
=
new
Date
().
toISOString
();
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
)
// SigningKey = HMAC-SHA256-HEX(sk, authStringPrefix)
// authStringPrefix代表认证字符串的前缀部分,即:bce-auth-v1/{accessKeyId}/{timestamp}/{expirationPeriodInSeconds}。
// CanonicalRequest = HTTP Method + "\n" + CanonicalURI + "\n" + CanonicalQueryString + "\n" + CanonicalHeaders
// signature = HMAC-SHA256-HEX(SigningKey,CanonicalRequest)
let
authStringPrefix
=
authorization
+
"/"
+
accessKey
+
"/"
+
timestamp
+
"/"
+
extime
;
let
signingKey
=
await
sha256
(
secretKey
,
authStringPrefix
);
let
newResultSignStr
=
resultSignStr
.
replace
(
/&/g
,
','
)
let
canonicalQueryString
=
path
+
','
+
newResultSignStr
;
console
.
log
(
'canonicalQueryString+++'
,
canonicalQueryString
)
let
canonicalHeaders
=
{
host
:
urlencode
(
domain
)
}
let
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
canonicalQueryString
+
"
\
n"
+
canonicalHeaders
+
"
\
n"
;
let
signature
=
await
sha256
(
signingKey
,
canonicalRequest
);
path
=
domain
+
path
;
console
.
log
(
'path+++'
,
path
)
var
param
=
{
var
param
=
{
data
:
actionBody
,
data
:
actionBody
,
timeout
:
20000
,
timeout
:
20000
,
headers
:
{
headers
:
{
Authorization
:
authStringPrefix
+
"/"
+
"x-bce-date/"
+
signature
,
accept
:
'application/json'
accept
:
'application/json'
}
}
};
};
console
.
log
(
JSON
.
stringify
(
param
),
"______________峰擎---百度云参数_______"
);
console
.
log
(
'param+++'
,
param
,
"______________峰擎---百度云参数_______"
);
var
result
=
await
this
.
baiduPost
(
baidRreqUrl
,
param
);
var
result
=
await
request
.
post
(
path
,
param
);
console
.
log
(
JSON
.
stringify
(
result
),
"______________峰擎---百度云返回结果_______"
);
console
.
log
(
'result+++'
,
JSON
.
stringify
(
result
),
"______________峰擎---百度云返回结果_______"
);
console
.
log
(
'result-------'
,
result
);
return
result
;
return
result
;
}
}
//百度接口 2020-10-27 laolan
//百度接口 2020-10-27 laolan
async
baiduReqbyget
(
obj
,
cbk
)
{
async
baiduReqbyget
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
console
.
log
(
'obj+++'
,
obj
)
var
path
=
obj
.
path
;
var
reqbody
=
obj
.
reqbody
;
var
reqbody
=
obj
.
reqbody
;
try
{
try
{
var
reqBaiduClient
=
null
;
// { ... this.baiduClient };
var
res
=
await
this
.
baiduPost
(
path
,
reqbody
,
{
var
res
=
await
reqBaiduClient
.
request
(
action
,
reqbody
,
{
timeout
:
10000
,
// default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
timeout
:
10000
,
// default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction
:
true
,
// default true, format the action to Action
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'
GE
T'
,
// set the http method, default is GET
method
:
'
POS
T'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
headers
:
{},
// set the http request headers
});
});
console
.
log
(
'baidu++++res+++'
,
res
)
this
.
pushlogSve
.
createDb
({
this
.
pushlogSve
.
createDb
({
op
:
"new-baiduReqbyget"
,
op
:
"new-baiduReqbyget"
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
...
...
center-channel/app/config/businessConfig.js
View file @
4f72dd0b
...
@@ -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"
],
apiMustUserpinList
:
[
"submitNeed"
,
"paySuccess"
,
"icpNotify"
,
"getLoginInfo"
,
"icpNotifyNew"
,
"submitIcpProgramme"
,
"serviceProviderSubmitMaterial"
,
"abolishIcpProgramme"
],
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