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
19772783
Commit
19772783
authored
Mar 26, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
37e6c1d5
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
291 additions
and
15 deletions
+291
-15
center-channel/app/base/api/impl/auth/channelAccessAuth.js
+60
-0
center-channel/app/base/api/impl/payment/channelPayment.js
+45
-0
center-channel/app/base/service/impl/utilsSve/utilsAlibankSve.js
+43
-0
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsChannelAuthSve.js
+22
-0
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsProductSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+10
-5
center-channel/app/config/routes/api.js
+29
-2
center-channel/阿里文档
+74
-0
No files found.
center-channel/app/base/api/impl/auth/channelAccessAuth.js
0 → 100644
View file @
19772783
var
WEBBase
=
require
(
"../../web.base"
);
var
system
=
require
(
"../../../system"
);
class
ChannelAccessAuthAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
utilsChannelAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsChannelAuthSve"
);
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
}
/**
* 接口跳转-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
"getUserPinByAliCode"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var
aliUserResult
=
await
this
.
utilsChannelAuthSve
.
getH5AliDingUserByCode
(
pobj
,
pobj
.
actionBody
);
if
(
aliUserResult
.
status
!=
0
)
{
return
aliUserResult
;
}
pobj
.
actionType
=
"getLoginByUserName"
;
pobj
.
actionBody
.
channelUserId
=
aliUserResult
.
data
.
channelUserId
;
pobj
.
actionBody
.
isAdmin
=
aliUserResult
.
data
.
isAdmin
;
pobj
.
actionBody
.
isSuper
=
aliUserResult
.
data
.
isSuper
;
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
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
ChannelAccessAuthAPI
;
\ No newline at end of file
center-channel/app/base/api/impl/payment/channelPayment.js
0 → 100644
View file @
19772783
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
class
ChannelPayment
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsAlibankSve
=
system
.
getObject
(
"service.utilsSve.utilsAlibankSve"
);
}
/**
* 接口跳转-POST请求
* actionProcess 执行的流程
* actionType 执行的类型
* actionBody 执行的参数
*/
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
,
pobj
.
actionBody
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
action_body
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
// sy
case
"getAliPayInfo"
:
//唤起钉钉h5支付信息---只供简单应用
opResult
=
await
this
.
utilsAlibankSve
.
getH5AliDingPayInfo
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
//支付成功后通知
async
receiveCallBackNotify
(
pobj
,
query
,
req
)
{
// var rtn = await this.utilstlbankSve.receiveCallBackNotify(pobj.actionBody.parmas, pobj.client_ip);
// return rtn;
}
}
module
.
exports
=
ChannelPayment
;
\ No newline at end of file
center-channel/app/base/service/impl/utilsSve/utilsAlibankSve.js
0 → 100644
View file @
19772783
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
class
utilsTlBankSve
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
}
//-------------------------------------------钉钉h5支付-----------------开始
/**
* 唤起钉钉h5支付信息---只供简单应用
* @param {*} pobj
* @param {*} actionBody {total_fee:总额,单位为分,order_num:订单号,body_desc:标题描述}
*/
async
getH5AliDingPayInfo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100110"
);
}
pobj
.
actionType
=
"getPayOrderInfo"
;
var
orderUrl
=
settings
.
centerOrderUrl
()
+
"action/order/springBoard"
;
var
orderResult
=
await
this
.
restPostUrl
(
pobj
,
orderUrl
);
if
(
orderResult
.
status
!=
0
)
{
return
orderResult
;
}
pobj
.
actionBody
.
body_desc
=
orderResult
.
data
.
orderProduct
.
channelItemName
;
pobj
.
actionBody
.
total_fee
=
Number
(
orderResult
.
data
.
receiptVoucher
.
totalSum
)
*
100
;
pobj
.
actionBody
.
order_num
=
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"payment/aliPayment/getPayInfo"
);
if
(
result
.
status
!=
0
)
{
return
result
;
}
await
this
.
cacheManager
[
"TlPayLocker"
].
init
(
orderResult
.
data
.
receiptVoucher
.
sourceOrderNo
);
return
result
;
}
//-------------------------------------------钉钉h5支付-----------------结束
}
module
.
exports
=
utilsTlBankSve
;
center-channel/app/base/service/impl/utilsSve/utilsAuthSve.js
View file @
19772783
...
...
@@ -3,7 +3,7 @@ var settings = require("../../../../config/settings");
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//商标查询操作
class
UtilsAuthS
v
e
extends
AppServiceBase
{
class
UtilsAuthS
ervic
e
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
...
...
@@ -160,4 +160,4 @@ class UtilsAuthSve extends AppServiceBase {
}
}
module
.
exports
=
UtilsAuthS
v
e
;
module
.
exports
=
UtilsAuthS
ervic
e
;
center-channel/app/base/service/impl/utilsSve/utilsChannelAuthSve.js
0 → 100644
View file @
19772783
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
//商标查询操作
class
UtilsChannelAuthService
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerAppUrl
=
settings
.
centerAppUrl
();
}
//---------------登录-----------------------------------------------------
async
getH5AliDingUserByCode
(
pobj
,
actionBody
)
{
//获取token
if
(
!
actionBody
.
code
)
{
return
system
.
getResult
(
null
,
"actionBody.code can not be empty"
);
}
var
result
=
await
this
.
restPostUrl
(
pobj
,
this
.
centerAppUrl
+
"auth/channelAccessAuth/getH5AliDingUserByCode"
);
return
result
;
}
}
module
.
exports
=
UtilsChannelAuthService
;
center-channel/app/base/service/impl/utilsSve/utilsFqAliyunSve.js
View file @
19772783
...
...
@@ -4,7 +4,7 @@ const AppServiceBase = require("../../app.base");
const
aliyunClient
=
system
.
getObject
(
"util.aliyunClient"
);
class
UtilsFqAliyunS
v
e
extends
AppServiceBase
{
class
UtilsFqAliyunS
ervic
e
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
...
...
@@ -115,4 +115,4 @@ class UtilsFqAliyunSve extends AppServiceBase {
}
}
}
module
.
exports
=
UtilsFqAliyunS
v
e
;
module
.
exports
=
UtilsFqAliyunS
ervic
e
;
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
19772783
...
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//商标查询操作
class
UtilsNeedS
v
e
extends
AppServiceBase
{
class
UtilsNeedS
ervic
e
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
...
...
@@ -87,5 +87,5 @@ class UtilsNeedSve extends AppServiceBase {
}
}
module
.
exports
=
UtilsNeedS
v
e
;
module
.
exports
=
UtilsNeedS
ervic
e
;
center-channel/app/base/service/impl/utilsSve/utilsProductSve.js
View file @
19772783
...
...
@@ -2,7 +2,7 @@ var system = require("../../../system");
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
//商标查询操作
class
UtilsProductS
v
e
extends
AppServiceBase
{
class
UtilsProductS
ervic
e
extends
AppServiceBase
{
constructor
()
{
super
();
}
...
...
@@ -39,5 +39,5 @@ class UtilsProductSve extends AppServiceBase {
//--------------------------------应用中心获取产品信息--end----------------------------------------------------
}
module
.
exports
=
UtilsProductS
v
e
;
module
.
exports
=
UtilsProductS
ervic
e
;
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
19772783
...
...
@@ -32,8 +32,9 @@ class UtilsPushService extends AppServiceBase {
}
async
reflexAction
(
interface_info
,
opType
,
pobj
,
isDelProductInfo
)
{
var
refResult
=
null
;
pobj
.
interface_info
=
interface_info
;
pobj
.
opType
=
opType
;
try
{
pobj
.
opType
=
opType
;
if
(
interface_info
.
interface_type
==
"bd"
)
{
if
(
!
interface_info
.
method_name
)
{
return
system
.
getResult
(
null
,
"产品接口参数信息有误,100350"
);
...
...
@@ -42,18 +43,22 @@ class UtilsPushService extends AppServiceBase {
if
(
!
invokeObj
[
interface_info
.
method_name
])
{
return
system
.
getResult
(
null
,
"产品接口参数方法信息有误,100360"
);
}
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"
)
{
var
actionBody
=
pobj
.
actionBody
;
if
(
!
interface_info
.
interface_url
)
{
return
system
.
getResult
(
null
,
"产品接口interface_url参数不能为空,100370"
);
}
delete
actionBody
.
product_info
[
"price_list"
];
delete
actionBody
.
product_info
[
"interface_info"
];
if
(
isDelProductInfo
&&
isDelProductInfo
==
1
)
{
if
(
actionBody
.
product_info
&&
actionBody
.
product_info
.
price_list
)
{
delete
actionBody
.
product_info
[
"price_list"
];
}
if
(
actionBody
.
product_info
&&
actionBody
.
product_info
.
interface_info
)
{
delete
actionBody
.
product_info
[
"interface_info"
];
}
if
(
isDelProductInfo
&&
isDelProductInfo
==
1
&&
actionBody
.
product_info
)
{
delete
actionBody
[
"product_info"
];
}
//是否删除产品信息进行推送
refResult
=
await
this
.
restPostUrl
(
pobj
.
actionBody
,
interface_info
.
interface_url
);
...
...
center-channel/app/config/routes/api.js
View file @
19772783
...
...
@@ -7,6 +7,29 @@ const utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式---------web---------开始
app
.
use
(
'/tlpay/aliPayNotify'
,
async
function
(
req
,
res
)
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
// var result = await utilsOrderSve.receiveCallBackNotify(req.body, client_ip);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"aliPayNotify记录回调"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
),
clientIp
:
client_ip
||
""
});
// if (result.status != 0) {
// return res.end("FAIL");
// }
return
res
.
end
(
"success"
);
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"aliPayNotify记录回调异常"
,
op
:
"center-channel/tlpay/aliPayNotify"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
});
}
});
app
.
use
(
'/tlpay/notify'
,
async
function
(
req
,
res
)
{
try
{
var
client_ip
=
system
.
get_client_ip
(
req
);
...
...
@@ -89,7 +112,7 @@ module.exports = function (app) {
var
lst
=
[
"addOrder"
,
"getH5PayUrl"
,
"getOrderQrCode"
,
"queryOrderStatus"
,
"getOrderInfo"
,
"getOrderDeliveryInfo"
,
"getOrderDetails"
,
"getOrderDeliveryFlowInfo"
,
"getOrderDeliveryFlowList"
,
"getOrderLogInfo"
,
"updateContacts"
,
"updateTmOrder"
,
"delOrder"
,
"submitProgramme"
,
"getProgrammeListByUser"
,
"getProgrammeInfoByNeedNo"
,
"abolishProgramme"
"submitProgramme"
,
"getProgrammeListByUser"
,
"getProgrammeInfoByNeedNo"
,
"abolishProgramme"
,
"getAliPayInfo"
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
...
...
@@ -188,6 +211,10 @@ module.exports = function (app) {
next
();
return
;
}
if
(
req
.
path
.
indexOf
(
"/taskapi/"
).
indexOf
>=
0
)
{
next
();
return
;
}
if
(
!
req
.
body
.
actionType
)
{
result
.
msg
=
"actionType can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
...
...
@@ -209,7 +236,7 @@ module.exports = function (app) {
req
.
body
.
appInfo
=
result
.
data
;
req
.
body
.
actionProcess
=
result
.
data
.
app_code
;
var
lst
=
[
"submitNeed"
,
"paySuccess"
"submitNeed"
,
"paySuccess"
];
if
(
lst
.
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
var
userpin
=
req
.
headers
[
"userpin"
]
||
""
;
...
...
center-channel/阿里文档
0 → 100644
View file @
19772783
1.获取请求token
1.获取请求token
[/api/opreceive/accessAuth/getAppTokenByAppKey]
请求方式:POST
参数格式 JSON
HTTP请求方式 POST
{
"actionType":"getAppTokenByAppKey",//固定写法就行
"actionBody":{
"appkey": "2019090811", //Y string appkey
"secret": "f99d413b767f09b5dff0b3610366cc46"//Y string 密钥
}
}
返回结果
{
"status": 0,
"msg": "success",
"data": {
"token": "40d64e586551405c9bcafab87266bc04" //token用于其他接口请求时,放在请求头中
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
2.阿里通过授权码获取用户userpin---->供前端调用
地址:[/web/auth/channelAccessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "getUserPinByAliCode",
"actionBody": {
"code":"N2020021413152wiWI2e"// Y 授权码
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"userpin":"c54abe7249a2a1195d236b333f79"
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
3.获取钉钉用于支付宝支付的信息---->供前端调用
地址:[/web/payment/channelPayment/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
请求头中需要有userpin
{
"actionType": "getAliPayInfo",
"actionBody": {
"orderNo":"N2020021413152wiWI2e"// Y 订单号
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"service": "mobile.securitypay.pay",
"partner": "2088001575712426",
"_input_charset": "utf-8",
"notify_url": "http://alitm.qifu.gongsibao.com/tlpay/aliPayNotify",
"out_trade_no": "sytest001",
"subject": "测试01",
"payment_type": "1",
"seller_id": "2022815690@qq.com",
"total_fee": 0.01,
"sign_type": "RSA",
"sign": "CVvZuC0w2ZjcClTUfXtSNj8FtFs5spThQxv+oQ5tvjqFA5qoK7vihf2TkKuDX/6DvdZn1N47VIp1jsr33wMO77fS8E8ouaDJghnnUeyIST6QawYfYc3j0qIuWfXakkrcvzMhQAujbuogd/D7ntLJd1RyC3g03SaOYCPIfFfqc6U="
},
"requestId": "8691ec2bf95d4eef94cff70959c4f062"
}
\ 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