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
15d41ad8
Commit
15d41ad8
authored
May 20, 2021
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
百度公司注册套餐
parent
ae75d03e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
58 deletions
+72
-58
center-channel/app/base/service/impl/common/regCenterOrderSve.js
+24
-25
center-channel/app/base/utils/execClient.js
+32
-31
center-channel/app/base/utils/restClient.js
+16
-2
No files found.
center-channel/app/base/service/impl/common/regCenterOrderSve.js
View file @
15d41ad8
...
...
@@ -154,7 +154,7 @@ class RegCenterOrderService extends AppServiceBase {
var
salesmanObj
=
{
appInfo
:
pobj
.
appInfo
,
actionType
:
"addRegSalesmanInfo"
,
//添加业务员信息
actionBody
:
{
salesmanInfo
:
salesmanInfo
,
orderNo
:
orderrtn
.
data
.
orderNo
}
actionBody
:
{
salesmanInfo
:
salesmanInfo
,
orderNo
:
orderrtn
.
data
.
orderNo
}
};
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
var
addRes
=
await
this
.
execClient
.
execPost
(
salesmanObj
,
url
);
...
...
@@ -396,7 +396,6 @@ class RegCenterOrderService extends AppServiceBase {
}
}
}
console
.
log
(
'reg -----res -----'
,
res
)
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolutions
)
{
console
.
log
(
'reg --- res -----'
,
res
)
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
...
...
@@ -425,13 +424,13 @@ class RegCenterOrderService extends AppServiceBase {
var
list
=
{
bizId
:
channelSolutionNo
,
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
biz
Type
,
bizType
:
bizTypes
.
solution
.
reg
Type
,
solutionContent
:
bizTypes
.
solution
}
}
else
{
var
list
=
{
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
biz
Type
,
bizType
:
bizTypes
.
solution
.
reg
Type
,
solutionContent
:
bizTypes
.
solution
}
}
...
...
@@ -528,7 +527,7 @@ class RegCenterOrderService extends AppServiceBase {
note
:
pobj
.
actionBody
.
note
}
// 推送baidu
var
tmpResult
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?close="
,
reqbody
:
pushObj
});
var
tmpResult
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?close="
,
reqbody
:
pushObj
});
//查看日志
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
...
...
@@ -539,9 +538,9 @@ class RegCenterOrderService extends AppServiceBase {
resultInfo
:
JSON
.
stringify
(
tmpResult
),
optitle
:
"推送baidu-reg关闭需求返回结果->closeNeed"
,
});
if
(
result
.
data
&&
result
.
data
.
uapp_id
==
44
)
{
if
(
result
.
data
&&
result
.
data
.
uapp_id
==
44
)
{
pobj
.
appInfo
.
uapp_id
=
44
if
(
pobj
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
note
)
{
if
(
pobj
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
note
)
{
pobj
.
actionBody
[
'description'
]
=
pobj
.
actionBody
.
note
}
}
...
...
@@ -572,52 +571,52 @@ class RegCenterOrderService extends AppServiceBase {
}
}
if
(
res
.
data
.
uapp_id
==
regCfg
.
uappId
.
baidu
)
{
//2021-5-18新增套餐公司注册与正常公司注册区分
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"GSREG"
)
{
//2021-5-18新增套餐公司注册与正常公司注册区分
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"GSREG"
)
{
//推送正常公司注册数据至百度
pushObj
=
{
orderNo
:
res
.
data
.
bizId
,
status
:
res
.
data
.
deliveryContent
.
status
,
deliverContent
:
deliverContent
};
}
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"QYJYTC1"
)
{
}
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"QYJYTC1"
)
{
//推送套餐1公司注册数据至百度
pushObj
=
{
orderNo
:
res
.
data
.
bizId
,
status
:
res
.
data
.
deliveryContent
.
status
,
deliverContent
:
deliverContent
,
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
//套餐包含业的务类型: 不传为原始公司注册
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
//套餐包含业的务类型: 不传为原始公司注册
};
}
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"QYJYTC2"
)
{
}
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"QYJYTC2"
)
{
//推送套餐2公司注册数据至百度
//代理记账和地址服务需要单独的开始和结束时间
//地址服务:时间截止到天, 代理记账:时间截止到月, 时间字段都是秒
if
(
pobj
.
actionBody
.
productType
==
"DLJZ"
||
pobj
.
actionBody
.
productType
==
"DZFW"
)
{
if
(
pobj
.
actionBody
.
productType
==
"DLJZ"
||
pobj
.
actionBody
.
productType
==
"DZFW"
)
{
pushObj
=
{
orderNo
:
res
.
data
.
bizId
,
status
:
res
.
data
.
deliveryContent
.
status
,
deliverContent
:
deliverContent
,
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
,
//套餐包含业的务类型: 不传为原始公司注册
startTime
:
pobj
.
actionBody
.
startTime
,
//开始时间
endTime
:
pobj
.
actionBody
.
endTime
//结束时间
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
,
//套餐包含业的务类型: 不传为原始公司注册
startTime
:
pobj
.
actionBody
.
startTime
,
//开始时间
endTime
:
pobj
.
actionBody
.
endTime
//结束时间
};
}
else
{
}
else
{
pushObj
=
{
orderNo
:
res
.
data
.
bizId
,
status
:
res
.
data
.
deliveryContent
.
status
,
deliverContent
:
deliverContent
,
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
//套餐包含业的务类型: 不传为原始公司注册
consultType
:
pobj
.
actionBody
.
consultType
,
//需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType
:
pobj
.
actionBody
.
productType
//套餐包含业的务类型: 不传为原始公司注册
};
}
}
var
self
=
this
;
//推送交付信息/修改订单状态
var
baidu
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/comreg"
,
reqbody
:
pushObj
});
var
baidu
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/comreg"
,
reqbody
:
pushObj
});
console
.
log
(
'推送交付信息/修改订单状态baidu+++'
,
baidu
)
console
.
log
(
'推送交付信息/修改订单状态pushObj+++'
,
pushObj
)
return
baidu
.
data
...
...
@@ -704,7 +703,7 @@ class RegCenterOrderService extends AppServiceBase {
}
//-----------接入百度reg------end----------------------------------
//-----------接入百度reg------end----------------------------------
}
...
...
center-channel/app/base/utils/execClient.js
View file @
15d41ad8
...
...
@@ -21,7 +21,7 @@ class ExecClient {
//易名
this
.
cmdEnamePostPattern
=
"curl -k -H 'Content-type: application/json' -d '{data}' {url}"
;
}
getUUID
()
{
var
uuid
=
uuidv4
();
...
...
@@ -34,7 +34,7 @@ class ExecClient {
var
options
=
{
maxBuffer
:
1024
*
1024
*
20
};
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
return
{
stdout
,
stderr
};
}
...
...
@@ -71,7 +71,7 @@ class ExecClient {
console
.
log
(
cmd
);
return
cmd
;
}
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
)
{
var
requestId
=
requestId
||
this
.
getUUID
();
var
data
=
JSON
.
stringify
(
subData
);
...
...
@@ -81,13 +81,14 @@ class ExecClient {
return
cmd
;
}
async
execPost
(
subData
,
url
)
{
if
(
settings
.
env
==
'dev'
){
const
rs
=
await
axios
.
post
(
url
,
subData
);
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
}
return
ret
;
}
//本机windows curl json格式
// if (settings.env == 'dev') {
// const rs = await axios.post(url, subData);
// const ret = {
// stdout: JSON.stringify(rs.data)
// }
// return ret;
// }
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
...
...
@@ -108,12 +109,12 @@ class ExecClient {
return
result
;
}
async
execPushDataPost
(
subData
,
url
,
token
,
requestId
)
{
if
(
settings
.
env
==
'dev'
)
{
if
(
settings
.
env
==
'dev'
)
{
axios
.
defaults
.
headers
[
'token'
]
=
token
;
// axios.defaults.headers['request-id'] = requestId;
const
rs
=
await
axios
.
post
(
url
,
subData
);
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
const
rs
=
await
axios
.
post
(
url
,
subData
);
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
}
return
ret
;
}
...
...
@@ -157,32 +158,32 @@ class ExecClient {
return
result
;
}
Fetch360PostCmd
(
subData
,
url
)
{
Fetch360PostCmd
(
subData
,
url
)
{
var
cmd
=
this
.
cmd360PostPattern
.
replace
(
/
\{
data
\}
/g
,
subData
).
replace
(
/
\{
url
\}
/g
,
url
);
console
.
log
(
cmd
);
return
cmd
;
}
async
exec360GetToken
(
url
){
async
exec360GetToken
(
url
)
{
const
qs
=
require
(
'qs'
)
let
obj
=
{
"scope"
:
"smart_business"
,
"grant_type"
:
"client_credentials"
}
if
(
settings
.
env
==
'dev'
)
{
let
obj
=
{
"scope"
:
"smart_business"
,
"grant_type"
:
"client_credentials"
}
if
(
settings
.
env
==
'dev'
)
{
const
rs
=
await
axios
({
method
:
'post'
,
url
:
url
,
data
:
qs
.
stringify
(
obj
),
data
:
qs
.
stringify
(
obj
),
auth
:
{
username
:
"gongsibao"
,
password
:
"qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx"
username
:
"gongsibao"
,
password
:
"qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx"
}
})
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
}
return
ret
;
}
let
cmd
=
this
.
Fetch360PostCmd
(
qs
.
stringify
(
obj
),
url
);
let
cmd
=
this
.
Fetch360PostCmd
(
qs
.
stringify
(
obj
),
url
);
console
.
log
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
...
...
@@ -206,17 +207,17 @@ class ExecClient {
}
// 带token的url请求
async
restGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
if
(
settings
.
env
==
'dev'
)
{
async
restGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
if
(
settings
.
env
==
'dev'
)
{
axios
.
defaults
.
headers
[
'authorization'
]
=
userToken
;
const
rs
=
await
axios
.
get
(
url
,
{
params
:
subData
});
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
const
rs
=
await
axios
.
get
(
url
,
{
params
:
subData
});
const
ret
=
{
stdout
:
JSON
.
stringify
(
rs
.
data
)
}
return
ret
;
}
var
data
=
querystring
.
stringify
(
subData
);
let
cmd
=
this
.
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
data
);
let
cmd
=
this
.
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
data
);
console
.
log
(
cmd
,
"cmd............"
);
var
result
=
await
this
.
exec
(
cmd
,
{
maxBuffer
:
1024
*
1024
*
15
...
...
@@ -224,7 +225,7 @@ class ExecClient {
return
result
;
}
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
FetchrestGetWithHAuthorizationUrl
(
userToken
,
url
,
subData
)
{
var
cmd
=
this
.
cmdGetpatternToken
.
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
token
\}
/g
,
userToken
).
replace
(
/
\{
data
\}
/g
,
subData
);
return
cmd
;
...
...
center-channel/app/base/utils/restClient.js
View file @
15d41ad8
...
...
@@ -4,6 +4,7 @@ const exec = util.promisify(require('child_process').exec);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
axios
=
require
(
"axios"
);
class
RestClient
{
constructor
()
{
this
.
cmdGetPattern
=
"curl {-G} -k -d '{data}' {url}"
;
...
...
@@ -100,6 +101,19 @@ class RestClient {
return
result
;
}
async
execPost
(
subData
,
url
)
{
//本机windows curl json格式
// if (settings.env == 'dev') {
// const rs = await axios.post(url, subData, {
// auth: {
// username: "admines",
// password: "adminGSBes"
// }
// });
// const ret = {
// stdout: JSON.stringify(rs.data)
// }
// return ret;
// }
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
console
.
log
(
cmd
,
"cmd............"
);
var
result
=
await
this
.
exec
(
cmd
,
{
...
...
@@ -171,8 +185,8 @@ class RestClient {
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
}
async
execDeliveryPost
(
subdata
,
url
)
{
let
cmd
=
this
.
FetchPostCmd
(
subdata
,
url
)
async
execDeliveryPost
(
subdata
,
url
)
{
let
cmd
=
this
.
FetchPostCmd
(
subdata
,
url
)
cmd
+=
" -H 'XAPPKEY:647a68c9-da01-40d3-9763-1ffa0f64cf3f'"
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
...
...
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