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
133705b4
Commit
133705b4
authored
May 19, 2021
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
07965134
ae75d03e
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1558 additions
and
1302 deletions
+1558
-1302
center-channel/app/base/api/api.base.js
+1
-1
center-channel/app/base/api/impl/action/regapi.js
+4
-0
center-channel/app/base/api/impl/auth/taskapi.js
+2
-2
center-channel/app/base/api/impl/ic/regCfg.js
+4
-2
center-channel/app/base/api/impl/opaction/order.js
+3
-0
center-channel/app/base/api/impl/opreceive/pushAliInfo.js
+56
-0
center-channel/app/base/service/app.base.js
+1
-1
center-channel/app/base/service/impl/common/ncSve.js
+6
-0
center-channel/app/base/service/impl/common/pushlogSve.js
+1
-1
center-channel/app/base/service/impl/common/regCenterOrderSve.js
+673
-618
center-channel/app/base/service/impl/common/rtSve.js
+6
-0
center-channel/app/base/service/impl/utilsSve/utilsAliyunNoteSve.js
+38
-0
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
+5
-5
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+57
-1
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+3
-3
center-channel/app/config/businessConfig.js
+5
-1
center-channel/app/config/routes/api.js
+693
-667
No files found.
center-channel/app/base/api/api.base.js
View file @
133705b4
...
@@ -34,7 +34,7 @@ class APIBase {
...
@@ -34,7 +34,7 @@ class APIBase {
return
JSON
.
parse
(
cacheRes
);
return
JSON
.
parse
(
cacheRes
);
}
}
var
result
=
await
this
[
methodname
](
pobj
,
query
,
req
);
var
result
=
await
this
[
methodname
](
pobj
,
query
,
req
);
if
(
!
result
.
requestId
)
{
if
(
result
&&
!
result
.
requestId
)
{
result
.
requestId
=
pobj
.
RequestId
?
pobj
.
RequestId
:
pobj
.
requestId
||
req
.
requestId
;
result
.
requestId
=
pobj
.
RequestId
?
pobj
.
RequestId
:
pobj
.
requestId
||
req
.
requestId
;
}
}
this
.
logCtl
.
createDb
({
this
.
logCtl
.
createDb
({
...
...
center-channel/app/base/api/impl/action/regapi.js
View file @
133705b4
...
@@ -6,6 +6,7 @@ class RegAPI extends APIBase {
...
@@ -6,6 +6,7 @@ class RegAPI extends APIBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
regCenterOrderSve
=
system
.
getObject
(
"service.common.regCenterOrderSve"
);
this
.
regCenterOrderSve
=
system
.
getObject
(
"service.common.regCenterOrderSve"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
}
}
/**
/**
* 接口跳转-POST请求
* 接口跳转-POST请求
...
@@ -76,6 +77,9 @@ class RegAPI extends APIBase {
...
@@ -76,6 +77,9 @@ class RegAPI extends APIBase {
// opResult = await this.regCenterOrderSve.closeOrderDelivery(pobj);
// opResult = await this.regCenterOrderSve.closeOrderDelivery(pobj);
// break;
// break;
case
"againPushYf"
:
//单独重新推送数据到云服
opResult
=
await
this
.
utilsPushSve
.
business2Channel
(
pobj
,
pobj
.
opType
);
break
;
//-----------接入百度reg------end----------------------------
//-----------接入百度reg------end----------------------------
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
...
...
center-channel/app/base/api/impl/auth/taskapi.js
View file @
133705b4
...
@@ -27,7 +27,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -27,7 +27,7 @@ class AccessAuthAPI extends APIBase {
var
rtn
=
await
this
.
gatewaypushlogSve
.
taskAliIcapi
();
var
rtn
=
await
this
.
gatewaypushlogSve
.
taskAliIcapi
();
return
rtn
;
return
rtn
;
}
}
async
taskAgainFqPushInfo
(
pobj
,
qobj
,
req
)
{
//再次推送
蜂擎
业务数据
async
taskAgainFqPushInfo
(
pobj
,
qobj
,
req
)
{
//再次推送
渠道
业务数据
var
rtn
=
await
this
.
utilsPushSve
.
business2Channel
(
pobj
,
pobj
.
opType
);
var
rtn
=
await
this
.
utilsPushSve
.
business2Channel
(
pobj
,
pobj
.
opType
);
this
.
pushlogSve
.
delDbPushfaillogById
(
Number
(
pobj
.
id
||
0
));
this
.
pushlogSve
.
delDbPushfaillogById
(
Number
(
pobj
.
id
||
0
));
return
rtn
;
return
rtn
;
...
@@ -71,7 +71,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -71,7 +71,7 @@ class AccessAuthAPI extends APIBase {
self
.
taskAgainPushOneNewBusInfo
(
contentData
);
self
.
taskAgainPushOneNewBusInfo
(
contentData
);
}
else
if
(
element
.
failType
==
4
)
{
}
else
if
(
element
.
failType
==
4
)
{
self
.
taskAgainFqPushInfo
(
contentData
);
self
.
taskAgainFqPushInfo
(
contentData
);
}
//
FQ
}
//
推送渠道(如:FQ)
}
}
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
...
...
center-channel/app/base/api/impl/ic/regCfg.js
View file @
133705b4
...
@@ -109,7 +109,8 @@ var regCfg = {
...
@@ -109,7 +109,8 @@ var regCfg = {
'COLLECTING'
:
'COLLECTING'
,
//材料收集环节
'COLLECTING'
:
'COLLECTING'
,
//材料收集环节
'AUDITING'
:
'AUDITING'
,
//工商审核环节
'AUDITING'
:
'AUDITING'
,
//工商审核环节
'ENGRAVING'
:
'ENGRAVING'
,
//刻章环节
'ENGRAVING'
:
'ENGRAVING'
,
//刻章环节
'SUCCESS'
:
'SUCCESS'
//已完成
'SUCCESS'
:
'SUCCESS'
,
//已完成
'ACTIVE'
:
'ACTIVE'
//服务中
},
},
//交付状态
//交付状态
deliverStatus
:{
deliverStatus
:{
...
@@ -117,7 +118,8 @@ var regCfg = {
...
@@ -117,7 +118,8 @@ var regCfg = {
'COLLECTING'
:
'材料收集环节'
,
//
'COLLECTING'
:
'材料收集环节'
,
//
'AUDITING'
:
'工商审核环节'
,
//
'AUDITING'
:
'工商审核环节'
,
//
'ENGRAVING'
:
'刻章环节'
,
//
'ENGRAVING'
:
'刻章环节'
,
//
'SUCCESS'
:
'已完成'
//
'SUCCESS'
:
'已完成'
,
//
'ACTIVE'
:
'服务中'
//
},
},
//返回结果配置
//返回结果配置
getUUID
()
{
getUUID
()
{
...
...
center-channel/app/base/api/impl/opaction/order.js
View file @
133705b4
...
@@ -102,6 +102,9 @@ class ProductAPI extends WEBBase {
...
@@ -102,6 +102,9 @@ class ProductAPI extends WEBBase {
case
"receiveAliTmOrder"
:
//接收阿里商标订单
case
"receiveAliTmOrder"
:
//接收阿里商标订单
opResult
=
await
this
.
utilsOrderSve
.
receiveAliTmOrder
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsOrderSve
.
receiveAliTmOrder
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
case
"receiveFqbossTmOrder"
:
//接收阿里商标订单
opResult
=
await
this
.
utilsOrderSve
.
receiveFqbossTmOrder
(
pobj
,
pobj
.
actionBody
);
break
;
case
"receiveAliTmStatus"
:
//接收阿里商标状态
case
"receiveAliTmStatus"
:
//接收阿里商标状态
opResult
=
await
this
.
utilsOrderSve
.
receiveAliTmStatus
(
pobj
,
pobj
.
actionBody
);
opResult
=
await
this
.
utilsOrderSve
.
receiveAliTmStatus
(
pobj
,
pobj
.
actionBody
);
break
;
break
;
...
...
center-channel/app/base/api/impl/opreceive/pushAliInfo.js
0 → 100644
View file @
133705b4
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
PushAliInfo
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
}
/**
* 推送阿里商标跟进信息
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
tmNote
(
pobj
,
qobj
,
req
)
{
var
reqPushParams
=
{
reqbody
:
{
BizId
:
pobj
.
intentionBizId
,
Note
:
pobj
.
note
.
replace
(
/<
[^
>
]
+>/g
,
""
)
},
appInfo
:
{
uapp_id
:
18
}
};
let
result
=
await
this
.
utilsPushSve
.
business2Channel
(
reqPushParams
,
"pushAliTmNote"
);
if
(
result
&&
result
.
data
)
{
return
result
.
data
;
}
return
result
;
}
/**
* 推送阿里工商跟进信息
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
icNote
(
pobj
,
qobj
,
req
)
{
var
reqPushParams
=
{
reqbody
:
{
IntentionBizId
:
pobj
.
intentionBizId
,
Type
:
1
,
// 1需求,2订单
Note
:
pobj
.
note
.
replace
(
/<
[^
>
]
+>/g
,
""
)
},
appInfo
:
{
uapp_id
:
18
}
};
let
result
=
await
this
.
utilsPushSve
.
business2Channel
(
reqPushParams
,
"pushAliIcNote"
);
if
(
result
&&
result
.
data
)
{
return
result
.
data
;
}
return
result
;
}
}
module
.
exports
=
PushAliInfo
;
\ No newline at end of file
center-channel/app/base/service/app.base.js
View file @
133705b4
...
@@ -13,7 +13,7 @@ class AppServiceBase {
...
@@ -13,7 +13,7 @@ class AppServiceBase {
this
.
execClient
=
system
.
getObject
(
'util.execClient'
);
this
.
execClient
=
system
.
getObject
(
'util.execClient'
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
this
.
pushlogFailType
=
{
OLDRPC
:
1
,
NEWRPC
:
2
,
FAILLOG
:
3
,
FQ
:
4
};
this
.
pushlogFailType
=
{
OLDRPC
:
1
,
NEWRPC
:
2
,
FAILLOG
:
3
,
FQ
:
4
};
//1老的rpc调用,2新的rpc调用-需配置,3错误日志,4推送峰擎,5直接调用-无需配置
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
}
}
...
...
center-channel/app/base/service/impl/common/ncSve.js
View file @
133705b4
...
@@ -237,6 +237,12 @@ class NcService extends AppServiceBase {
...
@@ -237,6 +237,12 @@ class NcService extends AppServiceBase {
var
a
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
pushObj
});
var
a
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
pushObj
});
console
.
log
(
'nc closeNeed+++'
,
a
)
console
.
log
(
'nc closeNeed+++'
,
a
)
}
}
if
(
result
.
data
&&
result
.
data
.
uapp_id
==
44
){
pobj
.
appInfo
.
uapp_id
=
44
if
(
pobj
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
note
){
pobj
.
actionBody
[
'description'
]
=
pobj
.
actionBody
.
note
}
}
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
}
}
return
result
;
return
result
;
...
...
center-channel/app/base/service/impl/common/pushlogSve.js
View file @
133705b4
...
@@ -27,7 +27,7 @@ class PushlogService extends ServiceBase {
...
@@ -27,7 +27,7 @@ class PushlogService extends ServiceBase {
}
}
async
createFailLogDb
(
qobj
)
{
async
createFailLogDb
(
qobj
)
{
try
{
try
{
qobj
.
op
title
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
opt
itle
;
qobj
.
op
Title
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
opT
itle
;
this
.
pushfaillogDao
.
create
(
qobj
);
this
.
pushfaillogDao
.
create
(
qobj
);
}
catch
(
e
)
{
}
catch
(
e
)
{
//日志记录
//日志记录
...
...
center-channel/app/base/service/impl/common/regCenterOrderSve.js
View file @
133705b4
...
@@ -5,653 +5,707 @@ const AppServiceBase = require("../../app.base");
...
@@ -5,653 +5,707 @@ const AppServiceBase = require("../../app.base");
const
regCfg
=
require
(
"../../../api/impl/ic/regCfg"
);
const
regCfg
=
require
(
"../../../api/impl/ic/regCfg"
);
class
RegCenterOrderService
extends
AppServiceBase
{
class
RegCenterOrderService
extends
AppServiceBase
{
constructor
()
{
constructor
()
{
super
();
super
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
opPushQueueUrl
=
settings
.
opPushQueueUrl
();
this
.
opPushQueueUrl
=
settings
.
opPushQueueUrl
();
this
.
baiduclient
=
system
.
getObject
(
"util.baiduClient"
);
this
.
baiduclient
=
system
.
getObject
(
"util.baiduClient"
);
this
.
baiduRegClient
=
system
.
getObject
(
"util.baiduRegClient"
);
this
.
baiduRegClient
=
system
.
getObject
(
"util.baiduRegClient"
);
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
};
};
//调用center-order
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
//调用center-order
var
url
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
if
(
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
if
(
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
return
data
;
}
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
return
data
;
}
//-----------接入百度reg-----start--------laolan---2020.12.17----------------------
//-----------接入百度reg-----start--------laolan---2020.12.17----------------------
async
getSolutionByChannelOrderNo
(
pobj
,
actionBody
)
{
async
getSolutionByChannelOrderNo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100390"
);
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100390"
);
}
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
itemResult
;
return
itemResult
;
}
async
regPaySuccess
(
pobj
)
{
console
.
log
(
'regPaySuccess++++pobj----'
,
pobj
)
var
sobj
=
{
actionType
:
"getRegProducePrice"
,
actionBody
:
{
typeCode
:
pobj
.
actionBody
.
consultType
,
city
:
pobj
.
actionBody
.
area
,
taxpayerType
:
pobj
.
actionBody
.
taxpayerType
,
companyProperties
:
pobj
.
actionBody
.
companyProperties
},
appInfo
:
pobj
.
appInfo
,
actionProcess
:
pobj
.
actionProcess
}
console
.
log
(
'regPaySuccess++++sobj----'
,
sobj
)
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
console
.
log
(
'data----data----'
,
data
)
// pobj.actionBody = data.data;
// pobj.actionBody.orderNo = pobj.actionBody.bizId;
pobj
.
actionBody
.
totalSum
=
data
.
data
.
price
;
pobj
.
actionBody
.
orderPrice
=
data
.
data
.
price
;
pobj
.
actionBody
.
payTotalSum
=
data
.
data
.
price
;
pobj
.
actionBody
.
payCode
=
data
.
data
.
payCode
;
pobj
.
actionBody
.
channelItemCode
=
data
.
data
.
channelItemCode
;
pobj
.
actionBody
.
channelNeedNo
=
data
.
data
.
channelNeedNo
||
data
.
data
.
bizId
;
pobj
.
actionBody
.
needNo
=
data
.
data
.
needNo
;
pobj
.
actionBody
.
quantity
=
1
;
pobj
.
actionBody
.
channelOrder
=
{
channelServiceNo
:
pobj
.
actionBody
.
orderNo
,
channelOrderNo
:
pobj
.
actionBody
.
orderNo
,
orderStatus
:
2
}
}
console
.
log
(
'pobj.actionBody------'
,
pobj
.
actionBody
)
var
orderrtn
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
async
regPaySuccess
(
pobj
)
{
console
.
log
(
'orderrtn----'
,
orderrtn
)
console
.
log
(
'regPaySuccess++++pobj----'
,
pobj
)
if
(
orderrtn
.
status
!=
0
&&
orderrtn
.
status
!=
-
1
)
{
var
sobj
=
{
return
system
.
getResultFail
(
-
5012
,
"订单创建失败"
);
actionType
:
"getRegProducePrice"
,
}
actionBody
:
{
if
(
orderrtn
.
data
)
{
typeCode
:
pobj
.
actionBody
.
consultType
,
pobj
.
actionBody
.
orderNo
=
orderrtn
.
data
.
orderNo
;
city
:
pobj
.
actionBody
.
area
,
}
taxpayerType
:
pobj
.
actionBody
.
taxpayerType
,
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
bizId
;
companyProperties
:
pobj
.
actionBody
.
companyProperties
},
appInfo
:
pobj
.
appInfo
,
actionProcess
:
pobj
.
actionProcess
}
console
.
log
(
'regPaySuccess++++sobj----'
,
sobj
)
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
console
.
log
(
'data----data----'
,
data
)
// pobj.actionBody = data.data;
// pobj.actionBody.orderNo = pobj.actionBody.bizId;
pobj
.
actionBody
.
totalSum
=
data
.
data
.
price
;
pobj
.
actionBody
.
orderPrice
=
data
.
data
.
price
;
pobj
.
actionBody
.
payTotalSum
=
data
.
data
.
price
;
pobj
.
actionBody
.
payCode
=
data
.
data
.
payCode
;
pobj
.
actionBody
.
channelItemCode
=
data
.
data
.
channelItemCode
;
pobj
.
actionBody
.
channelNeedNo
=
data
.
data
.
channelNeedNo
||
data
.
data
.
bizId
;
pobj
.
actionBody
.
needNo
=
data
.
data
.
needNo
;
pobj
.
actionBody
.
quantity
=
1
;
pobj
.
actionBody
.
channelOrder
=
{
channelServiceNo
:
pobj
.
actionBody
.
orderNo
,
channelOrderNo
:
pobj
.
actionBody
.
orderNo
,
orderStatus
:
2
}
console
.
log
(
'pobj.actionBody------'
,
pobj
.
actionBody
)
pobj
.
actionType
=
"regReceiveSolutionPayInfo"
;
var
orderrtn
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
console
.
log
(
'orderrtn----'
,
orderrtn
)
var
solutionrtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
orderrtn
.
status
!=
0
&&
orderrtn
.
status
!=
-
1
)
{
if
(
!
solutionrtn
||
!
solutionrtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5012
,
"订单创建失败"
);
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
}
if
(
orderrtn
.
data
)
{
var
solutiondata
=
JSON
.
parse
(
solutionrtn
.
stdout
);
pobj
.
actionBody
.
orderNo
=
orderrtn
.
data
.
orderNo
;
console
.
log
(
'solutiondata----'
,
solutiondata
)
}
if
(
solutiondata
.
status
!=
0
)
{
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
bizId
;
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
pobj
.
actionType
=
"regReceiveSolutionPayInfo"
;
if
(
!
solutiondata
.
data
)
{
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
return
system
.
getResultFail
(
-
5012
,
"方案查询数据为空"
);
var
solutionrtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
}
if
(
!
solutionrtn
||
!
solutionrtn
.
stdout
)
{
if
(
solutiondata
.
data
&&
solutiondata
.
data
.
channelNeedNo
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
}
var
solutiondata
=
JSON
.
parse
(
solutionrtn
.
stdout
);
if
(
pobj
.
actionBody
.
channelItemCode
)
{
console
.
log
(
'solutiondata----'
,
solutiondata
)
pobj
.
actionBody
.
channelItemCode
=
regCfg
.
channelTypeCode
[
pobj
.
actionBody
.
channelItemCode
];
if
(
solutiondata
.
status
!=
0
)
{
}
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
var
fqobj
=
{
}
actionBody
:
{
if
(
!
solutiondata
.
data
)
{
area
:
pobj
.
actionBody
.
province
,
return
system
.
getResultFail
(
-
5012
,
"方案查询数据为空"
);
idempotentSource
:
data
.
data
.
serviceBusinessCode
,
}
orderNo
:
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
,
if
(
solutiondata
.
data
&&
solutiondata
.
data
.
channelNeedNo
)
{
orderPrice
:
Number
(
pobj
.
actionBody
.
orderPrice
/
100
),
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
phone
:
pobj
.
actionBody
.
publishMobile
,
}
needId
:
solutiondata
.
data
.
channelNeedNo
,
if
(
pobj
.
actionBody
.
channelItemCode
)
{
price_desc
:
pobj
.
actionBody
.
taxpayerType
,
pobj
.
actionBody
.
channelItemCode
=
regCfg
.
channelTypeCode
[
pobj
.
actionBody
.
channelItemCode
];
additions_desc
:
pobj
.
actionBody
.
companyProperties
,
}
// companyName:solutiondata.data.solutionContent.CompanyName || ''
var
fqobj
=
{
//2021-1-21 laolan add new
actionBody
:
{
appName
:
pobj
.
appInfo
.
app_name
||
''
,
area
:
pobj
.
actionBody
.
province
,
sku
:
data
.
data
.
service_code
||
''
idempotentSource
:
data
.
data
.
serviceBusinessCode
,
},
orderNo
:
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
,
appInfo
:
pobj
.
appInfo
orderPrice
:
Number
(
pobj
.
actionBody
.
orderPrice
/
100
),
}
phone
:
pobj
.
actionBody
.
publishMobile
,
console
.
log
(
'fqobj----'
,
fqobj
)
needId
:
solutiondata
.
data
.
channelNeedNo
,
var
baiduPushRes
=
await
this
.
utilsPushSve
.
business2Channel
(
fqobj
,
"pushOrderICPBusinessNew"
);
price_desc
:
pobj
.
actionBody
.
taxpayerType
,
var
deliveryObj
=
{
additions_desc
:
pobj
.
actionBody
.
companyProperties
,
actionBody
:
{
// companyName:solutiondata.data.solutionContent.CompanyName || ''
orderNo
:
orderrtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
//2021-1-21 laolan add new
needsolution
:
solutiondata
.
data
.
solutionContent
,
appName
:
pobj
.
appInfo
.
app_name
||
''
,
channelNeedNo
:
solutiondata
.
data
.
channelNeedNo
,
sku
:
data
.
data
.
service_code
||
''
channelSolutionNo
:
solutiondata
.
data
.
channelSolutionNo
,
},
skuCode
:
data
.
data
.
payCode
,
appInfo
:
pobj
.
appInfo
servicer
:
{
}
code
:
'gsb'
,
console
.
log
(
'fqobj----'
,
fqobj
)
name
:
'公司宝'
var
baiduPushRes
=
await
this
.
utilsPushSve
.
business2Channel
(
fqobj
,
"pushOrderICPBusinessNew"
);
}
var
deliveryObj
=
{
},
actionBody
:
{
appInfo
:
pobj
.
appInfo
orderNo
:
orderrtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
};
needsolution
:
solutiondata
.
data
.
solutionContent
,
if
(
pobj
.
actionBody
.
isDirectBuy
&&
pobj
.
actionBody
.
isDirectBuy
==
1
){
//直接下单需执行添加订单业务员操作
channelNeedNo
:
solutiondata
.
data
.
channelNeedNo
,
if
(
baiduPushRes
&&
baiduPushRes
.
status
==
0
){
channelSolutionNo
:
solutiondata
.
data
.
channelSolutionNo
,
if
(
baiduPushRes
.
data
&&
baiduPushRes
.
data
.
data
){
skuCode
:
data
.
data
.
payCode
,
var
resData
=
baiduPushRes
.
data
.
data
;
servicer
:
{
var
salesmanInfo
=
{
code
:
'gsb'
,
salesmanName
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operatorName
:
""
,
name
:
'公司宝'
salesmanChannelId
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operator
:
""
,
}
};
},
var
salesmanObj
=
{
appInfo
:
pobj
.
appInfo
appInfo
:
pobj
.
appInfo
,
};
actionType
:
"addRegSalesmanInfo"
,
//添加业务员信息
if
(
pobj
.
actionBody
.
isDirectBuy
&&
pobj
.
actionBody
.
isDirectBuy
==
1
)
{
//直接下单需执行添加订单业务员操作
actionBody
:{
salesmanInfo
:
salesmanInfo
,
orderNo
:
orderrtn
.
data
.
orderNo
}
if
(
baiduPushRes
&&
baiduPushRes
.
status
==
0
)
{
};
if
(
baiduPushRes
.
data
&&
baiduPushRes
.
data
.
data
)
{
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
var
resData
=
baiduPushRes
.
data
.
data
;
var
addRes
=
await
this
.
execClient
.
execPost
(
salesmanObj
,
url
);
var
salesmanInfo
=
{
if
(
addRes
&&
addRes
.
stdout
)
{
salesmanName
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operatorName
:
""
,
var
salesmanRes
=
JSON
.
parse
(
addRes
.
stdout
);
salesmanChannelId
:
resData
.
orderList
&&
resData
.
orderList
.
length
>
0
?
resData
.
orderList
[
0
].
operator
:
""
,
if
(
salesmanRes
.
status
==
0
)
{
};
deliveryObj
.
actionBody
.
needsolution
=
salesmanRes
.
data
;
var
salesmanObj
=
{
await
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
appInfo
:
pobj
.
appInfo
,
actionType
:
"addRegSalesmanInfo"
,
//添加业务员信息
actionBody
:
{
salesmanInfo
:
salesmanInfo
,
orderNo
:
orderrtn
.
data
.
orderNo
}
};
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
var
addRes
=
await
this
.
execClient
.
execPost
(
salesmanObj
,
url
);
if
(
addRes
&&
addRes
.
stdout
)
{
var
salesmanRes
=
JSON
.
parse
(
addRes
.
stdout
);
if
(
salesmanRes
.
status
==
0
)
{
deliveryObj
.
actionBody
.
needsolution
=
salesmanRes
.
data
;
await
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
}
}
}
}
}
}
}
else
{
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
}
}
}
return
system
.
getResultSuccess
();
}
else
{
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
}
return
system
.
getResultSuccess
();
}
// channelNeedNo获取需求详情
async
selectNeedInfo
(
pobj
){
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
itemResult
;
}
/**
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody bizId 渠道方案号
*/
async
getItemByChannelSolutionNo
(
pobj
)
{
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
itemResult
;
}
/**
* 提交需求
* @param {*} pobj
* @param {*} actionBody
*/
async
submitRegNeed
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
intentionBizId
)
{
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
}
var
sobj
=
pobj
;
sobj
.
actionType
=
"getProductTypeInfo"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5015
,
"需求类型查询失败"
);
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5016
,
"需求类型查询失败"
);
}
pobj
.
actionBody
.
service_product_id
=
data
.
data
.
service_product_id
;
pobj
.
actionBody
.
productId
=
data
.
data
.
service_product_id
;
pobj
.
actionBody
.
appName
=
pobj
.
appInfo
.
app_name
;
pobj
.
actionBody
.
type_code
=
data
.
data
.
type_code
;
pobj
.
actionBody
.
type_name
=
data
.
data
.
type_name
;
pobj
.
actionBody
.
channel_type_code
=
data
.
data
.
channel_type_code
;
pobj
.
actionBody
.
channel_type_name
=
data
.
data
.
channel_type_name
;
pobj
.
actionBody
.
idempotentId
=
pobj
.
actionBody
.
intentionBizId
;
pobj
.
actionBody
.
idempotentSourceName
=
pobj
.
appInfo
.
app_name
;
if
(
pobj
.
actionBody
.
channel_type_code
)
{
pobj
.
actionBody
.
type
=
regCfg
.
channelTypeCode
[
pobj
.
actionBody
.
channel_type_code
]
pobj
.
actionBody
.
idempotentSource
=
"baidu_gsreg"
;
}
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
pobj
.
actionBody
.
level
=
"F"
;
}
pobj
.
actionType
=
"submitRegNeed"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
pobj
.
actionBody
.
description
=
pobj
.
actionBody
.
description
+
" 成交概率:"
+
pobj
.
actionBody
.
level
if
(
pobj
.
actionBody
.
probability
)
{
pobj
.
actionBody
.
description
=
pobj
.
actionBody
.
description
+
"("
+
pobj
.
actionBody
.
probability
+
") "
}
pobj
.
actionBody
.
idempotentId
=
pobj
.
actionBody
.
intentionBizId
;
// pobj.actionBody.idempotentSource = pobj.actionBody.type;
pobj
.
actionBody
.
customerName
=
pobj
.
actionBody
.
userName
;
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushNeedICPBusinessNew"
);
}
return
result
;
}
//reg需求反馈 2.2
async
regFeedbackSubmit
(
pobj
,
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
if
(
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
}
var
self
=
this
;
pobj
.
actionType
=
"regFeedbackSubmit"
;
if
(
pobj
.
actionBody
&&
pobj
.
actionBody
.
intentionStatus
)
{
pobj
.
intentionStatus
=
pobj
.
actionBody
.
intentionStatus
;
}
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
// channelNeedNo获取需求详情
if
(
pobj
.
intentionStatus
)
{
async
selectNeedInfo
(
pobj
)
{
// 如果需求当前字段为5(已关闭)则通知fq
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
if
(
pobj
.
intentionStatus
==
5
)
{
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
self
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
return
itemResult
;
}
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
return
data
;
}
//状态更新
async
regOrderStatus
(
pobj
)
{
var
actionBody
=
pobj
.
actionBody
;
var
self
=
this
;
if
(
actionBody
.
isDirectBuy
&&
actionBody
.
isDirectBuy
==
1
)
{
actionBody
.
bizId
=
actionBody
.
orderNo
}
if
(
!
actionBody
.
bizId
)
{
return
system
.
getResult
(
null
,
"actionBody.bizId can not be empty,100495"
);
}
}
actionBody
.
BizId
=
actionBody
.
bizId
;
if
(
!
actionBody
.
status
)
{
/**
return
system
.
getResult
(
null
,
"actionBody.status can not be empty,100495"
);
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody bizId 渠道方案号
*/
async
getItemByChannelSolutionNo
(
pobj
)
{
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
itemResult
;
}
}
pobj
.
actionType
=
"regOrderStatus"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
/**
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
* 提交需求
console
.
log
(
'公司宝--rtn---'
,
rtn
)
* @param {*} pobj
if
(
actionBody
.
status
==
2
)
{
* @param {*} actionBody
var
deliveryObj
=
{
*/
actionBody
:
{
async
submitRegNeed
(
pobj
,
actionBody
)
{
orderNo
:
rtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
needsolution
:
rtn
.
data
.
solutionContent
,
if
(
!
actionBody
.
intentionBizId
)
{
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
channelSolutionNo
:
rtn
.
data
.
channelSolutionNo
,
}
servicer
:
{
var
sobj
=
pobj
;
code
:
'gsb'
,
sobj
.
actionType
=
"getProductTypeInfo"
;
name
:
'公司宝'
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
}
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
},
if
(
!
rtn
||
!
rtn
.
stdout
)
{
appInfo
:
pobj
.
appInfo
return
system
.
getResultFail
(
-
5015
,
"需求类型查询失败"
);
}
}
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5016
,
"需求类型查询失败"
);
}
pobj
.
actionBody
.
service_product_id
=
data
.
data
.
service_product_id
;
pobj
.
actionBody
.
productId
=
data
.
data
.
service_product_id
;
pobj
.
actionBody
.
appName
=
pobj
.
appInfo
.
app_name
;
pobj
.
actionBody
.
type_code
=
data
.
data
.
type_code
;
pobj
.
actionBody
.
type_name
=
data
.
data
.
type_name
;
pobj
.
actionBody
.
channel_type_code
=
data
.
data
.
channel_type_code
;
pobj
.
actionBody
.
channel_type_name
=
data
.
data
.
channel_type_name
;
pobj
.
actionBody
.
idempotentId
=
pobj
.
actionBody
.
intentionBizId
;
pobj
.
actionBody
.
idempotentSourceName
=
pobj
.
appInfo
.
app_name
;
if
(
pobj
.
actionBody
.
channel_type_code
)
{
pobj
.
actionBody
.
type
=
regCfg
.
channelTypeCode
[
pobj
.
actionBody
.
channel_type_code
]
pobj
.
actionBody
.
idempotentSource
=
"baidu_gsreg"
;
}
if
(
pobj
.
actionBody
.
description
&&
pobj
.
actionBody
.
description
.
indexOf
(
"备#"
)
<
0
)
{
pobj
.
actionBody
.
level
=
"A"
;
}
else
{
// var levelurl = "http://106.13.228.212:8000/recProbability";
// var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj
.
actionBody
.
level
=
"C"
}
if
(
pobj
.
actionBody
.
phone
==
"17319425791"
)
{
pobj
.
actionBody
.
level
=
"F"
;
}
pobj
.
actionType
=
"submitRegNeed"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
pobj
.
actionBody
.
description
=
pobj
.
actionBody
.
description
+
" 成交概率:"
+
pobj
.
actionBody
.
level
if
(
pobj
.
actionBody
.
probability
)
{
pobj
.
actionBody
.
description
=
pobj
.
actionBody
.
description
+
"("
+
pobj
.
actionBody
.
probability
+
") "
}
pobj
.
actionBody
.
idempotentId
=
pobj
.
actionBody
.
intentionBizId
;
// pobj.actionBody.idempotentSource = pobj.actionBody.type;
pobj
.
actionBody
.
customerName
=
pobj
.
actionBody
.
userName
;
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushNeedICPBusinessNew"
);
}
return
result
;
}
}
if
(
rtn
.
status
==
0
&&
actionBody
.
status
!=
1
&&
actionBody
.
status
!=
2
&&
rtn
.
data
)
{
var
tmpObj
=
{
//reg需求反馈 2.2
actionBody
:
{
async
regFeedbackSubmit
(
pobj
,
reqUrl
)
{
orderNo
:
rtn
.
data
.
orderNo
,
var
url
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
if
(
reqUrl
)
{
needsolution
:
rtn
.
data
.
solutionContent
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
},
}
appInfo
:
pobj
.
appInfo
var
self
=
this
;
}
pobj
.
actionType
=
"regFeedbackSubmit"
;
this
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushDeliveryStatusNotify"
);
if
(
pobj
.
actionBody
&&
pobj
.
actionBody
.
intentionStatus
)
{
pobj
.
actionBody
.
orderNo
=
rtn
.
data
.
orderNo
;
pobj
.
intentionStatus
=
pobj
.
actionBody
.
intentionStatus
;
if
(
actionBody
.
status
==
11
)
{
}
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
orderrtn
.
status
<
0
)
{
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
if
(
pobj
.
intentionStatus
)
{
}
// 如果需求当前字段为5(已关闭)则通知fq
tmpObj
.
actionBody
.
orderNo
=
rtn
.
data
.
channelSolutionNo
;
if
(
pobj
.
intentionStatus
==
5
)
{
self
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushOrderICPClose"
);
self
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
}
}
}
//通知更新状态
}
return
rtn
;
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
}
return
data
;
//关闭reg订单
async
regOrderClose
(
pobj
)
{
// var actionBody = pobj.actionBody;
var
self
=
this
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
rtn
.
status
==
0
&&
rtn
.
data
)
{
var
channelOrderNo
=
pobj
.
actionBody
.
orderNo
;
// pobj.actionBody.orderNo = rtn.data.orderNo;
// pobj.actionType="delOrder";
// var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
// if (orderrtn.status < 0) {
// return system.getResultFail(-5022, "订单关闭失败");
// }
var
tmpObj
=
{
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
needsolution
:
rtn
.
data
.
solutionContent
},
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushDeliveryStatusNotify"
);
// tmpObj.actionBody.orderNo = channelOrderNo;
var
tmpObj2
=
{
actionBody
:
{
orderNo
:
channelOrderNo
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
needsolution
:
rtn
.
data
.
solutionContent
},
appInfo
:
pobj
.
appInfo
};
self
.
utilsPushSve
.
business2Channel
(
tmpObj2
,
"pushOrderICPClose"
);
}
//通知更新状态
return
rtn
;
}
//--------------3.
//提交reg注册方案
async
regSubmitSolution
(
pobj
)
{
console
.
log
(
'reg --- pobj -----'
,
pobj
)
var
s
var
subSnLength
if
(
pobj
.
actionBody
.
solutionList
){
subSnLength
=
pobj
.
actionBody
.
solutionList
.
length
for
(
s
=
0
;
s
<
subSnLength
;
s
++
){
if
(
!
pobj
.
actionBody
.
solutionList
[
s
].
solutionContent
.
solution
.
channelSolutionNo
){
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
}
else
{
pobj
.
actionType
=
"updateSolution"
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
)
async
regOrderStatus
(
pobj
)
{
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
var
actionBody
=
pobj
.
actionBody
;
var
needsolutions
=
res
.
data
.
needsolutions
;
//方案信息
var
self
=
this
;
var
self
=
this
;
var
bizTypes
;
if
(
actionBody
.
isDirectBuy
&&
actionBody
.
isDirectBuy
==
1
)
{
var
solutionList
=
[];
actionBody
.
bizId
=
actionBody
.
orderNo
if
(
needinfo
.
uapp_id
==
regCfg
.
uappId
.
baidu
){
}
//推送数据至baidu
if
(
!
actionBody
.
bizId
)
{
var
i
=
0
;
return
system
.
getResult
(
null
,
"actionBody.bizId can not be empty,100495"
);
var
needsolutionsLength
=
needsolutions
.
length
;
}
var
channelSolutionNo
;
actionBody
.
BizId
=
actionBody
.
bizId
;
for
(
i
=
0
;
i
<
needsolutionsLength
;
i
++
){
if
(
!
actionBody
.
status
)
{
bizTypes
=
needsolutions
[
i
].
solutionContent
;
return
system
.
getResult
(
null
,
"actionBody.status can not be empty,100495"
);
console
.
log
(
'bizTypes-----'
,
bizTypes
)
}
console
.
log
(
'bizTypes type-----'
,
typeof
(
bizTypes
))
pobj
.
actionType
=
"regOrderStatus"
;
if
(
typeof
(
bizTypes
)
==
'string'
){
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
bizTypes
=
JSON
.
parse
(
bizTypes
)
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
console
.
log
(
'公司宝--rtn---'
,
rtn
)
if
(
actionBody
.
status
==
2
)
{
var
deliveryObj
=
{
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
//pobj.actionBody.channelOrder.channelOrderNo,
needsolution
:
rtn
.
data
.
solutionContent
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
channelSolutionNo
:
rtn
.
data
.
channelSolutionNo
,
servicer
:
{
code
:
'gsb'
,
name
:
'公司宝'
}
},
appInfo
:
pobj
.
appInfo
}
}
bizTypes
.
solution
.
area
=
regCfg
.
baiduAreaCode
[
bizTypes
.
solution
.
area
]
this
.
utilsPushSve
.
business2Channel
(
deliveryObj
,
"pushDeliveryOrder"
);
bizTypes
.
solution
.
serviceArea
=
bizTypes
.
solution
.
area
}
bizTypes
.
solution
.
isWhether
=
true
//是否刻章,必带刻章true
if
(
rtn
.
status
==
0
&&
actionBody
.
status
!=
1
&&
actionBody
.
status
!=
2
&&
rtn
.
data
)
{
//根据前端传参channelSolutionNo判断是新建方案还是修改方案
var
tmpObj
=
{
if
(
pobj
.
actionBody
.
solutionList
[
i
].
solutionContent
.
solution
.
channelSolutionNo
){
actionBody
:
{
channelSolutionNo
=
pobj
.
actionBody
.
solutionList
[
i
].
solutionContent
.
solution
.
channelSolutionNo
orderNo
:
rtn
.
data
.
orderNo
,
var
list
=
{
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
bizId
:
channelSolutionNo
,
needsolution
:
rtn
.
data
.
solutionContent
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
},
bizType
:
bizTypes
.
bizType
,
appInfo
:
pobj
.
appInfo
solutionContent
:
bizTypes
.
solution
}
}
else
{
var
list
=
{
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
bizType
,
solutionContent
:
bizTypes
.
solution
}
}
}
solutionList
.
push
(
list
)
this
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushDeliveryStatusNotify"
);
}
pobj
.
actionBody
.
orderNo
=
rtn
.
data
.
orderNo
;
if
(
actionBody
.
status
==
11
)
{
var
pushObj
=
{
var
orderrtn
=
await
self
.
utilsOrderSve
.
delOrder
(
pobj
,
pobj
.
actionBody
);
intentionBizId
:
needinfo
.
channelNeedNo
,
if
(
orderrtn
.
status
<
0
)
{
solutionList
:
solutionList
return
system
.
getResultFail
(
-
5022
,
"订单关闭失败"
);
};
}
console
.
log
(
'pushObj---pushObj---'
,
pushObj
)
tmpObj
.
actionBody
.
orderNo
=
rtn
.
data
.
channelSolutionNo
;
var
pushBaiduRegSolution
=
await
this
.
pushBaiduRegSolution
(
pushObj
,
pobj
.
appInfo
,
self
);
self
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushOrderICPClose"
);
console
.
log
(
'pushBaiduRegSolution+++'
,
pushBaiduRegSolution
)
}
if
(
pushBaiduRegSolution
.
status
!=
0
){
}
//通知更新状态
return
system
.
getResultFail
(
-
101
,
pushBaiduRegSolution
.
msg
)
return
rtn
;
}
}
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/submitSolution"
,
content
:
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
needinfo
),
optitle
:
"createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
needinfo
.
channelNeedNo
,
status
:
"createSolution"
},
appInfo
:
pobj
.
appInfo
}
await
this
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
}
return
res
;
}
//推送reg方案
async
pushBaiduRegSolution
(
pushObj
,
appInfo
,
self
)
{
console
.
log
(
'pushObj++baidu+++'
,
pushObj
)
//推送方案信息
var
pushRes
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?submitSolutions="
,
reqbody
:
pushObj
});
console
.
log
(
"pushRes----"
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
&&
pushRes
.
data
.
data
&&
pushRes
.
data
.
data
.
infos
)
{
var
reqObj2
=
{
actionType
:
"saveReginfo"
,
appInfo
:
appInfo
,
actionBody
:
{
infos
:
pushRes
.
data
.
data
.
infos
}
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id,用户确认方案url
console
.
log
(
"保存渠道方案id,用户确认方案url aaaa++ "
,
a
)
}
}
return
pushRes
.
data
;
}
//关闭reg订单
//reg关闭需求
async
regOrderClose
(
pobj
)
{
async
regNeedClose
(
pobj
)
{
// var actionBody = pobj.actionBody;
pobj
.
actionBody
.
intentionBizId
=
pobj
.
actionBody
.
channelNeedNo
;
pobj
.
actionType
=
"regNeedClose"
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'regNeedClose+++result'
,
result
)
if
(
result
&&
result
.
status
==
0
)
{
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
channelNeedNo
,
status
:
"closeNeed"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
//日志记录
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/regNeedClose"
,
content
:
JSON
.
stringify
(
reqParams
),
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
var
pushObj
=
{
intentionBizId
:
pobj
.
actionBody
.
channelNeedNo
,
note
:
pobj
.
actionBody
.
note
}
console
.
log
(
'pushObj----/////'
,
pushObj
)
// 推送baidu
var
a
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?close="
,
reqbody
:
pushObj
});
console
.
log
(
'regNeedClose+++a----'
,
a
)
//查看日志
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/regNeedClose"
,
content
:
JSON
.
stringify
(
a
),
resultInfo
:
""
,
optitle
:
"推送baidu-reg关闭需求->closeNeed"
,
});
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
}
return
result
;
}
//提交交付信息/修改订单状态
async
regUpdateOrderStatus
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
console
.
log
(
'推送交付信息/修改订单状态res+++++'
,
res
)
console
.
log
(
'推送交付信息/修改订单状态++pobj+++'
,
pobj
)
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
var
deliverContent
if
(
pobj
.
actionBody
.
deliverContent
){
if
(
pobj
.
actionBody
.
deliverContent
.
companyInfo
&&
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
){
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
=
regCfg
.
baiduAreaCode
[
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
]
}
deliverContent
=
{
applicationFormUrl
:
pobj
.
actionBody
.
deliverContent
.
applicationFormUrl
||
""
,
//公司注册申请登记表文件
registDocumentsUrl
:
pobj
.
actionBody
.
deliverContent
.
registDocumentsUrl
||
""
,
//注册文件
baseInfo
:
pobj
.
actionBody
.
deliverContent
.
baseInfo
||
{},
//基本信息
companyInfo
:
pobj
.
actionBody
.
deliverContent
.
companyInfo
||
{}
//公司信息
}
}
if
(
res
.
data
.
uapp_id
==
regCfg
.
uappId
.
baidu
){
//推送数据至百度
var
pushObj
=
{
orderNo
:
res
.
data
.
bizId
,
status
:
res
.
data
.
deliveryContent
.
status
,
deliverContent
:
deliverContent
};
var
self
=
this
;
var
self
=
this
;
//推送交付信息/修改订单状态
var
url
=
settings
.
centerOrderUrl
()
+
"action/regapi/springBoard"
;
var
baidu
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/comreg"
,
reqbody
:
pushObj
});
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
console
.
log
(
'推送交付信息/修改订单状态baidu+++'
,
baidu
)
if
(
rtn
.
status
==
0
&&
rtn
.
data
)
{
console
.
log
(
'推送交付信息/修改订单状态pushObj+++'
,
pushObj
)
var
channelOrderNo
=
pobj
.
actionBody
.
orderNo
;
return
baidu
.
data
// pobj.actionBody.orderNo = rtn.data.orderNo;
}
// pobj.actionType="delOrder";
console
.
log
(
'rsrsr++++------------++++'
,
res
)
// var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
// if (orderrtn.status < 0) {
// return system.getResultFail(-5022, "订单关闭失败");
// }
var
tmpObj
=
{
actionBody
:
{
orderNo
:
rtn
.
data
.
orderNo
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
needsolution
:
rtn
.
data
.
solutionContent
},
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
business2Channel
(
tmpObj
,
"pushDeliveryStatusNotify"
);
// tmpObj.actionBody.orderNo = channelOrderNo;
var
tmpObj2
=
{
actionBody
:
{
orderNo
:
channelOrderNo
,
channelNeedNo
:
rtn
.
data
.
channelNeedNo
,
needsolution
:
rtn
.
data
.
solutionContent
},
appInfo
:
pobj
.
appInfo
};
self
.
utilsPushSve
.
business2Channel
(
tmpObj2
,
"pushOrderICPClose"
);
}
//通知更新状态
return
rtn
;
}
}
return
res
}
//--------------3.
//提交reg注册方案
async
regSubmitSolution
(
pobj
)
{
//reg回写沟通记录
console
.
log
(
'reg --- pobj -----'
,
pobj
)
async
regWriteCommunicationLog
(
pobj
)
{
var
s
console
.
log
(
'reg回写沟通记录---'
,
pobj
)
var
subSnLength
var
self
=
this
;
var
res
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
if
(
pobj
.
actionBody
.
solutionList
)
{
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
subSnLength
=
pobj
.
actionBody
.
solutionList
.
length
console
.
log
(
'reg回写沟通记录--result---'
,
result
)
for
(
s
=
0
;
s
<
subSnLength
;
s
++
)
{
var
pushObj
=
{}
if
(
!
pobj
.
actionBody
.
solutionList
[
s
].
solutionContent
.
solution
.
channelSolutionNo
)
{
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
pushObj
=
{
}
else
{
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
pobj
.
actionType
=
"updateSolution"
note
:
pobj
.
actionBody
.
note
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
}
}
if
(
result
.
data
==
regCfg
.
uappId
.
baidu
)
{
}
var
ress
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?addCommRecord="
,
reqbody
:
pushObj
});
}
if
(
ress
.
data
.
status
!=
0
){
console
.
log
(
'reg -----res -----'
,
res
)
return
system
.
getResultFail
(
ress
.
data
.
msg
)
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolutions
)
{
}
console
.
log
(
'reg --- res -----'
,
res
)
console
.
log
(
"regWriteCommunicationLog---------"
,
ress
)
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
}
var
needsolutions
=
res
.
data
.
needsolutions
;
//方案信息
var
self
=
this
;
var
bizTypes
;
var
solutionList
=
[];
if
(
needinfo
.
uapp_id
==
regCfg
.
uappId
.
baidu
)
{
//推送数据至baidu
var
i
=
0
;
var
needsolutionsLength
=
needsolutions
.
length
;
var
channelSolutionNo
;
for
(
i
=
0
;
i
<
needsolutionsLength
;
i
++
)
{
bizTypes
=
needsolutions
[
i
].
solutionContent
;
console
.
log
(
'bizTypes-----'
,
bizTypes
)
console
.
log
(
'bizTypes type-----'
,
typeof
(
bizTypes
))
if
(
typeof
(
bizTypes
)
==
'string'
)
{
bizTypes
=
JSON
.
parse
(
bizTypes
)
}
bizTypes
.
solution
.
area
=
regCfg
.
baiduAreaCode
[
bizTypes
.
solution
.
area
]
bizTypes
.
solution
.
serviceArea
=
bizTypes
.
solution
.
area
bizTypes
.
solution
.
isWhether
=
true
//是否刻章,必带刻章true
//根据前端传参channelSolutionNo判断是新建方案还是修改方案
if
(
pobj
.
actionBody
.
solutionList
[
i
].
solutionContent
.
solution
.
channelSolutionNo
)
{
channelSolutionNo
=
pobj
.
actionBody
.
solutionList
[
i
].
solutionContent
.
solution
.
channelSolutionNo
var
list
=
{
bizId
:
channelSolutionNo
,
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
bizType
,
solutionContent
:
bizTypes
.
solution
}
}
else
{
var
list
=
{
gsbBizId
:
needsolutions
[
i
].
solutionNo
,
bizType
:
bizTypes
.
bizType
,
solutionContent
:
bizTypes
.
solution
}
}
solutionList
.
push
(
list
)
}
var
pushObj
=
{
intentionBizId
:
needinfo
.
channelNeedNo
,
solutionList
:
solutionList
};
console
.
log
(
'pushObj---pushObj---'
,
pushObj
)
var
pushBaiduRegSolution
=
await
this
.
pushBaiduRegSolution
(
pushObj
,
pobj
.
appInfo
,
self
);
console
.
log
(
'pushBaiduRegSolution+++'
,
pushBaiduRegSolution
)
if
(
pushBaiduRegSolution
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
101
,
pushBaiduRegSolution
.
msg
)
}
}
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/submitSolution"
,
content
:
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
needinfo
),
optitle
:
"createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
needinfo
.
channelNeedNo
,
status
:
"createSolution"
},
appInfo
:
pobj
.
appInfo
}
await
this
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
}
return
res
;
}
}
//推送交付系统
//推送reg方案
var
reqParams
=
{
async
pushBaiduRegSolution
(
pushObj
,
appInfo
,
self
)
{
actionBody
:
{
console
.
log
(
'pushObj++baidu+++'
,
pushObj
)
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
//推送方案信息
status
:
"followingUp"
var
pushRes
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
},
path
:
"/v1/provider/demand?submitSolutions="
,
opType
:
"updateChanceStatus"
,
reqbody
:
pushObj
appInfo
:
pobj
.
appInfo
});
console
.
log
(
"pushRes----"
,
pushRes
)
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
&&
pushRes
.
data
.
data
&&
pushRes
.
data
.
data
.
infos
)
{
var
reqObj2
=
{
actionType
:
"saveReginfo"
,
appInfo
:
appInfo
,
actionBody
:
{
infos
:
pushRes
.
data
.
data
.
infos
}
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id,用户确认方案url
console
.
log
(
"保存渠道方案id,用户确认方案url aaaa++ "
,
a
)
}
return
pushRes
.
data
;
}
}
self
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
var
fqobj
=
{
//reg关闭需求
actionBody
:
{
async
regNeedClose
(
pobj
)
{
"bizId"
:
pobj
.
actionBody
.
intentionBizId
,
pobj
.
actionBody
.
intentionBizId
=
pobj
.
actionBody
.
channelNeedNo
;
"follow_date"
:
(
new
Date
()).
toISOString
(),
pobj
.
actionType
=
"regNeedClose"
"follow_content"
:
pobj
.
actionBody
.
note
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
},
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
opType
:
"aliFollowup"
,
console
.
log
(
'regNeedClose+++result'
,
result
)
appInfo
:
pobj
.
appInfo
if
(
result
&&
result
.
status
==
0
)
{
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
channelNeedNo
,
status
:
"closeNeed"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
}
this
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
//日志记录
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/regNeedClose"
,
content
:
JSON
.
stringify
(
reqParams
),
resultInfo
:
""
,
optitle
:
"updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery"
,
});
var
pushObj
=
{
intentionBizId
:
pobj
.
actionBody
.
channelNeedNo
,
note
:
pobj
.
actionBody
.
note
}
// 推送baidu
var
tmpResult
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?close="
,
reqbody
:
pushObj
});
//查看日志
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"service/impl/common/regCenterOrderSve.js/regNeedClose"
,
content
:
JSON
.
stringify
(
pushObj
),
resultInfo
:
JSON
.
stringify
(
tmpResult
),
optitle
:
"推送baidu-reg关闭需求返回结果->closeNeed"
,
});
if
(
result
.
data
&&
result
.
data
.
uapp_id
==
44
){
pobj
.
appInfo
.
uapp_id
=
44
if
(
pobj
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
note
){
pobj
.
actionBody
[
'description'
]
=
pobj
.
actionBody
.
note
}
}
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
}
return
result
;
}
}
self
.
utilsPushSve
.
business2Channel
(
fqobj
,
"aliFollowup"
);
return
result
}
//提交交付信息/修改订单状态
async
regUpdateOrderStatus
(
pobj
)
{
//reg查询沟通记录
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
,
"action/regapi/springBoard"
);
async
regQueryExpertCommunicationLogs
(
pobj
)
{
console
.
log
(
'推送交付信息/修改订单状态res+++++'
,
res
)
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
console
.
log
(
'推送交付信息/修改订单状态++pobj+++'
,
pobj
)
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
deliverContent
=
{}
console
.
log
(
'jilu+++result++++'
,
result
)
var
pushObj
=
{}
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
)
{
if
(
res
&&
res
.
status
==
0
&&
res
.
data
)
{
var
pushObj
=
{};
if
(
pobj
.
actionBody
.
deliverContent
)
{
if
(
result
.
data
.
uapp_id
==
regCfg
.
uappId
.
baidu
)
{
if
(
pobj
.
actionBody
.
deliverContent
.
companyInfo
&&
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
)
{
console
.
log
(
"bbbbb++"
,
pobj
)
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
=
regCfg
.
baiduAreaCode
[
pobj
.
actionBody
.
deliverContent
.
companyInfo
.
serviceArea
]
pushObj
=
{
}
beginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
deliverContent
=
{
endTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
applicationFormUrl
:
pobj
.
actionBody
.
deliverContent
.
applicationFormUrl
||
""
,
//公司注册申请登记表文件
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
registDocumentsUrl
:
pobj
.
actionBody
.
deliverContent
.
registDocumentsUrl
||
""
,
//注册文件
}
baseInfo
:
pobj
.
actionBody
.
deliverContent
.
baseInfo
||
{},
//基本信息
var
res
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
companyInfo
:
pobj
.
actionBody
.
deliverContent
.
companyInfo
||
{}
//公司信息
path
:
"/v1/provider/demand?listCommRecords="
,
reqbody
:
pushObj
});
}
console
.
log
(
'xxcc+++'
,
res
)
}
}
if
(
res
.
data
.
uapp_id
==
regCfg
.
uappId
.
baidu
)
{
//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"
){
//推送套餐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
//套餐包含业的务类型: 不传为原始公司注册
};
}
if
(
pobj
.
actionBody
.
consultType
&&
pobj
.
actionBody
.
consultType
==
"QYJYTC2"
){
//推送套餐2公司注册数据至百度
//代理记账和地址服务需要单独的开始和结束时间
//地址服务:时间截止到天, 代理记账:时间截止到月, 时间字段都是秒
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
//结束时间
};
}
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
//套餐包含业的务类型: 不传为原始公司注册
};
}
}
var
self
=
this
;
//推送交付信息/修改订单状态
var
baidu
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/comreg"
,
reqbody
:
pushObj
});
console
.
log
(
'推送交付信息/修改订单状态baidu+++'
,
baidu
)
console
.
log
(
'推送交付信息/修改订单状态pushObj+++'
,
pushObj
)
return
baidu
.
data
}
console
.
log
(
'rsrsr++++------------++++'
,
res
)
}
return
res
}
//reg回写沟通记录
async
regWriteCommunicationLog
(
pobj
)
{
console
.
log
(
'reg回写沟通记录---'
,
pobj
)
var
self
=
this
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'reg回写沟通记录--result---'
,
result
)
var
pushObj
=
{}
if
(
result
&&
result
.
status
==
0
&&
result
.
data
)
{
pushObj
=
{
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
note
:
pobj
.
actionBody
.
note
}
if
(
result
.
data
==
regCfg
.
uappId
.
baidu
)
{
var
ress
=
await
self
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?addCommRecord="
,
reqbody
:
pushObj
});
if
(
ress
.
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
ress
.
data
.
msg
)
}
console
.
log
(
"regWriteCommunicationLog---------"
,
ress
)
}
}
//推送交付系统
var
reqParams
=
{
actionBody
:
{
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
,
status
:
"followingUp"
},
opType
:
"updateChanceStatus"
,
appInfo
:
pobj
.
appInfo
}
self
.
utilsPushSve
.
business2Channel
(
reqParams
,
"updateChanceStatus"
);
var
fqobj
=
{
actionBody
:
{
"bizId"
:
pobj
.
actionBody
.
intentionBizId
,
"follow_date"
:
(
new
Date
()).
toISOString
(),
"follow_content"
:
pobj
.
actionBody
.
note
},
opType
:
"aliFollowup"
,
appInfo
:
pobj
.
appInfo
}
self
.
utilsPushSve
.
business2Channel
(
fqobj
,
"aliFollowup"
);
return
result
}
}
if
(
res
&&
res
.
data
&&
res
.
data
.
infos
){
//reg查询沟通记录
res
.
data
[
'Data'
]
=
res
.
data
.
infos
async
regQueryExpertCommunicationLogs
(
pobj
)
{
var
reqUrl
=
this
.
centerOrderUrl
+
"action/regapi/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
'jilu+++result++++'
,
result
)
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
uapp_id
)
{
var
pushObj
=
{};
if
(
result
.
data
.
uapp_id
==
regCfg
.
uappId
.
baidu
)
{
console
.
log
(
"bbbbb++"
,
pobj
)
pushObj
=
{
beginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
endTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
intentionBizId
:
pobj
.
actionBody
.
intentionBizId
}
var
res
=
await
this
.
baiduRegClient
.
baiduReqbyget
({
path
:
"/v1/provider/demand?listCommRecords="
,
reqbody
:
pushObj
});
console
.
log
(
'xxcc+++'
,
res
)
}
}
if
(
res
&&
res
.
data
&&
res
.
data
.
infos
)
{
res
.
data
[
'Data'
]
=
res
.
data
.
infos
}
return
system
.
getResultSuccess
(
res
);
}
}
return
system
.
getResultSuccess
(
res
);
}
//-----------接入百度reg------end----------------------------------
//-----------接入百度reg------end----------------------------------
}
}
module
.
exports
=
RegCenterOrderService
;
module
.
exports
=
RegCenterOrderService
;
\ No newline at end of file
center-channel/app/base/service/impl/common/rtSve.js
View file @
133705b4
...
@@ -240,6 +240,12 @@ class RtService extends AppServiceBase {
...
@@ -240,6 +240,12 @@ class RtService extends AppServiceBase {
var
a
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
pushObj
});
var
a
=
await
this
.
baiduclient
.
baiduReqbyget
({
path
:
"/api/bla/provider/requirement/update"
,
reqbody
:
pushObj
});
console
.
log
(
'rt closeNeed+++'
,
a
)
console
.
log
(
'rt closeNeed+++'
,
a
)
}
}
if
(
result
.
data
&&
result
.
data
.
uapp_id
==
44
){
pobj
.
appInfo
.
uapp_id
=
44
if
(
pobj
&&
pobj
.
actionBody
&&
pobj
.
actionBody
.
note
){
pobj
.
actionBody
[
'description'
]
=
pobj
.
actionBody
.
note
}
}
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
this
.
utilsPushSve
.
business2Channel
(
pobj
,
"pushCloseICPNeed"
);
}
}
return
result
;
return
result
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsAliyunNoteSve.js
0 → 100644
View file @
133705b4
const
AppServiceBase
=
require
(
"../../app.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
system
=
require
(
"../../../system"
);
class
UtilsAliyunInfoService
extends
AppServiceBase
{
constructor
()
{
super
();
}
async
sendAliyunInfoByNeedId
(
pobj
)
{
let
verifyResult
=
await
this
.
opAliyunRpcVerifyParam
(
pobj
);
if
(
verifyResult
.
status
!=
0
)
{
return
verifyResult
;
}
let
interface_params
=
verifyResult
.
data
;
let
params
=
{
action
:
interface_params
.
action
,
reqbody
:
pobj
.
reqbody
,
rpcParam
:
{}
}
if
(
interface_params
.
accessKeyId
)
{
params
.
rpcParam
.
accessKeyId
=
interface_params
.
accessKeyId
;
}
if
(
interface_params
.
accessKeySecret
)
{
params
.
rpcParam
.
accessKeySecret
=
interface_params
.
accessKeySecret
;
}
if
(
interface_params
.
endpoint
)
{
params
.
rpcParam
.
endpoint
=
interface_params
.
endpoint
;
}
if
(
interface_params
.
apiVersion
)
{
params
.
rpcParam
.
apiVersion
=
interface_params
.
apiVersion
;
}
let
aliResult
=
await
this
.
opAliyunRpcReq
(
pobj
,
params
);
return
await
this
.
disposePushResult
(
pobj
,
aliResult
,
"ali->sendAliyunInfoByNeedId->aliResult"
,
this
.
pushlogFailType
.
FQ
);
}
}
module
.
exports
=
UtilsAliyunInfoService
;
center-channel/app/base/service/impl/utilsSve/utilsNeedSve2.js
View file @
133705b4
...
@@ -25,10 +25,10 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -25,10 +25,10 @@ class UtilsNeedService2 extends AppServiceBase {
//this.baseCenterOrderSve = system.getObject("service.common.baseCenterOrderSve");
//this.baseCenterOrderSve = system.getObject("service.common.baseCenterOrderSve");
}
}
/**
/**
* icp关闭需求
* icp关闭需求
* @param {*} pobj
* @param {*} pobj
* @param {*} actionBody
* @param {*} actionBody
*/
*/
async
needCloseIcp
(
pobj
,
actionBody
)
{
async
needCloseIcp
(
pobj
,
actionBody
)
{
console
.
log
(
'guanbi icp xuqiu pobj+++'
,
pobj
)
console
.
log
(
'guanbi icp xuqiu pobj+++'
,
pobj
)
if
(
actionBody
.
uapp_id
==
uappId
.
ali
)
{
if
(
actionBody
.
uapp_id
==
uappId
.
ali
)
{
...
@@ -185,7 +185,7 @@ class UtilsNeedService2 extends AppServiceBase {
...
@@ -185,7 +185,7 @@ class UtilsNeedService2 extends AppServiceBase {
if
(
result
.
data
.
uapp_id
==
uappId
.
ename
)
{
// yiming / ename
if
(
result
.
data
.
uapp_id
==
uappId
.
ename
)
{
// yiming / ename
console
.
log
(
"queryExpertApplyCommunicationLogs---ename---pobj--"
,
pobj
)
console
.
log
(
"queryExpertApplyCommunicationLogs---ename---pobj--"
,
pobj
)
console
.
log
(
'settings.enameClientUrl()+"queryExpertApplyCommunicationLogs"----'
,
settings
.
enameClientUrl
()
+
"queryExpertApplyCommunicationLogs"
)
console
.
log
(
'settings.enameClientUrl()+"queryExpertApplyCommunicationLogs"----'
,
settings
.
enameClientUrl
()
+
"queryExpertApplyCommunicationLogs"
)
var
res
=
await
self
.
execClient
.
execEnamePost
({
var
res
=
await
self
.
execClient
.
execEnamePost
({
BeginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
BeginTime
:
pobj
.
actionBody
.
BeginTime
?
pobj
.
actionBody
.
BeginTime
:
""
,
EndTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
EndTime
:
pobj
.
actionBody
.
EndTime
?
pobj
.
actionBody
.
EndTime
:
""
,
BizId
:
pobj
.
actionBody
.
intentionBizId
,
BizId
:
pobj
.
actionBody
.
intentionBizId
,
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
133705b4
...
@@ -1729,6 +1729,16 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -1729,6 +1729,16 @@ class UtilsOrderService extends AppServiceBase {
* @param {*} actionBody
* @param {*} actionBody
*/
*/
async
receiveAliTmOrder
(
pobj
,
actionBody
)
{
async
receiveAliTmOrder
(
pobj
,
actionBody
)
{
var
res
=
await
this
.
receiveFqbossTmOrder
(
pobj
,
actionBody
);
return
res
;
}
/**
* 接收蜂擎boss商标订单
* @param {*} pobj
* @param {*} actionBody
*/
async
receiveFqbossTmOrder
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
channelItemCode
)
{
if
(
!
actionBody
.
channelItemCode
)
{
return
system
.
getResult
(
null
,
"产品编码有误,100010"
);
return
system
.
getResult
(
null
,
"产品编码有误,100010"
);
}
}
...
@@ -1743,12 +1753,58 @@ class UtilsOrderService extends AppServiceBase {
...
@@ -1743,12 +1753,58 @@ class UtilsOrderService extends AppServiceBase {
}
}
pobj
.
productInfo
=
productItemResult
.
data
.
data
;
pobj
.
productInfo
=
productItemResult
.
data
.
data
;
pobj
.
productInfo
.
price_item
=
pobj
.
productInfo
.
price_list
[
0
];
pobj
.
productInfo
.
price_item
=
pobj
.
productInfo
.
price_list
[
0
];
pobj
.
actionType
=
"receive
Ali
TmOrder"
;
pobj
.
actionType
=
"receive
Fqboss
TmOrder"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
&&
result
.
status
==
0
){
if
(
pobj
.
appInfo
&&
pobj
.
appInfo
.
uapp_id
!=
18
&&
!
pobj
.
actionBody
.
serviceOrderNo
){
//京东云自助商标注册
await
this
.
pushChannelOrder2fq
(
pobj
);
}
}
return
result
;
return
result
;
}
}
async
pushChannelOrder2fq
(
pobj
)
{
try
{
var
yfobj
=
{
actionBody
:
{
idempotentSource
:
pobj
.
productInfo
.
service_business_code
||
''
,
//渠道来源 N
quantity
:
1
,
//数量 N
needId
:
pobj
.
actionBody
.
needNo
||
''
,
//需求id N
contactsName
:
pobj
.
actionBody
.
contactsName
||
''
,
//联系人名称 N
companyName
:
pobj
.
actionBody
.
applyName
||
''
,
//公司名称 N
scope
:
"商标自助订单进行备案,不用做任何处理"
,
// N
orderNo
:
pobj
.
actionBody
.
channelOrderNo
,
orderPrice
:
300
,
//写死 自助300
phone
:
pobj
.
actionBody
.
contactsMobile
,
appName
:
pobj
.
appInfo
.
app_name
||
''
,
sku
:
'125855508212158464'
//写死 自助一个
},
appInfo
:
pobj
.
appInfo
};
//yfPushRes.data.data
// {"contractNo":null,"orderNos":["20010618850"],"orderList":[{"operator_name":"系统用户","operatorName":"系统用户","operator":"124496450905186304","order_id":"20010618850","order_no":"20010618850","orderNo":"20010618850","message":"success","contractNo":null}]}
var
yfPushRes
=
await
this
.
utilsPushSve
.
business2Channel
(
yfobj
,
"pushOrderICPBusinessNew"
);
//日志记录
this
.
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"企服通渠道订单推送至蜂擎:,method=pushChannelOrder2fq"
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/pushChannelOrder2fq"
,
content
:
"参数:"
+
JSON
.
stringify
(
pobj
)
+
";返回结果:"
+
JSON
.
stringify
(
yfPushRes
),
clientIp
:
""
});
}
catch
(
e
)
{
//日志记录
this
.
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"企服通渠道订单推送至蜂擎异常:,method=pushChannelOrder2fq"
,
op
:
"service/impl/utilsSve/utilsOrderSve.js/pushChannelOrder2fq---error"
,
content
:
"参数:"
+
JSON
.
stringify
(
pobj
)
+
";异常信息:"
+
JSON
.
stringify
(
e
.
stack
),
clientIp
:
""
});
console
.
log
(
"service/impl/utilsSve/utilsOrderSve.js/pushChannelOrder2fq推送异常"
,
e
.
stack
);
}
}
/**
/**
* 接收阿里订单退款信息git
* 接收阿里订单退款信息git
* @param {*} pobj
* @param {*} pobj
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
133705b4
...
@@ -14,7 +14,7 @@ class UtilsPushService extends AppServiceBase {
...
@@ -14,7 +14,7 @@ class UtilsPushService extends AppServiceBase {
let
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
let
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
pobj
.
interface_info
=
productItemInterfaceResult
.
data
;
pobj
.
interface_info
=
productItemInterfaceResult
.
data
;
//日志记录
//日志记录
this
.
execClientNew
.
execLogs
(
`
${
pobj
.
opType
}
推送蜂擎获取的接口信息->business2Channel->app(getAppInterface)`
,
pobj
,
"center-channel-utilsPushSve-business2Channel"
,
productItemInterfaceResult
.
data
,
null
);
this
.
execClientNew
.
execLogs
(
`
${
opType
}
推送蜂擎获取的接口信息->business2Channel->app(getAppInterface)`
,
pobj
,
"center-channel-utilsPushSve-business2Channel"
,
productItemInterfaceResult
.
data
,
null
);
if
(
pobj
.
interface_info
&&
pobj
.
interface_info
.
length
>
0
)
{
if
(
pobj
.
interface_info
&&
pobj
.
interface_info
.
length
>
0
)
{
let
tmpResult
=
await
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
let
tmpResult
=
await
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
return
system
.
getResultSuccess
(
tmpResult
);
return
system
.
getResultSuccess
(
tmpResult
);
...
@@ -73,11 +73,11 @@ class UtilsPushService extends AppServiceBase {
...
@@ -73,11 +73,11 @@ class UtilsPushService extends AppServiceBase {
try
{
try
{
if
(
interface_info
.
interface_type
==
"bd"
)
{
if
(
interface_info
.
interface_type
==
"bd"
)
{
if
(
!
interface_info
.
method_name
)
{
if
(
!
interface_info
.
method_name
)
{
return
system
.
getResult
(
null
,
"
产品接口参数信息有误
,100350"
);
return
system
.
getResult
(
null
,
"
接口对应的method_name参数信息为空
,100350"
);
}
//操作的方法名称
}
//操作的方法名称
var
invokeObj
=
system
.
getObject
(
interface_info
.
interface_url
);
var
invokeObj
=
system
.
getObject
(
interface_info
.
interface_url
);
if
(
!
invokeObj
[
interface_info
.
method_name
])
{
if
(
!
invokeObj
[
interface_info
.
method_name
])
{
return
system
.
getResult
(
null
,
"
产品接口
参数方法信息有误,100360"
);
return
system
.
getResult
(
null
,
"
接口对应的method_name
参数方法信息有误,100360"
);
}
}
pobj
.
interface_params
=
interface_info
.
params
;
pobj
.
interface_params
=
interface_info
.
params
;
var
params
=
[
pobj
];
var
params
=
[
pobj
];
...
...
center-channel/app/config/businessConfig.js
View file @
133705b4
...
@@ -18,7 +18,7 @@ module.exports = {
...
@@ -18,7 +18,7 @@ module.exports = {
"rtSubmitMaterial"
,
"rtNotification"
,
"rtSubmitSolution"
,
"rtCloseNeed"
,
"rtClosePlan"
,
"rtSubmitMaterial"
,
"rtNotification"
,
"rtSubmitSolution"
,
"rtCloseNeed"
,
"rtClosePlan"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"getParamsFor360"
,
"addOrderWeb"
,
"getPayRecords"
,
"getLoginInfo"
,
"putUserMobileByVcode"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
,
"getOrderStatisticsByUappId"
,
"getOrderStatisticsByProduct"
,
"getOrdersComparison"
,
"getOrdersComparisonList"
,
"putUserPwdByMobile"
,
"icpNotifyNew"
,
"getOrderStatisticsByUappId"
,
"getOrderStatisticsByProduct"
,
"getOrdersComparison"
,
"getOrdersComparisonList"
,
"importOrders"
,
"importNeeds"
,
"receiveAliTmOrder"
,
"receiveAliTmOrderRefund"
,
"receiveAliTmStatus"
,
"importOrders"
,
"importNeeds"
,
"receiveAliTmOrder"
,
"receiveFqbossTmOrder"
,
"receiveAliTmOrderRefund"
,
"receiveAliTmStatus"
,
//百度工商注册
//百度工商注册
"regGetInfoByChannelNeedNo"
,
"submitRegNeed"
,
"regFeedbackSubmit"
,
"regOrderStatus"
,
"regOrderClose"
,
"regGetInfoByChannelNeedNo"
,
"submitRegNeed"
,
"regFeedbackSubmit"
,
"regOrderStatus"
,
"regOrderClose"
,
"getSolutionByChannelOrderNo"
,
"regSubmitSolution"
,
"regNeedClose"
,
"getSolutionByChannelOrderNo"
,
"regSubmitSolution"
,
"regNeedClose"
,
...
@@ -58,6 +58,10 @@ module.exports = {
...
@@ -58,6 +58,10 @@ module.exports = {
"/api/tm/status/notify"
,
"/api/tm/status/notify"
,
"/api/tm/tmcase/nbtzreceiveAssistTmData"
,
"/api/tm/tmcase/nbtzreceiveAssistTmData"
,
"/api/tm/tmcase/nbtzreceiveEditAssistTmData"
"/api/tm/tmcase/nbtzreceiveEditAssistTmData"
],
apiAliSendKeyPathList
:
[
"/api/opreceive/pushAliInfo/tmNote"
,
"/api/opreceive/pushAliInfo/icNote"
,
]
]
},
},
AREACOMM
:
{
AREACOMM
:
{
...
...
center-channel/app/config/routes/api.js
View file @
133705b4
...
@@ -6,700 +6,725 @@ const utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
...
@@ -6,700 +6,725 @@ const utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
const
signSve
=
system
.
getObject
(
"service.common.signSve"
);
const
signSve
=
system
.
getObject
(
"service.common.signSve"
);
const
xml2js
=
require
(
'xml2js'
);
const
xml2js
=
require
(
'xml2js'
);
const
jwt
=
require
(
'jsonwebtoken'
);
const
jwt
=
require
(
'jsonwebtoken'
);
const
{
PDICT
}
=
require
(
"../../config/businessConfig"
);
const
{
PDICT
}
=
require
(
"../../config/businessConfig"
);
const
settings
=
require
(
"../../config/settings"
);
const
settings
=
require
(
"../../config/settings"
);
module
.
exports
=
function
(
app
)
{
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式---------web---------开始
//-----------------------新的模式---------web---------开始
app
.
use
(
'/tlpay/aliPayNotify'
,
async
function
(
req
,
res
)
{
//钉钉接入的搁浅
app
.
use
(
'/tlpay/aliPayNotify'
,
async
function
(
req
,
res
)
{
//钉钉接入的搁浅
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
opH5AliDingPayBackNotify
(
req
.
body
,
client_ip
);
var
result
=
await
utilsOrderSve
.
opH5AliDingPayBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录阿里钉钉支付回调处理结果"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录阿里钉钉支付回调处理结果"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
if
(
result
.
status
!=
0
)
{
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
return
res
.
end
(
"FAIL"
);
}
}
return
res
.
end
(
"success"
);
return
res
.
end
(
"success"
);
}
catch
(
error
)
{
}
catch
(
error
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"阿里钉钉支付回调处理异常"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"阿里钉钉支付回调处理异常"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
error
.
stack
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
app
.
use
(
'/tlpay/notify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/tlpay/notify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
receiveCallBackNotify
(
req
.
body
,
client_ip
);
var
result
=
await
utilsOrderSve
.
receiveCallBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果:,method="
+
req
.
body
.
trxcode
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/notify"
,
op
:
"center-channel/tlpay/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
if
(
result
.
status
!=
0
)
{
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
return
res
.
end
(
"FAIL"
);
}
}
return
res
.
end
(
"success"
);
return
res
.
end
(
"success"
);
}
catch
(
error
)
{
}
catch
(
error
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/notify"
,
op
:
"center-channel/tlpay/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
app
.
use
(
'/tlpay/opBackNotify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/tlpay/opBackNotify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
opBackNotify
(
req
.
body
,
client_ip
);
var
result
=
await
utilsOrderSve
.
opBackNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/opBackNotify"
,
op
:
"center-channel/tlpay/opBackNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调处理订单结果:"
+
JSON
.
stringify
(
result
),
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调处理订单结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
}
catch
(
error
)
{
}
catch
(
error
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"center-channel/tlpay/opBackNotify"
,
op
:
"center-channel/tlpay/opBackNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
//----------------------飞书小程序---------------------------------------------开始
//----------------------飞书小程序---------------------------------------------开始
//飞书通知
//飞书通知
app
.
use
(
'/feishu/notify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/feishu/notify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsFeishuSve
.
notify
(
req
.
body
);
var
result
=
await
utilsFeishuSve
.
notify
(
req
.
body
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果,method=notify"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果,method=notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
var
returnObj
=
JSON
.
stringify
(
result
);
var
returnObj
=
JSON
.
stringify
(
result
);
return
res
.
end
(
returnObj
);
return
res
.
end
(
returnObj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果异常:,method=notify"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果异常:,method=notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
app
.
use
(
'/feishu/login'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/feishu/login'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
result
=
system
.
getResult
(
null
,
"login fail"
);
var
result
=
system
.
getResult
(
null
,
"login fail"
);
// console.log(req,"/feishu/login++++++++++++++++++++++++++++++++++++++");
// console.log(req,"/feishu/login++++++++++++++++++++++++++++++++++++++");
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
pobj
=
req
.
query
;
var
pobj
=
req
.
query
;
var
token
=
pobj
.
state
||
""
;
var
token
=
pobj
.
state
||
""
;
if
(
!
token
)
{
if
(
!
token
)
{
result
.
msg
=
"req headers token can not be empty"
;
result
.
msg
=
"req headers token can not be empty"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
getCache
(
token
,
system
.
exTime
);
var
result
=
await
cacheManager
[
"AppTokenByHostsCache"
].
getCache
(
token
,
system
.
exTime
);
if
(
result
.
status
!=
0
)
{
if
(
result
.
status
!=
0
)
{
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
pobj
.
appInfo
=
result
.
data
;
pobj
.
appInfo
=
result
.
data
;
result
=
await
utilsFeishuSve
.
checkAndLogin
(
req
,
pobj
);
result
=
await
utilsFeishuSve
.
checkAndLogin
(
req
,
pobj
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果,method=login"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果,method=login"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
pobj
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
content
:
"回调参数:"
+
JSON
.
stringify
(
pobj
)
+
"回调结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
var
returnObj
=
JSON
.
stringify
(
result
);
var
returnObj
=
JSON
.
stringify
(
result
);
return
res
.
end
(
returnObj
);
return
res
.
end
(
returnObj
);
}
catch
(
error
)
{
}
catch
(
error
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果异常:,method=login"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"飞书小程序记录回调处理结果异常:,method=login"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
op
:
"app/config/routes/api.js/feishu/notify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
query
)
+
"error:"
+
error
.
stack
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
query
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
//----------------------飞书小程序---------------------------------------------结束
//----------------------飞书小程序---------------------------------------------结束
// app-ali支付回调通知
// app-ali支付回调通知
app
.
use
(
'/orderNotify/aliPayNotify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/orderNotify/aliPayNotify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
utilsOrderSve
.
aliPayNotify
(
req
.
body
,
client_ip
);
var
result
=
await
utilsOrderSve
.
aliPayNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录支付宝回调处理结果 api层"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录支付宝回调处理结果 api层"
,
op
:
"center-channel/orderNotify/aliPayNotify"
,
op
:
"center-channel/orderNotify/aliPayNotify"
,
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
if
(
result
.
status
!=
0
)
{
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
return
res
.
end
(
"FAIL"
);
}
}
return
res
.
end
(
"success"
);
return
res
.
end
(
"success"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"支付宝回调处理异常 api层"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"支付宝回调处理异常 api层"
,
op
:
"center-channel/orderNotify/aliPayNotify"
,
op
:
"center-channel/orderNotify/aliPayNotify"
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
// app-wx支付回调
// app-wx支付回调
app
.
use
(
'/orderNotify/wxPayNotify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/orderNotify/wxPayNotify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
body
=
""
;
var
body
=
""
;
req
.
on
(
'data'
,
function
(
data
)
{
req
.
on
(
'data'
,
function
(
data
)
{
body
+=
data
;
body
+=
data
;
});
});
req
.
on
(
'end'
,
async
function
()
{
req
.
on
(
'end'
,
async
function
()
{
xml2js
.
parseString
(
body
,
{
trim
:
true
,
explicitArray
:
false
,
explicitRoot
:
false
},
async
function
(
err
,
json
)
{
xml2js
.
parseString
(
body
,
{
var
client_ip
=
system
.
get_client_ip
(
req
);
trim
:
true
,
var
result
=
await
utilsOrderSve
.
wxPayNotify
(
json
);
explicitArray
:
false
,
logCtl
.
info
({
explicitRoot
:
false
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录微信支付回调处理结果"
,
},
async
function
(
err
,
json
)
{
op
:
"center-channel/orderNotify/wxPayNotify"
,
var
client_ip
=
system
.
get_client_ip
(
req
);
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
var
result
=
await
utilsOrderSve
.
wxPayNotify
(
json
);
clientIp
:
client_ip
||
""
logCtl
.
info
({
});
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录微信支付回调处理结果"
,
if
(
result
.
status
!=
0
)
{
op
:
"center-channel/orderNotify/wxPayNotify"
,
return
res
.
end
(
"FAIL"
);
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
}
clientIp
:
client_ip
||
""
return
res
.
end
(
"success"
);
});
})
if
(
result
.
status
!=
0
)
{
return
res
.
end
(
"FAIL"
);
}
return
res
.
end
(
"success"
);
})
})
})
}
catch
(
e
)
{
}
catch
(
e
)
{
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"微信回调处理异常"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"微信回调处理异常"
,
op
:
"center-channel/orderNotify/wxPayNotify"
,
op
:
"center-channel/orderNotify/wxPayNotify"
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
app
.
use
(
'/orderNotify/channelPayNotify'
,
async
function
(
req
,
res
)
{
app
.
use
(
'/orderNotify/channelPayNotify'
,
async
function
(
req
,
res
)
{
try
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
let
result
=
{};
let
result
=
{};
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
result
=
await
utilsOrderSve
.
channelPayNotify
(
req
.
body
,
client_ip
);
logCtl
.
info
({
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道支付订单通知 api层"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
content
:
"支付回调处理结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
var
returnObj
=
JSON
.
stringify
(
result
);
var
returnObj
=
JSON
.
stringify
(
result
);
return
res
.
end
(
returnObj
);
return
res
.
end
(
returnObj
);
}
catch
(
e
)
{
}
catch
(
e
)
{
var
client_ip
=
system
.
get_client_ip
(
req
);
var
client_ip
=
system
.
get_client_ip
(
req
);
logCtl
.
error
({
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道订单支付通知处理异常"
,
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"渠道订单支付通知处理异常"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
op
:
"center-channel/orderNotify/channelPayNotify"
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
content
:
"回调参数:req="
+
JSON
.
stringify
(
req
)
+
"error:"
+
e
.
stack
,
clientIp
:
client_ip
||
""
clientIp
:
client_ip
||
""
});
});
}
}
});
});
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
app
.
all
(
"/web/*"
,
async
function
(
req
,
res
,
next
)
{
const
self
=
this
;
const
self
=
this
;
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
if
(
req
.
method
!=
"POST"
)
{
if
(
req
.
method
!=
"POST"
)
{
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
if
(
!
req
.
body
.
actionType
)
{
if
(
!
req
.
body
.
actionType
)
{
result
.
msg
=
"actionType can not be empty"
;
result
.
msg
=
"actionType can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
// 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉
// 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
,
"test"
,
"getIndustries"
,
"getSecondIndustries"
,
"getQualificationByIndustry"
,
"counselling"
,
"queryTradeProduceList"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
,
"test"
,
"getIndustries"
,
"getSecondIndustries"
,
"getQualificationByIndustry"
,
"counselling"
,
"queryTradeProduceList"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
next
();
next
();
return
;
return
;
}
}
if
(
req
.
body
.
actionType
==
"receiveCallBackNotify"
)
{
if
(
req
.
body
.
actionType
==
"receiveCallBackNotify"
)
{
req
.
body
.
actionBody
.
app_hosts
=
req
.
host
;
req
.
body
.
actionBody
.
app_hosts
=
req
.
host
;
next
();
next
();
return
;
return
;
}
}
var
token
=
req
.
headers
[
"token"
]
||
""
;
var
token
=
req
.
headers
[
"token"
]
||
""
;
if
(
!
token
)
{
if
(
!
token
)
{
result
.
msg
=
"req headers token can not be empty"
;
result
.
msg
=
"req headers token can not be empty"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
//校验jwt产生的token
//校验jwt产生的token
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
let
token_secret_str
=
null
;
let
token_secret_str
=
null
;
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
}
else
{
}
else
{
token_secret_str
=
decoded
.
token_secret
;
token_secret_str
=
decoded
.
token_secret
;
}
}
});
});
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
if
(
decryptResult
.
status
!=
0
)
{
if
(
decryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
}
}
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
body
.
actionProcess
=
tmpAppInfo
.
app_code
;
req
.
body
.
actionProcess
=
tmpAppInfo
.
app_code
;
//去除缓存,改用jwt模式
//去除缓存,改用jwt模式
// var cacheManager = system.getObject("db.common.cacheManager");
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// if (result.status != 0) {
// if (result.status != 0) {
// res.end(JSON.stringify(result));
// res.end(JSON.stringify(result));
// return;
// return;
// }
// }
// req.body.appInfo = result.data;
// req.body.appInfo = result.data;
// req.body.actionProcess = result.data.app_code;
// req.body.actionProcess = result.data.app_code;
if
(
PDICT
.
webMustUserpinList
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
(
PDICT
.
webMustUserpinList
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
if
(
!
userpin
)
{
if
(
!
userpin
)
{
result
.
status
=
system
.
noLogin
;
result
.
status
=
system
.
noLogin
;
result
.
msg
=
"req headers userpin can not be empty"
;
result
.
msg
=
"req headers userpin can not be empty"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
let
userpin_secret_str
=
null
;
let
userpin_secret_str
=
null
;
jwt
.
verify
(
userpin
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
jwt
.
verify
(
userpin
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,error:"
+
err
));
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,error:"
+
err
));
}
else
{
}
else
{
userpin_secret_str
=
decoded
.
userpin_secret
;
userpin_secret_str
=
decoded
.
userpin_secret
;
}
}
});
});
let
userDecryptResult
=
await
utilsAuthSve
.
decryptInfo
(
userpin_secret_str
);
let
userDecryptResult
=
await
utilsAuthSve
.
decryptInfo
(
userpin_secret_str
);
if
(
userDecryptResult
.
status
!=
0
)
{
if
(
userDecryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,fail:"
+
userDecryptResult
.
msg
));
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,fail:"
+
userDecryptResult
.
msg
));
}
}
let
tmpUserInfo
=
JSON
.
parse
(
userDecryptResult
.
data
);
let
tmpUserInfo
=
JSON
.
parse
(
userDecryptResult
.
data
);
req
.
body
.
userInfo
=
tmpUserInfo
;
req
.
body
.
userInfo
=
tmpUserInfo
;
if
(
req
.
body
.
actionType
===
"getLoginInfo"
)
{
if
(
req
.
body
.
actionType
===
"getLoginInfo"
)
{
result
=
system
.
getResultSuccess
(
tmpUserInfo
);
result
=
system
.
getResultSuccess
(
tmpUserInfo
);
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
// var params = {
// var params = {
// "appInfo": req.body.appInfo,
// "appInfo": req.body.appInfo,
// "actionType": "getLoginInfo",
// "actionType": "getLoginInfo",
// "actionBody": {
// "actionBody": {
// "userpin": userpin
// "userpin": userpin
// }
// }
// }
// }
// result = await utilsAuthSve.getLoginInfo(params, params.actionBody);
// result = await utilsAuthSve.getLoginInfo(params, params.actionBody);
// if (result.status != 0) {
// if (result.status != 0) {
// result.status = system.noLogin;
// result.status = system.noLogin;
// result.msg = "user login is invalidation";
// result.msg = "user login is invalidation";
// res.end(JSON.stringify(result));
// res.end(JSON.stringify(result));
// return;
// return;
// }
// }
// req.body.userInfo = result.data;
// req.body.userInfo = result.data;
}
//需要用户登录
}
//需要用户登录
next
();
next
();
});
});
app
.
get
(
'/web/:gname/:qname/:method'
,
function
(
req
,
res
)
{
app
.
get
(
'/web/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
var
methodName
=
req
.
params
[
"method"
];
var
gname
=
req
.
params
[
"gname"
];
var
gname
=
req
.
params
[
"gname"
];
classPath
=
gname
+
"."
+
classPath
;
classPath
=
gname
+
"."
+
classPath
;
var
tClientIp
=
system
.
get_client_ip
(
req
);
var
tClientIp
=
system
.
get_client_ip
(
req
);
req
.
clientIp
=
tClientIp
;
req
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
req
.
classname
=
classPath
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
classname
=
classPath
;
var
params
=
[];
var
params
=
[];
params
.
push
(
gname
);
params
.
push
(
gname
);
params
.
push
(
methodName
);
params
.
push
(
methodName
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
params
.
push
(
req
);
var
p
=
null
;
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
app
.
post
(
'/web/:gname/:qname/:method'
,
function
(
req
,
res
)
{
app
.
post
(
'/web/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
var
methodName
=
req
.
params
[
"method"
];
var
gname
=
req
.
params
[
"gname"
];
var
gname
=
req
.
params
[
"gname"
];
var
params
=
[];
var
params
=
[];
classPath
=
gname
+
"."
+
classPath
;
classPath
=
gname
+
"."
+
classPath
;
var
tClientIp
=
system
.
get_client_ip
(
req
);
var
tClientIp
=
system
.
get_client_ip
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
classname
=
classPath
;
req
.
classname
=
classPath
;
params
.
push
(
gname
);
params
.
push
(
gname
);
params
.
push
(
methodName
);
params
.
push
(
methodName
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
params
.
push
(
req
);
var
p
=
null
;
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
//-----------------------新的模式---------web---------结束
//-----------------------新的模式---------web---------结束
//-----------------------新的模式---------api---------开始
//-----------------------新的模式---------api---------开始
//百度手动获取签名sign方法
//百度手动获取签名sign方法
// app.post("/baidu/creatSign", async function (req, res, next) {
// app.post("/baidu/creatSign", async function (req, res, next) {
// if (!req.body.key) {
// if (!req.body.key) {
// res.end({ code: -200, message: "缺少加签秘钥key参数" });
// res.end({ code: -200, message: "缺少加签秘钥key参数" });
// return;
// return;
// }
// }
// if (!req.body.obj) {
// if (!req.body.obj) {
// res.end({ code: -200, message: "缺少obj参数" });
// res.end({ code: -200, message: "缺少obj参数" });
// return;
// return;
// }
// }
// let obj = req.body.obj;
// let obj = req.body.obj;
// let key = req.body.key;
// let key = req.body.key;
// let result = await signSve.createSign(obj, key);
// let result = await signSve.createSign(obj, key);
// res.end(JSON.stringify(result));
// res.end(JSON.stringify(result));
// return;
// return;
// });
// });
app
.
all
(
"/api/*"
,
async
function
(
req
,
res
,
next
)
{
app
.
all
(
"/api/*"
,
async
function
(
req
,
res
,
next
)
{
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
if
(
req
.
method
!=
"POST"
)
{
if
(
req
.
method
!=
"POST"
)
{
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
if
(
PDICT
.
apiSecretPathList
.
indexOf
(
req
.
originalUrl
)
>=
0
)
{
console
.
log
(
req
.
originalUrl
,
"sy-------------------------------00001"
);
//TODO:验证数据签名
if
(
PDICT
.
apiAliSendKeyPathList
.
indexOf
(
req
.
originalUrl
)
>=
0
)
{
var
appkey
=
req
.
headers
[
"appkey"
]
||
""
;
//验证数据key
if
(
!
appkey
)
{
var
appkey
=
req
.
headers
[
"appkey"
]
||
""
;
result
.
msg
=
"req headers appkey can not be empty"
;
if
(
!
appkey
)
{
result
.
data
=
null
;
result
.
msg
=
"req headers appkey can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
result
.
data
=
null
;
return
;
res
.
end
(
JSON
.
stringify
(
result
));
}
return
;
var
sign
=
req
.
headers
[
"sign"
]
||
""
;
}
if
(
!
sign
)
{
if
(
appkey
!=
"201912031344"
)
{
result
.
msg
=
"req headers sign can not be empty"
;
result
.
msg
=
"req appkey verify error"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
//1.通过appkey 获取appInfo
next
();
var
appRes
=
await
signSve
.
getAppInfoByAppKey
(
appkey
);
return
;
if
(
!
appRes
||
appRes
.
status
!=
0
)
{
}
result
.
msg
=
"获取应用信息失败"
;
if
(
PDICT
.
apiSecretPathList
.
indexOf
(
req
.
originalUrl
)
>=
0
)
{
result
.
data
=
null
;
//验证数据签名
res
.
end
(
JSON
.
stringify
(
result
));
var
appkey
=
req
.
headers
[
"appkey"
]
||
""
;
return
;
if
(
!
appkey
)
{
}
result
.
msg
=
"req headers appkey can not be empty"
;
var
appInfo
=
appRes
.
data
;
result
.
data
=
null
;
//2.通过appsecret 验签
res
.
end
(
JSON
.
stringify
(
result
));
req
.
body
.
sign
=
sign
;
return
;
var
signParams
=
req
.
body
;
}
var
verifyRes
=
await
signSve
.
verifySign
(
req
.
body
,
appInfo
.
uapp_secret
);
var
sign
=
req
.
headers
[
"sign"
]
||
""
;
if
(
verifyRes
&&
verifyRes
.
status
==
0
)
{
if
(
!
sign
)
{
req
.
body
.
appInfo
=
appInfo
;
result
.
msg
=
"req headers sign can not be empty"
;
req
.
appInfo
=
appInfo
;
result
.
data
=
null
;
req
.
actionProcess
=
appInfo
.
app_code
;
res
.
end
(
JSON
.
stringify
(
result
));
next
();
return
;
return
;
}
}
else
{
//1.通过appkey 获取appInfo
res
.
end
(
JSON
.
stringify
(
verifyRes
));
var
appRes
=
await
signSve
.
getAppInfoByAppKey
(
appkey
);
return
;
if
(
!
appRes
||
appRes
.
status
!=
0
)
{
}
result
.
msg
=
"获取应用信息失败"
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
return
;
}
var
appInfo
=
appRes
.
data
;
//2.通过appsecret 验签
req
.
body
.
sign
=
sign
;
var
signParams
=
req
.
body
;
var
verifyRes
=
await
signSve
.
verifySign
(
req
.
body
,
appInfo
.
uapp_secret
);
if
(
verifyRes
&&
verifyRes
.
status
==
0
)
{
req
.
body
.
appInfo
=
appInfo
;
req
.
appInfo
=
appInfo
;
req
.
actionProcess
=
appInfo
.
app_code
;
next
();
return
;
}
else
{
res
.
end
(
JSON
.
stringify
(
verifyRes
));
return
;
}
}
}
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
,
"getTmNclFilterSearch"
,
"feedback"
,
"accountingInfo"
,
"booksInfo"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
,
"getTmNclFilterSearch"
,
"feedback"
,
"accountingInfo"
,
"booksInfo"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
next
();
next
();
return
;
return
;
}
}
if
(
req
.
path
.
indexOf
(
"/taskapi/"
)
>=
0
)
{
if
(
req
.
path
.
indexOf
(
"/taskapi/"
)
>=
0
)
{
next
();
next
();
return
;
return
;
}
}
if
(
!
req
.
body
.
actionType
)
{
if
(
!
req
.
body
.
actionType
)
{
result
.
msg
=
"actionType can not be empty"
;
result
.
msg
=
"actionType can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
var
token
=
req
.
headers
[
"token"
]
||
""
;
var
token
=
req
.
headers
[
"token"
]
||
""
;
if
(
!
token
)
{
if
(
!
token
)
{
result
.
msg
=
"req headers token can not be empty"
;
result
.
msg
=
"req headers token can not be empty"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
//校验jwt产生的token
//校验jwt产生的token
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
let
token_secret_str
=
null
;
let
token_secret_str
=
null
;
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
}
else
{
}
else
{
token_secret_str
=
decoded
.
token_secret
;
token_secret_str
=
decoded
.
token_secret
;
}
}
});
});
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
if
(
decryptResult
.
status
!=
0
)
{
if
(
decryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
}
}
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
body
.
actionProcess
=
tmpAppInfo
.
app_code
;
req
.
body
.
actionProcess
=
tmpAppInfo
.
app_code
;
// var cacheManager = system.getObject("db.common.cacheManager");
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// if (result.status != 0) {
// if (result.status != 0) {
// res.end(JSON.stringify(result));
// res.end(JSON.stringify(result));
// return;
// return;
// }
// }
// req.body.appInfo = result.data;
// req.body.appInfo = result.data;
// req.body.actionProcess = result.data.app_code;
// req.body.actionProcess = result.data.app_code;
if
(
PDICT
.
apiMustUserpinList
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
if
(
PDICT
.
apiMustUserpinList
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
if
(
!
userpin
)
{
if
(
!
userpin
)
{
result
.
status
=
system
.
noLogin
;
result
.
status
=
system
.
noLogin
;
result
.
msg
=
"req headers userpin can not be empty"
;
result
.
msg
=
"req headers userpin can not be empty"
;
result
.
data
=
null
;
result
.
data
=
null
;
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
// var params = {
// var params = {
// "appInfo": req.body.appInfo,
// "appInfo": req.body.appInfo,
// "actionType": "getLoginInfo",
// "actionType": "getLoginInfo",
// "actionBody": {
// "actionBody": {
// "userpin": userpin
// "userpin": userpin
// }
// }
// }
// }
// result = await utilsAuthSve.getLoginInfo(params, params.actionBody);
// result = await utilsAuthSve.getLoginInfo(params, params.actionBody);
// if (result.status != 0) {
// if (result.status != 0) {
// result.status = system.noLogin;
// result.status = system.noLogin;
// result.msg = "user login is invalidation";
// result.msg = "user login is invalidation";
// res.end(JSON.stringify(result));
// res.end(JSON.stringify(result));
// return;
// return;
// }
// }
let
userpin_secret_str
=
null
;
let
userpin_secret_str
=
null
;
jwt
.
verify
(
userpin
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
jwt
.
verify
(
userpin
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,error:"
+
err
));
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,error:"
+
err
));
}
else
{
}
else
{
userpin_secret_str
=
decoded
.
userpin_secret
;
userpin_secret_str
=
decoded
.
userpin_secret
;
}
}
});
});
let
userDecryptResult
=
await
utilsAuthSve
.
decryptInfo
(
userpin_secret_str
);
let
userDecryptResult
=
await
utilsAuthSve
.
decryptInfo
(
userpin_secret_str
);
if
(
userDecryptResult
.
status
!=
0
)
{
if
(
userDecryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,fail:"
+
userDecryptResult
.
msg
));
return
res
.
send
(
system
.
getResultFail
(
system
.
noLogin
,
"Failed to authenticate userpin,fail:"
+
userDecryptResult
.
msg
));
}
}
let
tmpUserInfo
=
JSON
.
parse
(
userDecryptResult
.
data
);
let
tmpUserInfo
=
JSON
.
parse
(
userDecryptResult
.
data
);
req
.
body
.
userInfo
=
tmpUserInfo
;
req
.
body
.
userInfo
=
tmpUserInfo
;
if
(
req
.
body
.
actionType
===
"getLoginInfo"
)
{
if
(
req
.
body
.
actionType
===
"getLoginInfo"
)
{
result
=
system
.
getResultSuccess
(
tmpUserInfo
);
result
=
system
.
getResultSuccess
(
tmpUserInfo
);
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
}
//需要用户登录
}
//需要用户登录
next
();
next
();
});
});
app
.
get
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
app
.
get
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
var
methodName
=
req
.
params
[
"method"
];
var
gname
=
req
.
params
[
"gname"
];
var
gname
=
req
.
params
[
"gname"
];
classPath
=
gname
+
"."
+
classPath
;
classPath
=
gname
+
"."
+
classPath
;
var
tClientIp
=
system
.
get_client_ip
(
req
);
var
tClientIp
=
system
.
get_client_ip
(
req
);
req
.
clientIp
=
tClientIp
;
req
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
req
.
classname
=
classPath
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
classname
=
classPath
;
var
params
=
[];
var
params
=
[];
params
.
push
(
gname
);
params
.
push
(
gname
);
params
.
push
(
methodName
);
params
.
push
(
methodName
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
params
.
push
(
req
);
var
p
=
null
;
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
app
.
post
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
app
.
post
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
var
methodName
=
req
.
params
[
"method"
];
var
gname
=
req
.
params
[
"gname"
];
var
gname
=
req
.
params
[
"gname"
];
var
params
=
[];
var
params
=
[];
classPath
=
gname
+
"."
+
classPath
;
classPath
=
gname
+
"."
+
classPath
;
var
tClientIp
=
system
.
get_client_ip
(
req
);
var
tClientIp
=
system
.
get_client_ip
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
uagent
=
req
.
headers
[
"user-agent"
];
req
.
classname
=
classPath
;
req
.
classname
=
classPath
;
params
.
push
(
gname
);
params
.
push
(
gname
);
params
.
push
(
methodName
);
params
.
push
(
methodName
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
body
);
params
.
push
(
req
.
query
);
params
.
push
(
req
.
query
);
params
.
push
(
req
);
params
.
push
(
req
);
var
p
=
null
;
var
p
=
null
;
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
var
invokeObj
=
system
.
getObject
(
"api."
+
classPath
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
//-----------------------新的模式---------api---------结束
//-----------------------新的模式---------api---------结束
//-----------------------新的模式---------ICP---------开始
//-----------------------新的模式---------ICP---------开始
app
.
all
(
"/icp/*"
,
async
function
(
req
,
res
,
next
)
{
app
.
all
(
"/icp/*"
,
async
function
(
req
,
res
,
next
)
{
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
var
result
=
system
.
getResult
(
null
,
"req method must is post"
);
if
(
req
.
method
!=
"POST"
)
{
if
(
req
.
method
!=
"POST"
)
{
res
.
end
(
JSON
.
stringify
(
result
));
res
.
end
(
JSON
.
stringify
(
result
));
return
;
return
;
}
}
// var token = req.headers["token"] || "";
// var token = req.headers["token"] || "";
// if (!token) {
// if (!token) {
// var resfail = {
// var resfail = {
// "success": false,
// "success": false,
// "errorMsg": "req headers token can not be empty",
// "errorMsg": "req headers token can not be empty",
// "errorCode": "ok"
// "errorCode": "ok"
// };
// };
// res.end(JSON.stringify(resfail));
// res.end(JSON.stringify(resfail));
// return;
// return;
// }
// }
// var cacheManager = system.getObject("db.common.cacheManager");
// var cacheManager = system.getObject("db.common.cacheManager");
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
// if (result.status != 0) {
// if (result.status != 0) {
// var resfail = {
// var resfail = {
// "success": false,
// "success": false,
// "errorMsg": result.msg || "token error",
// "errorMsg": result.msg || "token error",
// "errorCode": "ok"
// "errorCode": "ok"
// };
// };
// res.end(JSON.stringify(resfail));
// res.end(JSON.stringify(resfail));
// // res.end(JSON.stringify(result));
// // res.end(JSON.stringify(result));
// return;
// return;
// }
// }
// req.appInfo = result.data;
// req.appInfo = result.data;
// req.body.appInfo = result.data;
// req.body.appInfo = result.data;
// req.actionProcess = result.data.app_code;
// req.actionProcess = result.data.app_code;
var
token
=
req
.
headers
[
"token"
]
||
""
;
var
token
=
req
.
headers
[
"token"
]
||
""
;
if
(
!
token
)
{
if
(
!
token
)
{
var
resfail
=
{
var
resfail
=
{
"success"
:
false
,
"success"
:
false
,
"errorMsg"
:
"req headers token can not be empty"
,
"errorMsg"
:
"req headers token can not be empty"
,
"errorCode"
:
"ok"
"errorCode"
:
"ok"
};
};
res
.
end
(
JSON
.
stringify
(
resfail
));
res
.
end
(
JSON
.
stringify
(
resfail
));
return
;
return
;
}
}
//校验jwt产生的token
//校验jwt产生的token
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
const
tokenSecret
=
settings
.
env
==
"localhost"
||
settings
.
env
==
"dev"
?
PDICT
.
token_secret_dev
:
PDICT
.
token_secret_prod
;
let
token_secret_str
=
null
;
let
token_secret_str
=
null
;
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
jwt
.
verify
(
token
,
tokenSecret
,
function
(
err
,
decoded
)
{
// decoded:指的是token解码后用户信息
if
(
err
)
{
//如果token过期则会执行err的代码块
if
(
err
)
{
//如果token过期则会执行err的代码块
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,error:"
+
err
));
}
else
{
}
else
{
token_secret_str
=
decoded
.
token_secret
;
token_secret_str
=
decoded
.
token_secret
;
}
}
});
});
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
let
decryptResult
=
await
utilsAuthSve
.
decryptInfo
(
token_secret_str
);
if
(
decryptResult
.
status
!=
0
)
{
if
(
decryptResult
.
status
!=
0
)
{
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
return
res
.
send
(
system
.
getResultFail
(
-
88
,
"Failed to authenticate token,fail:"
+
decryptResult
.
msg
));
}
}
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
let
tmpAppInfo
=
JSON
.
parse
(
decryptResult
.
data
);
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
body
.
appInfo
=
tmpAppInfo
;
req
.
appInfo
=
tmpAppInfo
;
req
.
appInfo
=
tmpAppInfo
;
req
.
actionProcess
=
tmpAppInfo
.
app_code
;
req
.
actionProcess
=
tmpAppInfo
.
app_code
;
next
();
next
();
});
});
//icp需求推送
//icp需求推送
app
.
post
(
'/icp/consultation/submit'
,
function
(
req
,
res
)
{
app
.
post
(
'/icp/consultation/submit'
,
function
(
req
,
res
)
{
var
p
=
null
;
var
p
=
null
;
var
params
=
[
"icpnotify"
,
"icpSubmitNeed"
,
req
.
body
,
req
.
query
,
req
];
var
params
=
[
"icpnotify"
,
"icpSubmitNeed"
,
req
.
body
,
req
.
query
,
req
];
// gname, methodname, pobj, query, req
// gname, methodname, pobj, query, req
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
//⽤户反馈需求通知服务商
//⽤户反馈需求通知服务商
app
.
post
(
'/icp/feedback/submit'
,
function
(
req
,
res
)
{
app
.
post
(
'/icp/feedback/submit'
,
function
(
req
,
res
)
{
var
p
=
null
;
var
p
=
null
;
req
.
body
.
action_type
=
"icpFeedbackSubmit"
;
req
.
body
.
action_type
=
"icpFeedbackSubmit"
;
var
params
=
[
"icpnotify"
,
"icpFeedbackSubmit"
,
req
.
body
,
req
.
query
,
req
];
var
params
=
[
"icpnotify"
,
"icpFeedbackSubmit"
,
req
.
body
,
req
.
query
,
req
];
// gname, methodname, pobj, query, req
// gname, methodname, pobj, query, req
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
//推送订单信息
//推送订单信息
app
.
post
(
'/icp/order/notify'
,
function
(
req
,
res
)
{
app
.
post
(
'/icp/order/notify'
,
function
(
req
,
res
)
{
var
p
=
null
;
var
p
=
null
;
req
.
body
.
action_type
=
"icpNotify"
;
req
.
body
.
action_type
=
"icpNotify"
;
var
params
=
[
"icpnotify"
,
"icpNotify"
,
req
.
body
,
req
.
query
,
req
];
var
params
=
[
"icpnotify"
,
"icpNotify"
,
req
.
body
,
req
.
query
,
req
];
// gname, methodname, pobj, query, req
// gname, methodname, pobj, query, req
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
var
invokeObj
=
system
.
getObject
(
"api.action.icpnotify"
);
if
(
invokeObj
[
"doexecMethod"
])
{
if
(
invokeObj
[
"doexecMethod"
])
{
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
p
=
invokeObj
[
"doexecMethod"
].
apply
(
invokeObj
,
params
);
}
}
p
.
then
(
r
=>
{
p
.
then
(
r
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
});
//-----------------------新的模式---------ICP---------结束
//-----------------------新的模式---------ICP---------结束
};
};
\ No newline at end of file
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