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
f60c99cf
Commit
f60c99cf
authored
Dec 18, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laolan
parent
aac5e3bb
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
193 additions
and
37 deletions
+193
-37
center-channel/app/base/api/impl/action/regapi.js
+6
-5
center-channel/app/base/api/impl/ic/regCfg.js
+4
-4
center-channel/app/base/service/impl/common/regCenterOrderSve.js
+54
-27
center-channel/app/base/utils/baiduRegclient.js
+106
-0
center-channel/app/config/businessConfig.js
+5
-1
center-channel/app/config/settings.js
+18
-0
No files found.
center-channel/app/base/api/impl/action/reg
CenterOrder
.js
→
center-channel/app/base/api/impl/action/reg
api
.js
View file @
f60c99cf
...
...
@@ -2,7 +2,7 @@
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
Reg
CenterOrder
extends
APIBase
{
class
Reg
API
extends
APIBase
{
constructor
()
{
super
();
this
.
regCenterOrderSve
=
system
.
getObject
(
"service.common.regCenterOrderSve"
);
...
...
@@ -46,8 +46,9 @@ class RegCenterOrder extends APIBase {
case
"getSolutionByChannelOrderNo"
:
//根据渠道订单获取方案信息
opResult
=
await
this
.
regCenterOrderSve
.
getSolutionByChannelOrderNo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"submitBdRegSolution"
:
//方案提交
opResult
=
await
this
.
regCenterOrderSve
.
submitBdRegSolution
(
pobj
);
case
"submitRegSolution"
:
//方案提交
opResult
=
await
this
.
regCenterOrderSve
.
submitRegSolution
(
pobj
);
break
;
case
"writeRegCommunicationLog"
:
//新增沟通记录
opResult
=
await
this
.
regCenterOrderSve
.
writeRegCommunicationLog
(
pobj
);
...
...
@@ -77,4 +78,4 @@ class RegCenterOrder extends APIBase {
}
}
module
.
exports
=
RegCenterOrder
;
\ No newline at end of file
module
.
exports
=
RegAPI
;
\ No newline at end of file
center-channel/app/base/api/impl/ic/regCfg.js
View file @
f60c99cf
...
...
@@ -2,7 +2,7 @@
const
uuidv4
=
require
(
'uuid/v4'
);
var
regCfg
=
{
//工商注册城市对照表
baiduArea
=
{
baiduArea
:
{
"310100"
:
"上海"
,
"441900"
:
"东莞"
,
"440600"
:
"佛山"
,
...
...
@@ -46,7 +46,7 @@ var regCfg = {
"130100"
:
"石家庄"
},
baiduAreaCode
=
{
baiduAreaCode
:
{
"上海"
:
"310100"
,
"东莞"
:
"441900"
,
"佛山"
:
"440600"
,
...
...
@@ -89,7 +89,7 @@ var regCfg = {
"哈尔滨"
:
"230100"
,
"石家庄"
:
"130100"
},
channel
_type_code
=
{
channel
TypeCode
:
{
"gszc"
:
"baidu.gszc"
,
"kzfw"
:
"baidu.kzfw"
,
"gsbg"
:
"baidu.gsbg"
,
...
...
@@ -98,7 +98,7 @@ var regCfg = {
"swbd"
:
"baidu.swbd"
},
//区分渠道的uappid
uappId
=
{
uappId
:
{
'ali'
:
18
,
'baidu'
:
44
},
...
...
center-channel/app/base/service/impl/common/regCenterOrderSve.js
View file @
f60c99cf
...
...
@@ -13,6 +13,7 @@ class RegCenterOrderService extends AppServiceBase {
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
opPushQueueUrl
=
settings
.
opPushQueueUrl
();
this
.
baiduclient
=
system
.
getObject
(
"util.baiduClient"
);
this
.
baiduRegclient
=
system
.
getObject
(
"util.baiduRegclient"
);
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
};
//调用center-order
...
...
@@ -107,7 +108,7 @@ async regPaySuccess(pobj) {
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
if
(
pobj
.
actionBody
.
channelItemCode
)
{
pobj
.
actionBody
.
channelItemCode
=
regCfg
.
channel
_type_c
ode
[
pobj
.
actionBody
.
channelItemCode
];
pobj
.
actionBody
.
channelItemCode
=
regCfg
.
channel
TypeC
ode
[
pobj
.
actionBody
.
channelItemCode
];
}
var
fqobj
=
{
actionBody
:
{
...
...
@@ -220,7 +221,7 @@ async regPaySuccess(pobj) {
pobj
.
actionBody
.
channel_type_name
=
data
.
data
.
channel_type_name
;
pobj
.
actionBody
.
type
=
pobj
.
actionBody
.
channel_type_code
;
if
(
pobj
.
actionBody
.
channel_type_code
)
{
pobj
.
actionBody
.
channel_type_code
=
regCfg
.
channel
_type_c
ode
[
pobj
.
actionBody
.
channel_type_code
]
pobj
.
actionBody
.
channel_type_code
=
regCfg
.
channel
TypeC
ode
[
pobj
.
actionBody
.
channel_type_code
]
}
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
...
...
@@ -353,37 +354,63 @@ async regOrderClose(pobj) {
return
rtn
;
}
//提交reg注册方案
async
submitSolution
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regCenterOrder/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolution
)
{
async
submitRegSolution
(
pobj
)
{
console
.
log
(
'reg --- pobj -----'
,
pobj
)
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolutions
)
{
console
.
log
(
'reg --- res -----'
,
res
)
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
var
needsolution
=
res
.
data
.
needsolution
;
//方案信息
var
ab
=
pobj
.
actionBody
;
if
(
typeof
(
ab
.
solutionContent
)
==
"string"
)
{
ab
.
solutionContent
=
JSON
.
parse
(
ab
.
solutionContent
);
}
if
(
typeof
(
needsolution
.
solutionContent
)
==
"string"
)
{
needsolution
.
solutionContent
=
JSON
.
parse
(
needsolution
.
solutionContent
);
}
var
solution
=
needsolution
.
solutionContent
.
solution
;
var
needsolution
s
=
res
.
data
.
needsolutions
;
//方案信息
//
var ab = pobj.actionBody;
//
if (typeof (ab.solutionContent) == "string") {
//
ab.solutionContent = JSON.parse(ab.solutionContent);
//
}
// if (typeof (needsolutions
.solutionContent) == "string") {
// needsolutions.solutionContent = JSON.parse(needsolutions
.solutionContent);
//
}
// var solution = needsolutions
.solutionContent.solution;
var
self
=
this
;
if
(
needinfo
.
uapp_id
==
regCfg
.
uappId
.
baidu
){
//推送数据至baidu
solution
.
Area
=
regCfg
.
baiduAreaCode
[
solution
.
Area
]
console
.
log
(
'solution.Area++'
,
solution
.
Area
)
// solution.Area = regCfg.baiduAreaCode[solution.Area]
// console.log('solution.Area++',solution.Area)
// var pushObj = {
// intentionBizId: needinfo.channelNeedNo,
// solutionList:{
// gsbBizId:"",
// bizType:"",
// solutionContent:""
// },
// };
var
i
=
0
;
var
needsolutionsLength
=
needsolutions
.
length
;
var
bizTypes
;
var
solutionList
=
[];
for
(
i
=
0
;
i
<
needsolutionsLength
;
i
++
){
bizTypes
=
needsolutions
[
i
].
solutionContent
;
console
.
log
(
'bizTypes-----'
,
bizTypes
)
bizTypes
=
JSON
.
parse
(
bizTypes
)
console
.
log
(
'bizTypes++++'
,
bizTypes
)
bizTypes
.
solution
.
serviceArea
=
regCfg
.
baiduAreaCode
[
bizTypes
.
solution
.
serviceArea
]
var
list
=
{
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
bizType
,
solutionContent
:
bizTypes
.
solution
}
solutionList
.
push
(
list
)
}
var
pushObj
=
{
requirementId
:
needinfo
.
channelNeedNo
,
companyName
:
solution
.
CompanyName
,
companyAddress
:
solution
.
CompanyAddress
,
area
:
solution
.
Area
,
type
:
solution
.
IcpType
intentionBizId
:
needinfo
.
channelNeedNo
,
solutionList
:
solutionList
};
if
(
needsolution
.
channelSolutionNo
)
{
pushObj
[
"bizId"
]
=
needsolution
.
channelSolutionNo
;
}
console
.
log
(
'pushObj++'
,
pushObj
)
var
pushBaiduRegSolution
=
await
this
.
pushBaiduRegSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
console
.
log
(
'pushObj---pushObj---'
,
pushObj
)
// if (needsolutions.channelSolutionNo) {
// pushObj["bizId"] = needsolutions.channelSolutionNo;
// }
var
pushBaiduRegSolution
=
await
this
.
pushBaiduRegSolution
(
pushObj
,
needsolution
s
.
solutionNo
,
pobj
.
appInfo
,
self
);
console
.
log
(
'pushBaiduRegSolution+++'
,
pushBaiduRegSolution
)
}
this
.
logCtl
.
info
({
...
...
@@ -414,7 +441,7 @@ async regOrderClose(pobj) {
async
pushBaiduRegSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
console
.
log
(
'pushObj++baidu+++'
,
pushObj
)
//推送方案信息
var
pushRes
=
await
self
.
baidu
client
.
baiduReqbyget
({
path
:
"/api/bla/provider/plan
"
,
reqbody
:
pushObj
});
var
pushRes
=
await
self
.
baidu
Regclient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?submitSolutions=
"
,
reqbody
:
pushObj
});
console
.
log
(
"pushRes++++"
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
var
resData
=
pushRes
.
data
;
...
...
center-channel/app/base/utils/baiduRegclient.js
0 → 100644
View file @
f60c99cf
const
crypto
=
require
(
'crypto'
);
const
sha256
=
require
(
'sha256'
);
const
system
=
require
(
"../system"
);
var
settings
=
require
(
"../../config/settings"
);
class
baiduClient
{
constructor
()
{
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
baiduRegClientParams
=
settings
.
baiduRegClientParams
();
}
//2020 1027 laolan 调用百度网关
async
baiduPost
(
path
,
actionBody
)
{
console
.
log
(
'actionBody++'
,
actionBody
)
let
domain
=
this
.
baiduRegClientParams
.
domain
;
let
url
=
domain
+
path
;
let
version
=
"bce-auth-v1"
;
let
accessKey
=
this
.
baiduRegClientParams
.
accessKey
;
let
secretKey
=
this
.
baiduRegClientParams
.
secretKey
;
let
timestamp
=
new
Date
().
toISOString
()
let
site
=
timestamp
.
lastIndexOf
(
"."
);
timestamp
=
timestamp
.
substring
(
0
,
site
)
+
"Z"
let
signedHeaders
=
"host"
;
let
extime
=
1800
;
let
canonicalHeaders
=
"host:"
+
this
.
baiduRegClientParams
.
host
;
//中间结果1:规范化请求和前缀字符串
var
canonicalRequest
=
null
var
pathParams
=
path
.
split
(
"?"
);
if
(
pathParams
&&
pathParams
.
length
>
1
){
canonicalRequest
=
"POST"
+
"
\
n"
+
pathParams
[
0
]
+
"
\
n"
+
pathParams
[
1
]
+
"
\
n"
+
canonicalHeaders
;
}
else
{
canonicalRequest
=
"POST"
+
"
\
n"
+
path
+
"
\
n"
+
"
\
n"
+
canonicalHeaders
;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
console
.
log
(
'canonicalRequest+++++++'
,
canonicalRequest
)
//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
);
console
.
log
(
"baiduObj+++++"
,
baiduObj
)
console
.
log
(
"url+++++"
,
url
)
console
.
log
(
"rtn+++++"
,
rtn
)
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
return
result
;
}
//百度接口 2020-10-27 laolan
async
baiduReqbyget
(
obj
,
cbk
)
{
var
path
=
obj
.
path
;
var
reqbody
=
obj
.
reqbody
;
try
{
var
res
=
await
this
.
baiduPost
(
path
,
reqbody
,
{
timeout
:
10000
,
// default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'POST'
,
// set the http method, default is GET
headers
:
{
host
:
this
.
baiduRegClientParams
.
host
},
// set the http request headers
});
console
.
log
(
'baidu++++res+++'
,
res
)
this
.
pushlogSve
.
createDb
({
op
:
"new-baiduRegReqbyget"
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
res
),
returnType
:
'1'
,
logLevel
:
'1'
,
opTitle
:
"new-baiduReqbyget推送百度信息返回成功"
});
return
system
.
getResultSuccess
(
res
);
}
catch
(
e
)
{
this
.
pushlogSve
.
createFailLogDb
({
appid
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
obj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
resultInfo
:
"error:"
+
JSON
.
stringify
(
e
),
clientIp
:
obj
.
clientIp
||
""
,
failType
:
1
,
opTitle
:
"new-baiduRegReqbyget推送百度信息返回异常"
,
pushNumber
:
obj
.
pushNumber
||
1
});
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
}
module
.
exports
=
baiduClient
;
// var task = new baiduClient();
// console.log(task.baiduRegClientParams,"11111111111111111");
\ No newline at end of file
center-channel/app/config/businessConfig.js
View file @
f60c99cf
...
...
@@ -17,7 +17,9 @@ module.exports = {
"ncSubmitMaterial"
,
"ncNotification"
,
"ncSubmitSolution"
,
"ncCloseNeed"
,
"ncClosePlan"
,
"rtSubmitMaterial"
,
"rtNotification"
,
"rtSubmitSolution"
,
"rtCloseNeed"
,
"rtClosePlan"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
"putUserPwdByMobile"
,
"icpNotifyNew"
,
//百度工商注册
"submitRegSolution"
,
"writeRegCommunicationLog"
,
"queryExpertRegCommunicationLogs"
,
"updateOrdertatus"
,
"closeBdRegNeed"
],
apiMustUserpinList
:
[
"icpOrderClose"
,
...
...
@@ -25,6 +27,8 @@ module.exports = {
"submitService"
,
"serviceProviderNotification"
,
"ncSubmitMaterial"
,
"ncNotification"
,
"ncSubmitSolution"
,
"ncCloseNeed"
,
"ncClosePlan"
,
"rtSubmitMaterial"
,
"rtNotification"
,
"rtSubmitSolution"
,
"rtCloseNeed"
,
"rtClosePlan"
,
//百度工商注册
"submitRegSolution"
,
"writeRegCommunicationLog"
,
"queryExpertRegCommunicationLogs"
,
"updateOrdertatus"
,
"closeBdRegNeed"
],
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"
,
"/api/icp/queueNotify/springBoard"
,]
}
...
...
center-channel/app/config/settings.js
View file @
f60c99cf
...
...
@@ -30,6 +30,7 @@ var settings = {
}
return
"http://43.247.184.94:7200/center_channel_req_log/_doc?pretty"
;
},
//百度icp、edi、nc、rt
baiduClientParams
:
function
()
{
if
(
this
.
env
==
'dev'
)
{
return
{
...
...
@@ -46,6 +47,23 @@ var settings = {
host
:
"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
//百度工商注册
baiduRegClientParams
:
function
()
{
if
(
this
.
env
==
'dev'
)
{
return
{
domain
:
"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
,
//开发
accessKey
:
"ed0f5c4c7c2d4e87aa335d9b07bf9bd4"
,
secretKey
:
"f600c4e91f6d43998d637401e6e34ef9"
,
host
:
"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
};
}
return
{
domain
:
"https://gwgp-nbzljnwusrw.i.bdcloudapi.com"
,
//线上
accessKey
:
"0e5abf33ef07457f8dbd779287747c0c"
,
secretKey
:
"9d86f04a85db4cdfa95ba8ad28009188"
,
host
:
"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
//工商核名请求接口配置
checkIcNameUrl
()
{
if
(
this
.
env
===
'localhost'
)
{
...
...
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