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
46489b6c
Commit
46489b6c
authored
Mar 23, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Plain Diff
push2ali
parents
4316d10c
e618b979
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
430 additions
and
117 deletions
+430
-117
center-channel/app/base/api/impl/auth/accessAuth.js
+9
-9
center-channel/app/base/api/impl/opaction/icbcOrderNotify.js
+1
-0
center-channel/app/base/api/impl/opaction/opOrder.js
+1
-0
center-channel/app/base/api/impl/opaction/order.js
+1
-0
center-channel/app/base/api/impl/opreceive/accessAuth.js
+116
-0
center-channel/app/base/api/impl/opreceive/ic.js
+3
-1
center-channel/app/base/api/impl/opreceive/need.js
+5
-0
center-channel/app/base/db/models/common/pushlog.js
+1
-1
center-channel/app/base/service/impl/common/centerorderSve.js
+107
-6
center-channel/app/base/service/impl/common/pushlogSve.js
+0
-4
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+65
-24
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+27
-2
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
+6
-2
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+9
-8
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+38
-26
center-channel/app/config/routes/api.js
+6
-1
center-channel/峰擎文档
+35
-33
No files found.
center-channel/app/base/api/impl/auth/accessAuth.js
View file @
46489b6c
...
...
@@ -31,7 +31,7 @@ class AccessAuthAPI extends WEBBase {
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
case
"getNeedUserPinByChannelUserId"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
return
tmpOpResult
;
}
...
...
@@ -41,8 +41,8 @@ class AccessAuthAPI extends WEBBase {
opResult
.
data
.
userpin
=
tmpOpResult
.
data
.
userpin
;
}
//获取需求信息
pobj
.
actionType
=
"getItemByNeedNo"
;
var
needResult
=
await
this
.
utilsNeedSve
.
getItemByNeedNo
(
pobj
,
pobj
.
actionBody
);
pobj
.
actionType
=
"getItemBy
Channel
NeedNo"
;
var
needResult
=
await
this
.
utilsNeedSve
.
getItemBy
Channel
NeedNo
(
pobj
,
pobj
.
actionBody
);
if
(
needResult
.
status
!=
0
)
{
return
needResult
;
}
...
...
@@ -50,14 +50,14 @@ class AccessAuthAPI extends WEBBase {
opResult
.
data
.
typeCode
=
needResult
.
data
.
typeCode
break
;
case
"getLoginByUserName"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
o
pResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
!=
0
&&
o
pResult
.
status
!=
2060
)
{
return
o
pResult
;
var
tmpO
pResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpO
pResult
.
status
!=
2060
)
{
return
tmpO
pResult
;
}
opResult
=
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
if
(
o
pResult
.
status
==
2060
)
{
opResult
.
msg
=
o
pResult
.
msg
;
opResult
.
data
.
userpin
=
o
pResult
.
data
.
userpin
;
if
(
tmpO
pResult
.
status
==
2060
)
{
opResult
.
msg
=
tmpO
pResult
.
msg
;
opResult
.
data
.
userpin
=
tmpO
pResult
.
data
.
userpin
;
}
break
;
case
"getVerifyCode"
:
//获取默认模板的手机验证码
...
...
center-channel/app/base/api/impl/opaction/icbcOrderNotify.js
View file @
46489b6c
...
...
@@ -23,6 +23,7 @@ class IcbcOrderNotify extends WEBBase {
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
opResult
=
null
;
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
.
uapp_id
,
...
...
center-channel/app/base/api/impl/opaction/opOrder.js
View file @
46489b6c
...
...
@@ -23,6 +23,7 @@ class ProductAPI extends WEBBase {
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"updateContacts"
:
//修改订单联系人
...
...
center-channel/app/base/api/impl/opaction/order.js
View file @
46489b6c
...
...
@@ -23,6 +23,7 @@ class ProductAPI extends WEBBase {
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"addOrder"
:
//创建订单
...
...
center-channel/app/base/api/impl/opreceive/accessAuth.js
0 → 100644
View file @
46489b6c
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
AccessAuthAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionProcess
)
{
return
system
.
getResult
(
null
,
"actionProcess参数不能为空"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
system
.
getResult
(
null
,
"req Failure"
);
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
switch
(
action_type
)
{
// sy
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
case
"getLoginByUserName"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
return
tmpOpResult
;
}
opResult
=
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
if
(
tmpOpResult
.
status
==
2060
)
{
opResult
.
msg
=
tmpOpResult
.
msg
;
opResult
.
data
.
userpin
=
tmpOpResult
.
data
.
userpin
;
}
break
;
case
"getVerifyCode"
:
//获取默认模板的手机验证码
opResult
=
await
this
.
utilsAuthSve
.
getVerifyCodeByMoblie
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
()
}
break
;
case
"userPinByLgoin"
:
//通过账户和密码登录
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoin
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"userPinByLgoinVcode"
:
//通过短信登录信息
pobj
.
actionBody
.
reqType
=
"login"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"userPinByRegister"
:
//通过短信注册信息
pobj
.
actionBody
.
reqType
=
"reg"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"putUserPwdByMobile"
:
//通过手机验证码修改用户密码
opResult
=
await
this
.
utilsAuthSve
.
putUserPwdByMobile
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getLoginInfo"
:
//通过userpin获取用户登录信息
opResult
=
await
this
.
utilsAuthSve
.
getLoginInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"logout"
:
//用户退出
opResult
=
await
this
.
utilsAuthSve
.
userLogout
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
*/
async
getAppTokenByHosts
(
pobj
,
qobj
,
req
)
{
var
token
=
this
.
getUUID
();
pobj
.
actionBody
.
reqType
=
"hosts"
;
var
opResult
=
await
this
.
utilsAuthSve
.
getReqTokenByHosts
(
pobj
.
actionBody
,
token
);
if
(
opResult
.
status
!=
0
)
{
return
opResult
;
}
return
system
.
getResultSuccess
({
token
:
token
})
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
*/
async
getAppTokenByAppKey
(
pobj
,
qobj
,
req
)
{
var
token
=
this
.
getUUID
();
pobj
.
actionBody
.
reqType
=
"appkey"
;
var
opResult
=
await
this
.
utilsAuthSve
.
getReqTokenByHosts
(
pobj
.
actionBody
,
token
);
if
(
opResult
.
status
!=
0
)
{
return
opResult
;
}
return
system
.
getResultSuccess
({
token
:
token
})
}
}
module
.
exports
=
AccessAuthAPI
;
\ No newline at end of file
center-channel/app/base/api/impl/opreceive/ic.js
View file @
46489b6c
...
...
@@ -32,7 +32,9 @@ class Ic extends APIBase {
break
;
case
"reqCenterOrderApi"
:
//办理公司状态
break
;
case
"paySuccess"
:
//支付回调
opResult
=
await
this
.
centerorderSve
.
paySuccess
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/api/impl/opreceive/need.js
View file @
46489b6c
...
...
@@ -5,6 +5,7 @@ class Need extends APIBase {
constructor
()
{
super
();
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
this
.
centerorderSve
=
system
.
getObject
(
"service.common.centerorderSve"
);
}
/**
...
...
@@ -24,6 +25,7 @@ class Need extends APIBase {
return
result
;
}
async
opActionProcess
(
pobj
,
action_process
,
action_type
,
action_body
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"submitNeed"
:
//提交需求
...
...
@@ -32,6 +34,9 @@ class Need extends APIBase {
case
"needClose"
:
//关闭需求
opResult
=
await
this
.
utilsNeedSve
.
needClose
(
pobj
,
pobj
.
actionBody
);
break
;
case
"receiveFeedback"
:
//接收方案反馈信息
opResult
=
await
this
.
centerorderSve
.
reqCenterOrderApi
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/db/models/common/pushlog.js
View file @
46489b6c
...
...
@@ -13,7 +13,7 @@ module.exports = (db, DataTypes) => {
defaultValue
:
"info"
,
},
op
:
DataTypes
.
STRING
(
4000
),
content
:
DataTypes
.
TEXT
,
content
:
DataTypes
.
TEXT
(
'long'
)
,
resultInfo
:
DataTypes
.
TEXT
(
'long'
),
returnTypeName
:
DataTypes
.
STRING
,
returnType
:
{
...
...
center-channel/app/base/service/impl/common/centerorderSve.js
View file @
46489b6c
const
system
=
require
(
"../../../system"
);
const
crypto
=
require
(
'crypto'
);
var
settings
=
require
(
"../../../../config/settings"
);
class
CenterorderService
{
class
CenterorderService
{
constructor
()
{
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
aliclient
=
system
.
getObject
(
"util.aliyunClient"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
};
//调用center-order
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
"action/icapi/springBoard"
;
if
(
reqUrl
)
{
if
(
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
}
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
...
...
@@ -19,7 +21,7 @@ class CenterorderService{
return
data
;
}
//提交公司注册方案
async
submitProgramme
(
pobj
){
async
submitProgramme
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolution
){
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
...
...
@@ -59,9 +61,9 @@ class CenterorderService{
return
system
.
getResultSuccess
();
}
//服务商方案作废
async
abolishProgramme
(
pobj
){
async
abolishProgramme
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
channelSolutionNo
)
{
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
channelSolutionNo
)
{
//推送数据至阿里
var
pushObj
=
{
solutionBizId
:
res
.
data
.
channelSolutionNo
,
note
:
pobj
.
actionBody
.
note
||
""
...
...
@@ -70,6 +72,105 @@ class CenterorderService{
}
return
res
;
}
//支付回调
async
paySuccess
(
pobj
)
{
var
actionBody
=
pobj
.
actionBody
;
if
(
!
pobj
.
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"orderNo不能为空"
);
}
if
(
!
actionBody
.
orderPrice
)
{
return
system
.
getResult
(
null
,
"orderPrice不能为空"
);
}
if
(
!
actionBody
.
phone
)
{
return
system
.
getResult
(
null
,
"phone不能为空"
);
}
if
(
pobj
.
actionBody
.
companyName
)
{
if
(
!
actionBody
.
city
)
{
return
system
.
getResult
(
null
,
"city不能为空"
);
}
if
(
!
actionBody
.
companyCategory
)
{
return
system
.
getResult
(
null
,
"companyCategory不能为空"
);
}
if
(
!
actionBody
.
orgType
)
{
return
system
.
getResult
(
null
,
"orgType不能为空"
);
}
if
(
!
actionBody
.
industryType
)
{
return
system
.
getResult
(
null
,
"industryType不能为空"
);
}
if
(
!
actionBody
.
scope
)
{
return
system
.
getResult
(
null
,
"scope不能为空"
);
}
pobj
.
actionBody
.
regType
=
"ali.companyreg"
}
else
if
(
pobj
.
actionBody
.
park
)
{
if
(
!
actionBody
.
productType
)
{
return
system
.
getResult
(
null
,
"productType不能为空"
);
}
pobj
.
actionBody
.
regType
=
"ali.companyreg_cloud"
}
else
{
return
system
.
getResult
(
null
,
"参数异常"
);
}
var
sobj
=
{
actionType
:
"getaliicProduce"
,
actionBody
:
pobj
.
actionBody
,
appInfo
:
pobj
.
appInfo
,
actionProcess
:
pobj
.
actionProcess
}
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
,
"产品查询失败"
);
}
pobj
.
actionBody
=
data
.
data
;
// var needNo="";
// if(solutiondata.data){
// needNo=solutiondata.data.channelNeedNo;
// }
pobj
.
actionBody
.
totalSum
=
pobj
.
actionBody
.
orderPrice
;
pobj
.
actionBody
.
payTotalSum
=
pobj
.
actionBody
.
orderPrice
;
pobj
.
actionBody
.
quantity
=
1
;
pobj
.
actionBody
.
channelOrder
=
{
channelServiceNo
:
pobj
.
actionBody
.
orderNo
,
channelOrderNo
:
pobj
.
actionBody
.
orderNo
,
orderStatus
:
2
}
var
orderrtn
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5012
,
"订单创建失败"
);
}
if
(
orderrtn
.
data
)
{
pobj
.
actionBody
.
orderNo
=
orderrtn
.
data
.
orderNo
}
if
(
pobj
.
actionBody
.
solutionBizId
)
{
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
solutionBizId
;
pobj
.
actionType
=
"receiveSolutionPayInfo"
;
}
else
{
pobj
.
actionType
=
"createSolutionByOrder"
;
}
var
url
=
settings
.
centerOrderUrl
()
+
"action/icapi/springBoard"
;
var
solutionrtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
!
solutionrtn
||
!
solutionrtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
var
solutiondata
=
JSON
.
parse
(
solutionrtn
.
stdout
);
if
(
solutiondata
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
if
(
solutiondata
.
data
&&
solutiondata
.
data
.
channelNeedNo
)
{
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
if
(
solutiondata
.
status
==
0
)
{
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushOrderBusiness"
);
}
return
system
.
getResultSuccess
();
}
}
module
.
exports
=
CenterorderService
;
// var task = new CenterorderService();
...
...
center-channel/app/base/service/impl/common/pushlogSve.js
View file @
46489b6c
...
...
@@ -55,10 +55,6 @@ class PushlogService extends ServiceBase {
}
try
{
qobj
.
optitle
=
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
":"
+
qobj
.
optitle
;
//解决日志大于4000写入的问题
if
(
qobj
.
content
.
length
>
4980
)
{
qobj
.
content
=
qobj
.
content
.
substring
(
0
,
4980
);
}
this
.
dao
.
create
(
qobj
);
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"addLog------error-----------------------*****************"
);
...
...
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
46489b6c
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
aliyunClient
=
system
.
getObject
(
"util.aliyunClient"
);
class
UtilsFqAliyunSve
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
}
async
pushOldNeedBusiness
(
actionBody
)
{
//推送旧的需求商机
async
pushOldNeedBusiness
(
pobj
)
{
//推送旧的需求商机
return
system
.
getResultSuccess
();
}
async
pushOrderBusiness
(
actionBody
)
{
//推送订单商机
var
orderInfo
=
actionBody
.
order_info
;
async
pushOrderBusiness
(
pobj
)
{
//推送订单商机
var
orderInfo
=
pobj
.
actionBody
.
order_info
;
if
(
!
orderInfo
)
{
return
""
;
}
if
(
orderInfo
.
orderStatus
<
2
)
{
return
""
;
}
var
orderContact
=
actionBody
.
order_contact
;
var
productInfo
=
actionBody
.
product_info
;
if
(
!
actionBody
.
interface_params
)
{
var
orderContact
=
pobj
.
actionBody
.
order_contact
;
var
productInfo
=
pobj
.
actionBody
.
product_info
;
if
(
!
pobj
.
interface_params
)
{
return
""
;
}
var
interface_params_info
=
JSON
.
parse
(
actionBody
.
interface_params
);
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
opUrl
||
!
interface_params_info
.
key
||
!
interface_params_info
.
secret
)
{
return
""
;
}
...
...
@@ -40,37 +42,76 @@ class UtilsFqAliyunSve extends AppServiceBase {
productId
:
productInfo
.
price_item
.
service_code
,
// 是 产品 ID
productQuantity
:
orderInfo
.
quantity
,
// 是 产品数量
};
var
result
=
this
.
opAliyunClientPost
(
"pushOrderBusiness"
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
params
);
var
result
=
this
.
opAliyunClientPost
(
pobj
,
"pushOrderBusiness"
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
params
);
}
async
pushAliBusiness2Fq
(
pobj
)
{
//推送阿里工商需求商机
if
(
!
pobj
.
interface_params
)
{
return
""
;
}
var
interface_params_info
=
JSON
.
parse
(
pobj
.
interface_params
);
if
(
!
interface_params_info
||
!
interface_params_info
.
opUrl
||
!
interface_params_info
.
key
||
!
interface_params_info
.
secret
)
{
return
""
;
}
var
result
=
this
.
opAliyunClientPost
(
pobj
,
"pushAliIcNeedBusiness"
,
interface_params_info
.
opUrl
,
interface_params_info
.
key
,
interface_params_info
.
secret
,
pobj
.
actionBody
);
}
async
opAliyunClientPost
(
methodName
,
url
,
key
,
secret
,
params
)
{
async
opAliyunClientPost
(
pobj
,
methodName
,
url
,
key
,
secret
,
params
)
{
try
{
var
rc
=
system
.
getObject
(
"util.aliyunClient"
);
var
rtn
=
=
await
rc
.
post
(
url
,
key
,
secret
,
params
);
var
rtn
=
await
rc
.
post
(
url
,
key
,
secret
,
params
);
this
.
logCtl
.
info
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uappKey
,
requestId
:
req
.
requestId
||
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/
utilsFqAliyunSve
.js/"
+
methodName
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/
opAliyunClientPost
.js/"
+
methodName
,
content
:
"请求地址:"
+
url
+
",参数:"
+
JSON
.
stringify
(
params
)
+
",返回结果:"
+
JSON
.
stringify
(
rtn
),
clientIp
:
pobj
.
clientIp
,
optitle
:
"推送订单商机到FQ信息--again"
,
optitle
:
"推送商机->opAliyunClientPost"
,
});
if
(
rtn
.
code
!=
200
&&
rtn
.
success
!=
true
)
{
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
req
.
requestId
+
",requestId="
+
rtn
.
requestId
);
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
pobj
.
interface_info
),
content
:
"推送的参数信息:"
+
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作出错->opAliyunClientPost"
});
return
system
.
getResult
(
null
,
"推送失败,失败原因:"
+
rtn
.
errorMsg
+
",selfrequestId="
+
pobj
.
requestId
+
",requestId="
+
rtn
.
requestId
);
}
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
pobj
.
interface_info
),
content
:
"推送的参数信息:"
+
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
'1'
,
opTitle
:
pobj
.
opType
+
"数据推送成功->opAliyunClientPost"
});
return
system
.
getResultSuccess
(
null
,
"推送成功"
);
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
pobj
.
interface_info
),
content
:
"推送的参数信息:"
+
JSON
.
stringify
(
pobj
),
resultInfo
:
"error:"
+
e
.
stack
,
returnType
:
'0'
,
opTitle
:
pobj
.
opType
+
"推送操作异常->opAliyunClientPost"
});
//日志记录
this
.
logCtl
.
error
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uappKey
,
requestId
:
req
.
requestId
||
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/
utilsFqAliyunSve
.js/"
+
methodName
,
appid
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
pobj
.
requestId
||
""
,
op
:
"center-channel/app/base/service/impl/utilsSve/
opAliyunClientPost
.js/"
+
methodName
,
content
:
"error:"
+
e
.
stack
,
clientIp
:
pobj
.
clientIp
,
optitle
:
"推送操作出错
->opAliyunClientPost"
,
//
clientIp: pobj.clientIp,
optitle
:
pobj
.
opType
+
"推送操作异常
->opAliyunClientPost"
,
});
return
system
.
getResult
(
null
,
"推送error"
);
}
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
46489b6c
...
...
@@ -6,6 +6,7 @@ class UtilsNeedSve extends AppServiceBase {
constructor
()
{
super
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
}
/**
...
...
@@ -18,7 +19,11 @@ class UtilsNeedSve extends AppServiceBase {
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
return
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushNeedBusiness"
);
}
return
result
;
}
/**
* 获取需求详情
...
...
@@ -34,6 +39,19 @@ class UtilsNeedSve extends AppServiceBase {
return
itemResult
;
}
/**
* 获取需求详情
* @param {*} pobj
* @param {*} actionBody needNo 需求号
*/
async
getItemByChannelNeedNo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
needNo
)
{
return
system
.
getResult
(
null
,
"actionBody.needNo can not be empty,100380"
);
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
itemResult
;
}
/**
* 关闭需求
* @param {*} pobj
* @param {*} actionBody
...
...
@@ -43,7 +61,14 @@ class UtilsNeedSve extends AppServiceBase {
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
return
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushCloseNeed"
);
return
system
.
getResultSuccess
();
}
else
{
return
system
.
getResult
(
null
,
"推送失敗 100388"
);
}
}
}
module
.
exports
=
UtilsNeedSve
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
View file @
46489b6c
...
...
@@ -14,7 +14,7 @@ class UtilsOpOrderService extends AppServiceBase {
}
var
reqUrl
=
this
.
centerOrderUrl
+
"opaction/opOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
this
.
opUpdatePushInfo
(
result
,
pobj
,
actionBody
,
"pushUpdateContacts"
);
this
.
opUpdatePushInfo
(
result
,
pobj
,
actionBody
,
"pushUpdate
Order
Contacts"
);
result
.
data
=
null
;
return
result
;
}
...
...
@@ -41,8 +41,12 @@ class UtilsOpOrderService extends AppServiceBase {
channel_username
:
pobj
.
userInfo
.
channel_username
,
channel_nickname
:
pobj
.
userInfo
.
channel_nickname
};
var
tmpPobj
=
{
appInfo
:
opResult
.
data
.
appInfo
,
actionBody
:
opResult
.
data
}
delete
result
.
data
[
"orderStatus"
];
this
.
utilsPushSve
.
push
Info
(
result
.
data
,
opType
,
1
);
this
.
utilsPushSve
.
push
BusInfo
(
tmpPobj
,
opType
,
1
);
}
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
46489b6c
...
...
@@ -79,16 +79,13 @@ class UtilsOrderService extends AppServiceBase {
return
verifyResult
;
}
pobj
.
actionType
=
"getProductInterface"
;
pobj
.
actionBody
.
product
PriceId
=
pobj
.
actionBody
.
product_info
.
price_item
.
id
;
pobj
.
actionBody
.
product
_id
=
pobj
.
actionBody
.
product_info
.
id
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
// if (productItemInterfaceResult.status != 0) {
// return productItemInterfaceResult;
// }
pobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
pobj
.
actionType
=
"addOrder"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
console
.
log
(
pobj
);
//
console.log(pobj);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
result
.
totalSum
=
actionBody
.
totalSum
;
return
result
;
...
...
@@ -438,14 +435,18 @@ class UtilsOrderService extends AppServiceBase {
uapp_key
:
appInfo
.
uapp_key
,
app_code
:
appInfo
.
app_code
,
app_name
:
appInfo
.
app_name
};
};
interface_info
opResult
.
data
.
userInfo
=
{
channel_userid
:
opResult
.
data
.
order_info
.
channelUserId
,
channel_username
:
opResult
.
data
.
order_info
.
channelUserId
,
channel_nickname
:
opResult
.
data
.
order_info
.
channelUserId
};
// this.utilsPushSve.pushInfo(opResult.data, "pushBusiness",0);
this
.
utilsPushSve
.
pushInfo
(
opResult
.
data
,
"pushOrder"
,
0
);
var
pobj
=
{
appInfo
:
opResult
.
data
.
appInfo
,
actionBody
:
opResult
.
data
}
// this.utilsPushSve.pushBusInfo(opResult.data, "pushOrderBusiness",0);
this
.
utilsPushSve
.
pushBusInfo
(
pobj
,
"pushOrder"
,
0
);
}
opResult
.
data
=
null
;
return
opResult
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
46489b6c
...
...
@@ -7,23 +7,33 @@ class UtilsPushService extends AppServiceBase {
super
();
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
};
async
pushInfo
(
actionBody
,
opType
,
isDelProductInfo
)
{
var
interface_list
=
actionBody
.
product_info
.
interface_info
;
async
aliBusiness2Fq
(
pobj
,
opType
)
{
pobj
.
actionType
=
"getAppInterface"
;
var
reqUrl
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
pobj
.
interface_info
=
productItemInterfaceResult
.
data
;
this
.
pushBusInfo
(
pobj
,
opType
,
1
);
}
async
pushBusInfo
(
pobj
,
opType
,
isDelProductInfo
)
{
//推送业务信息
var
interface_list
=
pobj
.
interface_info
?
pobj
.
interface_info
:
pobj
.
actionBody
.
product_info
.
interface_info
;
if
(
!
interface_list
)
{
return
""
;
return
system
.
getResult
(
null
,
"暂无推送配置"
)
;
}
var
interface_list_temp
=
interface_list
.
filter
(
f
=>
f
.
op_type
==
opType
)
if
(
!
interface_list_temp
||
interface_list_temp
.
length
==
0
)
{
return
""
;
return
system
.
getResult
(
null
,
"暂无【"
+
opType
+
"】的推送配置"
)
;
}
for
(
let
index
=
0
;
index
<
interface_list_temp
.
length
;
index
++
)
{
const
element
=
interface_list_temp
[
index
];
var
refOpResult
=
this
.
reflexAction
(
element
,
actionBody
,
isDelProductInfo
);
var
refOpResult
=
this
.
reflexAction
(
element
,
opType
,
pobj
,
isDelProductInfo
);
}
}
async
reflexAction
(
interface_info
,
actionBody
,
isDelProductInfo
)
{
async
reflexAction
(
interface_info
,
opType
,
pobj
,
isDelProductInfo
)
{
var
refResult
=
null
;
try
{
pobj
.
opType
=
opType
;
if
(
interface_info
.
interface_type
==
"bd"
)
{
if
(
!
interface_info
.
method_name
)
{
return
system
.
getResult
(
null
,
"产品接口参数信息有误,100350"
);
...
...
@@ -32,9 +42,10 @@ class UtilsPushService extends AppServiceBase {
if
(
!
invokeObj
[
interface_info
.
method_name
])
{
return
system
.
getResult
(
null
,
"产品接口参数方法信息有误,100360"
);
}
actionBody
.
interface_params
=
interface_info
.
params
;
var
params
=
[
actionBody
];
refResult
=
await
invokeObj
[
interface_info
.
method_name
].
apply
(
invokeObj
,
params
);
pobj
.
interface_info
=
interface_info
;
pobj
.
interface_params
=
interface_info
.
params
;
var
params
=
[
pobj
];
invokeObj
[
interface_info
.
method_name
].
apply
(
invokeObj
,
params
);
}
else
if
(
interface_info
.
interface_type
==
"yc"
)
{
if
(
!
interface_info
.
interface_url
)
{
...
...
@@ -45,27 +56,28 @@ class UtilsPushService extends AppServiceBase {
if
(
isDelProductInfo
&&
isDelProductInfo
==
1
)
{
delete
actionBody
[
"product_info"
];
}
//是否删除产品信息进行推送
refResult
=
await
this
.
restPostUrl
(
actionBody
,
interface_info
.
interface_url
);
refResult
=
await
this
.
restPostUrl
(
pobj
.
actionBody
,
interface_info
.
interface_url
);
this
.
pushlogSve
.
createDb
({
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
pobj
.
interface_info
),
content
:
"推送的参数信息:"
+
JSON
.
stringify
(
pobj
),
resultInfo
:
JSON
.
stringify
(
rtn
),
returnType
:
refResult
.
status
==
0
?
'1'
:
'0'
,
opTitle
:
opType
+
(
refResult
.
status
==
0
?
"数据推送成功->reflexAction"
:
"数据推送出错->reflexAction"
)
});
}
this
.
pushlogSve
.
createDb
({
appid
:
actionBody
.
appInfo
.
uapp_id
,
appkey
:
actionBody
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
interface_info
),
content
:
JSON
.
stringify
(
actionBody
),
resultInfo
:
refResult
?
JSON
.
stringify
(
refResult
)
:
""
,
returnType
:
'1'
,
opTitle
:
"数据推送成功"
});
return
refResult
;
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
this
.
pushlogSve
.
createDb
({
appid
:
actionBody
.
appInfo
.
uapp_id
,
appkey
:
actionBody
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
interface_info
),
content
:
JSON
.
stringify
(
actionBody
),
resultInfo
:
JSON
.
stringify
(
e
.
stack
)
,
appid
:
pobj
.
appInfo
.
uapp_id
,
appkey
:
pobj
.
appInfo
.
uapp_key
,
op
:
"推送的接口信息:"
+
JSON
.
stringify
(
pobj
.
interface_info
),
content
:
"推送的参数信息:"
+
JSON
.
stringify
(
pobj
),
resultInfo
:
""
,
returnType
:
'0'
,
opTitle
:
"数据推送异常
"
opTitle
:
opType
+
"数据推送异常-->reflexAction
"
});
}
}
...
...
center-channel/app/config/routes/api.js
View file @
46489b6c
...
...
@@ -183,6 +183,11 @@ module.exports = function (app) {
res
.
end
(
JSON
.
stringify
(
result
));
return
;
}
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
next
();
return
;
}
if
(
!
req
.
body
.
actionType
)
{
result
.
msg
=
"actionType can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
...
...
@@ -204,7 +209,7 @@ module.exports = function (app) {
req
.
body
.
appInfo
=
result
.
data
;
req
.
body
.
actionProcess
=
result
.
data
.
app_code
;
var
lst
=
[
"submitNeed"
"submitNeed"
,
"paySuccess"
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
...
...
center-channel/峰擎文档
View file @
46489b6c
1.获取请
求token
1.获取请
求token
1.获取请求token
[/
web/auth
/accessAuth/getAppTokenByAppKey]
[/
api/opreceive
/accessAuth/getAppTokenByAppKey]
请求方式:POST
参数格式 JSON
HTTP请求方式 POST
...
...
@@ -20,35 +20,8 @@ HTTP请求方式 POST
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
2.渠道通过账户进行登录,有则返回用户信息,没有则创建用户
地址:[/web/auth/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "getNeedUserPinByChannelUserId",
"actionBody": {
"needNo":"N2020021413152wiWI2e",// Y 需求号
"channelUserId":"15010929366",// Y 渠道用户ID
"channelUserName":"",// N 渠道用户名
"mobile":"15010929366", // N 渠道用户手机号
"nickName":"", // N 用户昵称
"orgName":"" // N 公司名称
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"userpin":"c54abe7249a2a1195d236b333f79",
"channelTypeCode":"",//阿里公司注册编码:普通公司注册:esp.companyreg、云上公司注册:esp.companyreg_cloud
"typeCode":"gszc"//gszc公司注册,ysgszc云上公司注册
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
3.渠道通过账户进行登录,有则返回用户信息,没有则创建用户
地址:[/web/auth/accessAuth/springBoard]
3.渠道通过账户进行登录,有则返回用户信息,没有则创建用户------>供后端调用
地址:[/api/opreceive/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
...
...
@@ -83,7 +56,6 @@ HTTP请求方式 POST
orgName//公司名称
token//token值
4.推送公司表单材料
地址:[/api/opreceive/ic/springBoard]
请求方式:POST
...
...
@@ -131,7 +103,7 @@ HTTP请求方式 POST
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "
c
lose", // 关闭需求
"actionType": "
needC
lose", // 关闭需求
"actionBody": {
"needNo":"xxxxxxxxx"//需求号
}
...
...
@@ -142,4 +114,33 @@ HTTP请求方式 POST
"msg": "success",
"data": null,
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
2.渠道通过账户进行登录,有则返回用户信息,没有则创建用户---->供前端调用
地址:[/web/auth/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "getNeedUserPinByChannelUserId",
"actionBody": {
"needNo":"N2020021413152wiWI2e",// Y 需求号
"channelUserId":"15010929366",// Y 渠道用户ID
"channelUserName":"",// N 渠道用户名
"mobile":"15010929366", // N 渠道用户手机号
"nickName":"", // N 用户昵称
"orgName":"" // N 公司名称
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"userpin":"c54abe7249a2a1195d236b333f79",
"channelTypeCode":"",//阿里公司注册编码:普通公司注册:esp.companyreg、云上公司注册:esp.companyreg_cloud
"typeCode":"gszc"//gszc公司注册,ysgszc云上公司注册
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
\ 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