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
dd41fcfd
Commit
dd41fcfd
authored
Nov 05, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel
parents
af610a79
0b0b22af
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
195 additions
and
71 deletions
+195
-71
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
+39
-1
center-channel/app/base/service/impl/common/centerorderSve.js
+29
-2
center-channel/app/base/service/impl/common/signSve.js
+29
-4
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+1
-1
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+7
-2
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+18
-7
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+16
-6
center-channel/app/base/utils/baiduClient.js
+54
-46
center-channel/app/base/utils/execClient.js
+1
-1
center-channel/app/config/settings.js
+1
-1
No files found.
center-channel/app/base/service/impl/common/baseCenterOrderSve.js
View file @
dd41fcfd
...
@@ -17,6 +17,42 @@ const uappId = {
...
@@ -17,6 +17,42 @@ const uappId = {
'ali'
:
"18"
,
//(阿里icp、edi)
'ali'
:
"18"
,
//(阿里icp、edi)
'baidu'
:
"44"
//(百度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"
:
"海南"
}
/**
/**
* 资质信息提报相关接口(ICP\EDI)
* 资质信息提报相关接口(ICP\EDI)
*/
*/
...
@@ -96,6 +132,7 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -96,6 +132,7 @@ class BaseCenterOrderService extends AppServiceBase {
if
(
needsolution
.
channelSolutionNo
)
{
if
(
needsolution
.
channelSolutionNo
)
{
pushObj
[
"bizId"
]
=
needsolution
.
channelSolutionNo
;
pushObj
[
"bizId"
]
=
needsolution
.
channelSolutionNo
;
}
}
console
.
log
(
'pushObj++'
,
pushObj
)
var
pushIcpSolutionRes
=
await
this
.
pushBaiduIcpSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
var
pushIcpSolutionRes
=
await
this
.
pushBaiduIcpSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
}
}
...
@@ -176,6 +213,7 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -176,6 +213,7 @@ 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
)
{
console
.
log
(
'pushObj++baidu+++'
,
pushObj
)
//推送方案信息
//推送方案信息
var
pushRes
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/plan"
,
reqbody
:
pushObj
});
var
pushRes
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/plan"
,
reqbody
:
pushObj
});
console
.
log
(
"pushRes++++"
,
pushRes
)
console
.
log
(
"pushRes++++"
,
pushRes
)
...
@@ -191,7 +229,7 @@ class BaseCenterOrderService extends AppServiceBase {
...
@@ -191,7 +229,7 @@ class BaseCenterOrderService extends AppServiceBase {
}
}
};
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
return
pushRes
;
return
system
.
getResultSuccess
()
;
}
}
}
}
}
}
...
...
center-channel/app/base/service/impl/common/centerorderSve.js
View file @
dd41fcfd
...
@@ -614,6 +614,7 @@ class CenterorderService extends AppServiceBase {
...
@@ -614,6 +614,7 @@ class CenterorderService extends AppServiceBase {
},
},
appInfo
:
pobj
.
appInfo
appInfo
:
pobj
.
appInfo
}
}
var
baiduPushRes
=
await
this
.
utilsPushSve
.
baiduBusiness2Fq
(
fqobj
,
"pushOrderICPBusinessNew"
);
var
deliveryObj
=
{
var
deliveryObj
=
{
actionBody
:
{
actionBody
:
{
orderNo
:
orderrtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
orderNo
:
orderrtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
...
@@ -627,9 +628,35 @@ class CenterorderService extends AppServiceBase {
...
@@ -627,9 +628,35 @@ class CenterorderService extends AppServiceBase {
}
}
},
},
appInfo
:
pobj
.
appInfo
appInfo
:
pobj
.
appInfo
};
if
(
pobj
.
actionBody
.
isDirectBuy
&&
pobj
.
actionBody
.
isDirectBuy
==
1
){
//直接下单需执行添加订单业务员操作
if
(
baiduPushRes
&&
baiduPushRes
.
status
==
0
){
if
(
baiduPushRes
.
data
&&
baiduPushRes
.
data
.
data
){
var
resData
=
baiduPushRes
.
data
.
data
;
var
salesmanInfo
=
{
salesmanName
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operatorName
:
""
,
salesmanChannelId
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operator
:
""
,
};
var
salesmanObj
=
{
appInfo
:
pobj
.
appInfo
,
actionType
:
"addIcpSalesmanInfo"
,
//添加业务员信息
actionBody
:{
salesmanInfo
:
salesmanInfo
,
orderNo
:
orderrtn
.
data
.
orderNo
}
};
var
url
=
settings
.
centerOrderUrl
()
+
"action/qcapi/springBoard"
;
var
addRes
=
await
this
.
execClient
.
execPost
(
salesmanObj
,
url
);
if
(
addRes
&&
addRes
.
stdout
)
{
var
salesmanRes
=
JSON
.
parse
(
addRes
.
stdout
);
if
(
salesmanRes
.
status
==
0
)
{
deliveryObj
.
needsolution
=
salesmanRes
.
data
;
await
this
.
utilsPushSve
.
baiduBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
}
}
}
}
}
else
{
this
.
utilsPushSve
.
baiduBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
}
}
this
.
utilsPushSve
.
baiduBusiness2Fq
(
fqobj
,
"pushOrderICPBusinessNew"
);
this
.
utilsPushSve
.
baiduBusiness2Delivery
(
deliveryObj
,
"pushDeliveryOrder"
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
}
}
...
...
center-channel/app/base/service/impl/common/signSve.js
View file @
dd41fcfd
...
@@ -87,8 +87,12 @@ class SignService{
...
@@ -87,8 +87,12 @@ class SignService{
}
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
params
[
tKey
]
&&
!
(
params
[
tKey
]
instanceof
Array
))
{
if
(
tKey
!=
"sign"
&&
params
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
params
[
tKey
]);
let
tmpKeyValue
=
params
[
tKey
];
if
(
tmpKeyValue
instanceof
Array
||
tmpKeyValue
instanceof
Object
)
{
tmpKeyValue
=
JSON
.
stringify
(
tmpKeyValue
);
}
signArr
.
push
(
tKey
+
"="
+
tmpKeyValue
);
}
}
}
}
if
(
signArr
.
length
==
0
)
{
if
(
signArr
.
length
==
0
)
{
...
@@ -98,10 +102,10 @@ class SignService{
...
@@ -98,10 +102,10 @@ class SignService{
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
return
system
.
getResultSuccess
(
resultTmpSign
);
return
system
.
getResultSuccess
(
resultTmpSign
);
}
}
}
}
module
.
exports
=
SignService
;
module
.
exports
=
SignService
;
// var task = new SignService();
var
task
=
new
SignService
();
// var obj = {
// var obj = {
// "intentionBizId": "TRE-nmnHtEoTjeEtest",
// "intentionBizId": "TRE-nmnHtEoTjeEtest",
// "phone": "13126673246",
// "phone": "13126673246",
...
@@ -113,3 +117,23 @@ module.exports = SignService;
...
@@ -113,3 +117,23 @@ module.exports = SignService;
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(d=>{
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
// });
// });
// var obj = {
// "bizId":"202011031421",
// "contactName":"lin",
// "contactMobile":"13911391996",
// "timeUnit":"year",
// "quantity":1,
// "companyInfo":{
// "companyName":"公司宝",
// "taxpayerType":"NORMAL_TAXPAYER",
// "acctgSystemId":"10001",
// "companyForm":"1",
// "industry":"1",
// "taxpayerNumber":"123456789",
// "companyArea":"北京"
// }
// }
// task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
// });
\ No newline at end of file
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
dd41fcfd
...
@@ -87,7 +87,7 @@ class UtilsFqAliyunService extends AppServiceBase {
...
@@ -87,7 +87,7 @@ class UtilsFqAliyunService extends AppServiceBase {
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
pobj
.
requestId
+
",requestId="
+
rtn
.
requestId
);
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
pobj
.
requestId
+
",requestId="
+
rtn
.
requestId
);
}
}
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
return
system
.
getResultSuccess
(
rtn
.
data
,
"推送成功"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
//日志记录
//日志记录
this
.
logCtl
.
error
({
this
.
logCtl
.
error
({
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
dd41fcfd
...
@@ -620,8 +620,13 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -620,8 +620,13 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
* @param {*} actionBody
*/
*/
async
queryIntentionList
(
pobj
,
actionBody
)
{
async
queryIntentionList
(
pobj
,
actionBody
)
{
var
aliResult
=
await
self
.
aliclient
.
reqbyget
({
action
:
"QueryIntentionList"
,
reqbody
:
actionBody
,
apiVersion
:
"2019-05-08"
});
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
ali
){
if
(
aliResult
.
code
==
200
)
{
var
result
=
await
self
.
aliclient
.
reqbyget
({
action
:
"QueryIntentionList"
,
reqbody
:
actionBody
,
apiVersion
:
"2019-05-08"
});
}
if
(
pobj
.
appInfo
.
uapp_id
=
uappId
.
baidu
){
var
result
=
await
self
.
baiduclient
.
baiduReqbyget
({
path
:
"api/bla/provider/requirement/list"
,
reqbody
:
actionBody
});
}
if
(
result
.
code
==
200
)
{
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
else
{
}
else
{
return
system
.
getResult
(
null
,
"查询失败 10420"
);
return
system
.
getResult
(
null
,
"查询失败 10420"
);
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
dd41fcfd
...
@@ -936,7 +936,8 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -936,7 +936,8 @@ class UtilsOrderService extends AppServiceBase {
uapp_id
:
appInfo
.
uapp_id
,
uapp_id
:
appInfo
.
uapp_id
,
uapp_key
:
appInfo
.
uapp_key
,
uapp_key
:
appInfo
.
uapp_key
,
app_code
:
appInfo
.
app_code
,
app_code
:
appInfo
.
app_code
,
app_name
:
appInfo
.
app_name
app_name
:
appInfo
.
app_name
,
contact_mobile
:
appInfo
.
contact_mobile
};
};
opOrderResult
.
data
.
userInfo
=
{
opOrderResult
.
data
.
userInfo
=
{
channel_userid
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
channel_userid
:
opOrderResult
.
data
.
order_info
.
channelUserId
,
...
@@ -954,9 +955,18 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -954,9 +955,18 @@ class UtilsOrderService extends AppServiceBase {
actionBody
:
opOrderResult
.
data
actionBody
:
opOrderResult
.
data
}
}
// 推送
// 推送
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder"
,
0
);
let
yfRet
=
await
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder"
,
0
);
if
(
yfRet
.
status
!=
0
){
return
yfRet
;
}
if
([
'icpsq'
,
'edisq'
].
includes
(
opOrderResult
.
data
.
product_info
.
channel_item_code
))
{
if
([
'icpsq'
,
'edisq'
].
includes
(
opOrderResult
.
data
.
product_info
.
channel_item_code
))
{
//创建方案
//创建方案
pobj
.
salesmanInfo
=
{
"salesmanId"
:
yfRet
.
data
.
orderList
[
0
].
operator
||
""
,
"salesmanName"
:
yfRet
.
data
.
orderList
[
0
].
operatorName
||
""
,
"salesmanMobile"
:
yfRet
.
data
.
orderList
[
0
].
phone
||
""
,
"salesmanChannelId"
:
yfRet
.
data
.
orderList
[
0
].
channelUserId
||
""
}
let
pushRet
=
await
this
.
packagingPushData
(
pobj
);
let
pushRet
=
await
this
.
packagingPushData
(
pobj
);
if
(
pushRet
.
status
!=
0
)
{
if
(
pushRet
.
status
!=
0
)
{
throw
new
Error
(
'推送失败'
)
throw
new
Error
(
'推送失败'
)
...
@@ -997,7 +1007,7 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -997,7 +1007,7 @@ class UtilsOrderService extends AppServiceBase {
"CompanyName"
:
""
,
"CompanyName"
:
""
,
"licenseType"
:
""
,
"licenseType"
:
""
,
"solutionCity"
:
ab
.
product_info
.
price_item
.
price_desc
,
"solutionCity"
:
ab
.
product_info
.
price_item
.
price_desc
,
"solutionPrice"
:
ab
.
order_info
.
totalSum
,
"solutionPrice"
:
Number
(
ab
.
order_info
.
totalSum
)
*
100
,
"channelTypeCode"
:
ab
.
product_info
.
service_business_code
,
"channelTypeCode"
:
ab
.
product_info
.
service_business_code
,
"companyLocation"
:
ab
.
product_info
.
price_item
.
price_desc
"companyLocation"
:
ab
.
product_info
.
price_item
.
price_desc
}
}
...
@@ -1005,14 +1015,15 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -1005,14 +1015,15 @@ class UtilsOrderService extends AppServiceBase {
"status"
:
"USER_PAY_PRODUCE"
,
"status"
:
"USER_PAY_PRODUCE"
,
"bizType"
:
ab
.
product_info
.
channel_item_code
,
"bizType"
:
ab
.
product_info
.
channel_item_code
,
"solution"
:
solution
,
"solution"
:
solution
,
"totalSum"
:
ab
.
order_info
.
totalSum
,
"totalSum"
:
Number
(
ab
.
order_info
.
totalSum
)
*
100
,
"typeCode"
:
ab
.
product_info
.
channel_item_code
,
"typeCode"
:
ab
.
product_info
.
channel_item_code
,
"typeName"
:
ab
.
product_info
.
channel_item_name
,
"typeName"
:
ab
.
product_info
.
channel_item_name
,
"statusName"
:
"⽤户⽀付"
,
"statusName"
:
"⽤户⽀付"
,
"customerInfo"
:
{
"customerInfo"
:
{
"publishName"
:
""
,
"publishName"
:
ab
.
order_contact
.
contactName
||
""
,
"publishMobile"
:
""
"publishMobile"
:
ab
.
order_contact
.
mobile
||
""
}
},
"salesmanInfo"
:
pobj
.
salesmanInfo
}
}
//推送数据
//推送数据
let
pushObj
=
{
let
pushObj
=
{
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
dd41fcfd
...
@@ -63,10 +63,19 @@ class UtilsPushService extends AppServiceBase {
...
@@ -63,10 +63,19 @@ class UtilsPushService extends AppServiceBase {
return
system
.
getResult
(
null
,
"暂无【"
+
opType
+
"】的推送配置"
);
return
system
.
getResult
(
null
,
"暂无【"
+
opType
+
"】的推送配置"
);
}
}
var
self
=
this
;
var
self
=
this
;
for
(
let
index
=
0
;
index
<
interface_list_temp
.
length
;
index
++
)
{
let
result
;
const
element
=
interface_list_temp
[
index
];
if
(
interface_list_temp
&&
interface_list_temp
.
length
==
1
){
await
self
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
const
element
=
interface_list_temp
[
0
];
var
reflexActionRes
=
await
self
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
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
);
}
return
result
;
}
}
}
}
async
againPushBusInfo
(
pobj
)
{
//再次推送业务总入口-重试
async
againPushBusInfo
(
pobj
)
{
//再次推送业务总入口-重试
...
@@ -97,7 +106,8 @@ class UtilsPushService extends AppServiceBase {
...
@@ -97,7 +106,8 @@ class UtilsPushService extends AppServiceBase {
}
}
pobj
.
interface_params
=
interface_info
.
params
;
pobj
.
interface_params
=
interface_info
.
params
;
var
params
=
[
pobj
];
var
params
=
[
pobj
];
invokeObj
[
interface_info
.
method_name
].
apply
(
invokeObj
,
params
);
var
doRes
=
await
invokeObj
[
interface_info
.
method_name
].
apply
(
invokeObj
,
params
);
return
doRes
;
}
}
else
if
(
interface_info
.
interface_type
==
"yc"
)
{
else
if
(
interface_info
.
interface_type
==
"yc"
)
{
var
actionBody
=
pobj
.
actionBody
;
var
actionBody
=
pobj
.
actionBody
;
...
@@ -142,8 +152,8 @@ class UtilsPushService extends AppServiceBase {
...
@@ -142,8 +152,8 @@ class UtilsPushService extends AppServiceBase {
optitle
:
pobj
.
opType
+
"推送蜂擎获取的接口信息->baiduBusiness2Fq"
,
optitle
:
pobj
.
opType
+
"推送蜂擎获取的接口信息->baiduBusiness2Fq"
,
});
});
if
(
pobj
.
interface_info
)
{
if
(
pobj
.
interface_info
)
{
await
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
var
pushBusInfo
=
await
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
(
pushBusInfo
);
}
}
return
system
.
getResult
(
null
,
"push Fail,interface_info data is empty"
);
return
system
.
getResult
(
null
,
"push Fail,interface_info data is empty"
);
}
}
...
...
center-channel/app/base/utils/baiduClient.js
View file @
dd41fcfd
...
@@ -14,54 +14,60 @@ class baiduClient {
...
@@ -14,54 +14,60 @@ class baiduClient {
async
baiduPost
(
path
,
actionBody
)
{
async
baiduPost
(
path
,
actionBody
)
{
console
.
log
(
'actionBody++'
,
actionBody
)
console
.
log
(
'actionBody++'
,
actionBody
)
let
domain
=
"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
;
let
domain
=
"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
;
let
authorization
=
"bce-auth-v1"
;
let
url
=
domain
+
path
;
let
accessKey
=
"ff2571490b4c4fb5add57385dc5e8f66"
;
let
version
=
"bce-auth-v1"
;
let
secretKey
=
"9d86f04a85db4cdfa95ba8ad28009188"
;
let
accessKey
=
"ed0f5c4c7c2d4e87aa335d9b07bf9bd4"
;
let
timestamp
=
new
Date
().
toISOString
();
let
secretKey
=
"f600c4e91f6d43998d637401e6e34ef9"
;
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
;
let
extime
=
1800
;
// 因为是post,所以CanonicalQueryString为空
var
signArr
=
[];
// var signArr = [];
var
keys
=
Object
.
keys
(
actionBody
).
sort
();
// var keys = Object.keys(actionBody).sort();
if
(
keys
.
length
==
0
)
{
// if (keys.length == 0) {
return
system
.
getResult
(
null
,
"请求参数信息为空"
);
// return system.getResult(null, "请求参数信息为空");
}
// }
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
// for (let k = 0; k < keys.length; k++) {
const
tKey
=
keys
[
k
];
// const tKey = keys[k];
if
(
tKey
!=
"sign"
&&
actionBody
[
tKey
]
&&
!
(
typeof
(
actionBody
[
tKey
])
===
"object"
))
{
// if (tKey != "sign" && actionBody[tKey] && !(typeof (actionBody[tKey]) === "object")) {
signArr
.
push
(
urlencode
(
tKey
)
+
"="
+
urlencode
(
actionBody
[
tKey
]));
// 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
}
}
let
resultSignStr
=
signArr
.
join
(
"&"
);
var
rtn
=
await
this
.
execClient
.
execBaiduPost
(
baiduObj
,
url
);
console
.
log
(
'resultSignStr+++'
,
resultSignStr
)
if
(
!
rtn
||
!
rtn
.
stdout
)
{
// SigningKey = HMAC-SHA256-HEX(sk, authStringPrefix)
return
system
.
getResult
(
null
,
"execPost data is empty"
);
// 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"
;
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
let
signature
=
await
sha256
(
signingKey
,
canonicalRequest
);
path
=
domain
+
path
;
console
.
log
(
'path+++'
,
path
)
var
param
=
{
data
:
actionBody
,
timeout
:
20000
,
headers
:
{
Authorization
:
authStringPrefix
+
"/"
+
"x-bce-date/"
+
signature
,
accept
:
'application/json'
}
};
console
.
log
(
'param+++'
,
param
,
"______________峰擎---百度云参数_______"
);
var
result
=
await
request
.
post
(
path
,
param
);
console
.
log
(
'result+++'
,
JSON
.
stringify
(
result
),
"______________峰擎---百度云返回结果_______"
);
console
.
log
(
'result-------'
,
result
);
return
result
;
return
result
;
}
}
...
@@ -76,7 +82,9 @@ class baiduClient {
...
@@ -76,7 +82,9 @@ class baiduClient {
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
:
'POST'
,
// set the http method, default is GET
method
:
'POST'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
headers
:
{
host
:
"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
},
// set the http request headers
});
});
console
.
log
(
'baidu++++res+++'
,
res
)
console
.
log
(
'baidu++++res+++'
,
res
)
this
.
pushlogSve
.
createDb
({
this
.
pushlogSve
.
createDb
({
...
...
center-channel/app/base/utils/execClient.js
View file @
dd41fcfd
...
@@ -47,7 +47,7 @@ class ExecClient {
...
@@ -47,7 +47,7 @@ class ExecClient {
return
cmd
;
return
cmd
;
}
}
FetchBaiduPostCmd
(
subData
,
url
)
{
FetchBaiduPostCmd
(
subData
,
url
)
{
var
data
=
JSON
.
stringify
(
subData
);
var
data
=
JSON
.
stringify
(
subData
.
data
);
var
cmd
=
this
.
cmdBaiduPostPattern
.
replace
(
/
\{
data
\}
/g
,
var
cmd
=
this
.
cmdBaiduPostPattern
.
replace
(
/
\{
data
\}
/g
,
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
subData
.
authorization
);
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
Authorization
\}
/g
,
subData
.
authorization
);
console
.
log
(
cmd
);
console
.
log
(
cmd
);
...
...
center-channel/app/config/settings.js
View file @
dd41fcfd
...
@@ -246,7 +246,7 @@ var settings = {
...
@@ -246,7 +246,7 @@ var settings = {
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://180.163.239.98:38085/"
// 360测试环境
return
"http://180.163.239.98:38085/"
// 360测试环境
}
else
{
}
else
{
return
"http
://180.163.239.98:38085
/"
//
return
"http
s://console.e.360.cn
/"
//
}
}
},
},
aliUappId
:
function
()
{
aliUappId
:
function
()
{
...
...
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