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
88a9fe16
Commit
88a9fe16
authored
Jan 14, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
d80991ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
171 additions
and
171 deletions
+171
-171
igirl-channel/app/base/service/impl/dborder/orderSve.js
+171
-171
No files found.
igirl-channel/app/base/service/impl/dborder/orderSve.js
View file @
88a9fe16
...
...
@@ -18,7 +18,7 @@ class OrderService extends ServiceBase {
this
.
orderReceiptVoucherDao
=
system
.
getObject
(
"db.dbcpay.orderreceiptvoucherDao"
);
}
//订单线下支付(上传支付凭证)
async
offlinePaymentOrder
(
obj
){
async
offlinePaymentOrder
(
obj
)
{
var
app
=
obj
.
app
;
var
user
=
obj
.
user
;
if
(
!
user
||
!
user
.
id
)
{
...
...
@@ -29,52 +29,52 @@ class OrderService extends ServiceBase {
}
var
orderNo
=
obj
.
orderNo
;
var
paymentVoucher
=
obj
.
paymentVoucher
;
if
(
!
orderNo
)
{
if
(
!
orderNo
)
{
return
system
.
getResultFail
(
-
102
,
"orderNo参数错误"
);
}
if
(
!
paymentVoucher
)
{
if
(
!
paymentVoucher
)
{
return
system
.
getResultFail
(
-
103
,
"paymentVoucher参数错误"
);
}
var
order
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
orderNo
:
orderNo
,
app_id
:
app
.
id
},
raw
:
true
where
:
{
orderNo
:
orderNo
,
app_id
:
app
.
id
},
raw
:
true
});
if
(
!
order
)
{
if
(
!
order
)
{
return
system
.
getResultFail
(
-
104
,
"订单不存在"
);
}
if
(
!
order
.
orderPayStatus
||
(
order
.
orderPayStatus
!=
"dfk"
&&
order
.
orderPayStatus
!=
"zfpz"
&&
order
.
orderPayStatus
!=
"zfshbtg"
))
{
return
system
.
getResultFail
(
-
105
,
"订单状态错误,订单当前状态为"
+
order
.
orderPayStatusName
);
if
(
!
order
.
orderPayStatus
||
(
order
.
orderPayStatus
!=
"dfk"
&&
order
.
orderPayStatus
!=
"zfpz"
&&
order
.
orderPayStatus
!=
"zfshbtg"
))
{
return
system
.
getResultFail
(
-
105
,
"订单状态错误,订单当前状态为"
+
order
.
orderPayStatusName
);
}
var
self
=
this
;
return
await
self
.
db
.
transaction
(
async
function
(
t
)
{
var
orderObj
=
{
id
:
order
.
id
,
orderPayStatus
:
"zfpz"
,
payTime
:
new
Date
()
};
var
orderObj
=
{
id
:
order
.
id
,
orderPayStatus
:
"zfpz"
,
payTime
:
new
Date
()
};
await
self
.
dao
.
update
(
orderObj
,
t
);
var
logMsg
=
{
sourceOrderNo
:
order
.
orderNo
,
opContent
:
"订单提交支付凭证"
,
app_id
:
app
.
id
,
isShow
:
1
};
await
self
.
orderflowDao
.
create
(
logMsg
,
t
);
var
orderReceiptVoucher
=
await
self
.
receiptvoucherDao
.
model
.
findOne
({
where
:
{
busPayOrderCode
:
order
.
orderNo
,
createapp_id
:
app
.
id
},
raw
:
true
where
:
{
busPayOrderCode
:
order
.
orderNo
,
createapp_id
:
app
.
id
},
raw
:
true
});
var
orderReceiptVoucherObj
=
{
receiptType
:
"sk"
,
auditStatus
:
"dsh"
,
certifyFileUrl
:
paymentVoucher
,
itemCode
:
order
.
itemCode
,
itemName
:
order
.
itemName
,
payuser_id
:
user
.
id
,
var
orderReceiptVoucherObj
=
{
receiptType
:
"sk"
,
auditStatus
:
"dsh"
,
certifyFileUrl
:
paymentVoucher
,
itemCode
:
order
.
itemCode
,
itemName
:
order
.
itemName
,
payuser_id
:
user
.
id
,
accountType
:
"bank"
,
sourceType
:
"order"
,
sourceType
:
"order"
,
payDate
:
new
Date
(),
//支付时间
totalSum
:
order
.
totalSum
,
//订单总额
sourceOrderNo
:
order
.
orderNo
sourceOrderNo
:
order
.
orderNo
};
if
(
orderReceiptVoucher
)
{
orderReceiptVoucherObj
[
"id"
]
=
orderReceiptVoucher
.
id
;
orderReceiptVoucherObj
[
"updateuser_id"
]
=
user
.
id
;
await
self
.
receiptvoucherDao
.
update
(
orderReceiptVoucherObj
,
t
);
}
else
{
orderReceiptVoucherObj
[
"createuser_id"
]
=
user
.
id
;
orderReceiptVoucherObj
[
"createapp_id"
]
=
app
.
id
;
await
self
.
receiptvoucherDao
.
create
(
orderReceiptVoucherObj
,
t
);
if
(
orderReceiptVoucher
)
{
orderReceiptVoucherObj
[
"id"
]
=
orderReceiptVoucher
.
id
;
orderReceiptVoucherObj
[
"updateuser_id"
]
=
user
.
id
;
await
self
.
receiptvoucherDao
.
update
(
orderReceiptVoucherObj
,
t
);
}
else
{
orderReceiptVoucherObj
[
"createuser_id"
]
=
user
.
id
;
orderReceiptVoucherObj
[
"createapp_id"
]
=
app
.
id
;
await
self
.
receiptvoucherDao
.
create
(
orderReceiptVoucherObj
,
t
);
}
return
system
.
getResultSuccess
();
})
...
...
@@ -818,12 +818,12 @@ class OrderService extends ServiceBase {
//-------------------------通联支付------start---------------------------------------------------------
//获取center-channel token
async
getCenterChannelToken
(
app
){
var
pobj
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:{
"appkey"
:
app
.
uappKey
,
"secret"
:
app
.
appSecret
async
getCenterChannelToken
(
app
)
{
var
pobj
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:
{
"appkey"
:
app
.
uappKey
,
"secret"
:
app
.
appSecret
}
};
var
url
=
settings
.
centerChannelUrl
()
+
"web/auth/accessAuth/getAppTokenByAppKey"
;
...
...
@@ -835,76 +835,76 @@ class OrderService extends ServiceBase {
return
result
;
}
//获取通联支付二维码
async
getTlPayQrCode
(
obj
){
if
(
!
obj
.
app
||
!
obj
.
app
.
uAppId
||
!
obj
.
app
.
id
)
{
async
getTlPayQrCode
(
obj
)
{
if
(
!
obj
.
app
||
!
obj
.
app
.
uAppId
||
!
obj
.
app
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"渠道信息有误"
);
}
if
(
!
obj
.
orderNo
)
{
if
(
!
obj
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"orderNo参数有误"
);
}
var
order
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
orderNo
:
obj
.
orderNo
,
app_id
:
obj
.
app
.
id
},
raw
:
true
,
attributes
:
[
"id"
,
"orderNo"
,
"itemCode"
,
"itemName"
,
"channelItemCode"
,
"channelItemName"
,
"salesNum"
,
"orderPayStatus"
,
"orderPayStatusName"
,
"totalSum"
,
"created_at"
]
where
:
{
orderNo
:
obj
.
orderNo
,
app_id
:
obj
.
app
.
id
},
raw
:
true
,
attributes
:
[
"id"
,
"orderNo"
,
"itemCode"
,
"itemName"
,
"channelItemCode"
,
"channelItemName"
,
"salesNum"
,
"orderPayStatus"
,
"orderPayStatusName"
,
"totalSum"
,
"created_at"
]
});
if
(
order
.
orderPayStatus
==
"yfk"
)
{
return
system
.
getResultFail
(
-
99
,
"订单已付款"
);
}
if
(
!
order
||
!
order
.
totalSum
)
{
if
(
!
order
||
!
order
.
totalSum
)
{
return
system
.
getResultFail
(
-
102
,
"订单数据有误"
);
}
if
(
!
obj
.
opType
)
{
if
(
!
obj
.
opType
)
{
return
system
.
getResultFail
(
-
103
,
"opType参数有误"
);
}
var
token
=
""
;
var
token
=
""
;
var
tokenRes
=
await
this
.
getCenterChannelToken
(
obj
.
app
);
if
(
tokenRes
&&
tokenRes
.
status
==
0
&&
tokenRes
.
data
)
{
token
=
tokenRes
.
data
.
token
;
if
(
tokenRes
&&
tokenRes
.
status
==
0
&&
tokenRes
.
data
)
{
token
=
tokenRes
.
data
.
token
;
}
if
(
!
token
)
{
if
(
!
token
)
{
return
system
.
getResultFail
(
-
99
,
"获取token失败"
);
}
var
url
=
settings
.
centerChannelUrl
()
+
"web/payment/paymentApi/springBoard"
;
var
pobj
=
{
"actionType"
:
"getQrCode"
,
"actionBody"
:
{
"uapp_id"
:
obj
.
app
.
uAppId
,
"order_num"
:
order
.
orderNo
,
"total_fee"
:
Number
(
order
.
totalSum
)
*
100
,
"body_desc"
:
"1"
,
"opType"
:
obj
.
opType
}
var
pobj
=
{
"actionType"
:
"getQrCode"
,
"actionBody"
:
{
"uapp_id"
:
obj
.
app
.
uAppId
,
"order_num"
:
order
.
orderNo
,
"total_fee"
:
Number
(
order
.
totalSum
)
*
100
,
"body_desc"
:
order
.
itemName
,
"opType"
:
obj
.
opType
}
};
var
rtn
=
await
this
.
execClient
.
execPushDataPost
(
pobj
,
url
,
token
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
trxid
)
{
if
(
result
&&
result
.
status
==
0
&&
result
.
data
&&
result
.
data
.
trxid
)
{
await
this
.
cacheManager
[
"ZxPayLocker"
].
init
(
result
.
data
.
trxid
);
result
.
data
.
order
=
order
;
}
return
result
;
}
async
receiveTlCallBackNotify
(
obj
)
{
//接收通联支付回调通知
try
{
if
(
obj
&&
obj
.
trxstatus
==
"0000"
)
{
if
(
obj
&&
obj
.
trxstatus
==
"0000"
)
{
// obj.company_id = obj.uappid;
var
app
=
await
this
.
appDao
.
model
.
findOne
({
where
:
{
uAppId
:
obj
.
uappid
},
raw
:
true
where
:
{
uAppId
:
obj
.
uappid
},
raw
:
true
});
if
(
!
app
)
{
if
(
!
app
)
{
return
system
.
getResultFail
(
-
100
,
"渠道参数错误"
);
}
var
resultSign
=
await
this
.
resultTlSign
(
obj
,
app
.
appSecret
);
if
(
!
resultSign
||
resultSign
.
status
<
0
)
{
var
resultSign
=
await
this
.
resultTlSign
(
obj
,
app
.
appSecret
);
if
(
!
resultSign
||
resultSign
.
status
<
0
)
{
return
resultSign
;
}
var
orderInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
orderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
raw
:
true
where
:
{
orderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
raw
:
true
});
if
(
!
orderInfo
)
{
return
system
.
getResultFail
(
-
102
,
"订单数据不存在"
);
...
...
@@ -913,7 +913,7 @@ class OrderService extends ServiceBase {
return
system
.
getResultSuccess
({
orderPayStatus
:
"yfk"
});
}
//修改并返回订单支付状态,创建收款单
return
await
this
.
opBackNotify
(
obj
,
"接收通联支付通知回调"
,
app
);
return
await
this
.
opBackNotify
(
obj
,
"接收通联支付通知回调"
,
app
);
}
else
if
(
obj
.
trxstatus
==
"3045"
)
{
return
system
.
getResultFail
(
-
104
,
"超时未支付,queryTlPayOrder新页面"
);
...
...
@@ -924,90 +924,90 @@ class OrderService extends ServiceBase {
}
}
async
checkPayStatusTl
(
obj
)
{
//通联支付状态验证
var
wxPayOrderCode
=
obj
.
wxPayOrderCode
||
""
;
var
aliPayOrderCode
=
obj
.
aliPayOrderCode
||
""
;
var
app
=
obj
.
app
;
if
(
!
app
){
return
system
.
getResultFail
(
-
100
,
"渠道参数错误"
);
}
var
comanyId
=
app
.
uAppId
;
var
opType
=
obj
.
op_type
;
var
orderCode
=
obj
.
orderCode
;
if
(
!
wxPayOrderCode
||
!
aliPayOrderCode
||
!
comanyId
||
!
opType
||
!
orderCode
)
{
return
system
.
getResultFail
(
-
101
,
"参数错误"
);
}
var
orderInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
orderNo
:
orderCode
,
app_id
:
app
.
id
},
raw
:
true
var
wxPayOrderCode
=
obj
.
wxPayOrderCode
||
""
;
var
aliPayOrderCode
=
obj
.
aliPayOrderCode
||
""
;
var
app
=
obj
.
app
;
if
(
!
app
)
{
return
system
.
getResultFail
(
-
100
,
"渠道参数错误"
);
}
var
comanyId
=
app
.
uAppId
;
var
opType
=
obj
.
op_type
;
var
orderCode
=
obj
.
orderCode
;
if
(
!
wxPayOrderCode
||
!
aliPayOrderCode
||
!
comanyId
||
!
opType
||
!
orderCode
)
{
return
system
.
getResultFail
(
-
101
,
"参数错误"
);
}
var
orderInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
orderNo
:
orderCode
,
app_id
:
app
.
id
},
raw
:
true
});
if
(
!
orderInfo
)
{
return
system
.
getResultFail
(
-
102
,
"订单数据不存在"
);
}
if
(
orderInfo
.
orderPayStatus
==
"yfk"
)
{
var
returnObj
=
{
"payOrderNo"
:
""
,
"busPayOrderCode"
:
""
,
"code"
:
orderInfo
.
orderNo
,
"app_id"
:
app
.
id
,
"sveItemCode"
:
orderInfo
.
itemCode
,
"sveItemName"
:
orderInfo
.
itemName
,
"channelItemCode"
:
orderInfo
.
channelItemCode
,
"totalSum"
:
orderInfo
.
totalSum
,
"orderPayStatus"
:
"yfk"
,
};
var
orderReceiptVoucher
=
await
this
.
receiptvoucherDao
.
model
.
findOne
({
where
:
{
createapp_id
:
app
.
id
,
busPayOrderCode
:
orderInfo
.
orderNo
},
raw
:
true
});
if
(
!
orderInfo
)
{
return
system
.
getResultFail
(
-
102
,
"订单数据不存在"
);
if
(
orderReceiptVoucher
&&
orderReceiptVoucher
.
busPayOrderCode
)
{
returnObj
.
busPayOrderCode
=
orderReceiptVoucher
.
busPayOrderCode
;
returnObj
.
payOrderNo
=
orderReceiptVoucher
.
payOrderNo
;
}
if
(
orderInfo
.
orderPayStatus
==
"yfk"
)
{
var
returnObj
=
{
"payOrderNo"
:
""
,
"busPayOrderCode"
:
""
,
"code"
:
orderInfo
.
orderNo
,
"app_id"
:
app
.
id
,
"sveItemCode"
:
orderInfo
.
itemCode
,
"sveItemName"
:
orderInfo
.
itemName
,
"channelItemCode"
:
orderInfo
.
channelItemCode
,
"totalSum"
:
orderInfo
.
totalSum
,
"orderPayStatus"
:
"yfk"
,
};
var
orderReceiptVoucher
=
await
this
.
receiptvoucherDao
.
model
.
findOne
({
where
:{
createapp_id
:
app
.
id
,
busPayOrderCode
:
orderInfo
.
orderNo
},
raw
:
true
});
if
(
orderReceiptVoucher
&&
orderReceiptVoucher
.
busPayOrderCode
){
returnObj
.
busPayOrderCode
=
orderReceiptVoucher
.
busPayOrderCode
;
returnObj
.
payOrderNo
=
orderReceiptVoucher
.
payOrderNo
;
}
return
system
.
getResultSuccess
(
returnObj
);
return
system
.
getResultSuccess
(
returnObj
);
}
var
payTrxid
=
opType
==
"wx"
?
wxPayOrderCode
:
aliPayOrderCode
;
var
opComanyId
=
comanyId
;
var
payStatus
=
await
this
.
queryTlPayOrder
(
app
,
payTrxid
);
//查询通联支付状态
if
(
payStatus
&&
payStatus
.
status
==
0
&&
payStatus
.
data
&&
payStatus
.
data
.
trxstatus
==
"0000"
)
{
payStatus
.
data
.
client_ip
=
obj
.
client_ip
||
""
;
let
attachList
=
[];
if
(
payStatus
.
data
.
reqsn
.
indexOf
(
"_"
)
>=
0
)
{
attachList
=
payStatus
.
data
.
reqsn
.
split
(
"_"
);
}
var
payTrxid
=
opType
==
"wx"
?
wxPayOrderCode
:
aliPayOrderCode
;
var
opComanyId
=
comanyId
;
var
payStatus
=
await
this
.
queryTlPayOrder
(
app
,
payTrxid
);
//查询通联支付状态
if
(
payStatus
&&
payStatus
.
status
==
0
&&
payStatus
.
data
&&
payStatus
.
data
.
trxstatus
==
"0000"
)
{
payStatus
.
data
.
client_ip
=
obj
.
client_ip
||
""
;
let
attachList
=
[];
if
(
payStatus
.
data
.
reqsn
.
indexOf
(
"_"
)
>=
0
)
{
attachList
=
payStatus
.
data
.
reqsn
.
split
(
"_"
);
}
else
{
attachList
.
push
(
payStatus
.
data
.
reqsn
);
}
if
(
attachList
.
length
!=
2
)
{
return
system
.
getResultFail
(
-
103
,
"reqsn参数错误,没有_标识"
);
}
payStatus
.
data
.
out_trade_no
=
attachList
[
0
];
payStatus
.
data
.
company_id
=
attachList
[
1
];
//修改并返回订单支付状态,创建收款单
return
await
this
.
opBackNotify
(
payStatus
.
data
,
"queryTlPayOrder面回调"
,
app
);
else
{
attachList
.
push
(
payStatus
.
data
.
reqsn
);
}
else
if
(
payStatus
&&
payStatus
.
code
==
1
&&
payStqueryTlPayOrders
.
data
.
trxstatus
==
"3045"
)
{
return
system
.
getResultFail
(
-
10
4
,
"超时未支付,queryTlPayOrder新页面
"
);
if
(
attachList
.
length
!=
2
)
{
return
system
.
getResultFail
(
-
10
3
,
"reqsn参数错误,没有_标识
"
);
}
return
system
.
getResultFail
(
-
104
,
"请及时支付"
);
payStatus
.
data
.
out_trade_no
=
attachList
[
0
];
payStatus
.
data
.
company_id
=
attachList
[
1
];
//修改并返回订单支付状态,创建收款单
return
await
this
.
opBackNotify
(
payStatus
.
data
,
"queryTlPayOrder面回调"
,
app
);
}
else
if
(
payStatus
&&
payStatus
.
code
==
1
&&
payStqueryTlPayOrders
.
data
.
trxstatus
==
"3045"
)
{
return
system
.
getResultFail
(
-
104
,
"超时未支付,queryTlPayOrder新页面"
);
}
return
system
.
getResultFail
(
-
104
,
"请及时支付"
);
}
//查询通联支付订单
async
queryTlPayOrder
(
app
,
payTrxid
){
var
token
=
""
;
async
queryTlPayOrder
(
app
,
payTrxid
)
{
var
token
=
""
;
var
tokenRes
=
await
this
.
getCenterChannelToken
(
app
);
if
(
tokenRes
&&
tokenRes
.
status
==
0
&&
tokenRes
.
data
)
{
token
=
tokenRes
.
data
.
token
;
if
(
tokenRes
&&
tokenRes
.
status
==
0
&&
tokenRes
.
data
)
{
token
=
tokenRes
.
data
.
token
;
}
if
(
!
token
)
{
if
(
!
token
)
{
return
system
.
getResultFail
(
-
99
,
"获取token失败"
);
}
var
url
=
settings
.
centerChannelUrl
()
+
"web/payment/paymentApi/springBoard"
;
var
pobj
=
{
"actionType"
:
"queryOrder"
,
"actionBody"
:
{
"uapp_id"
:
app
.
uAppId
,
"trxid"
:
payTrxid
}
var
pobj
=
{
"actionType"
:
"queryOrder"
,
"actionBody"
:
{
"uapp_id"
:
app
.
uAppId
,
"trxid"
:
payTrxid
}
};
var
rtn
=
await
this
.
execClient
.
execPushDataPost
(
pobj
,
url
,
token
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
...
...
@@ -1017,7 +1017,7 @@ class OrderService extends ServiceBase {
return
result
;
}
//操作回调业务逻辑
async
opBackNotify
(
getParams
,
opDesc
,
app
)
{
async
opBackNotify
(
getParams
,
opDesc
,
app
)
{
try
{
//日志记录
this
.
logCtl
.
info
({
...
...
@@ -1035,7 +1035,7 @@ class OrderService extends ServiceBase {
}
else
{
getParams
.
req_accountType
=
"alipay"
;
}
return
await
this
.
notifyOpDb
(
getParams
,
app
);
return
await
this
.
notifyOpDb
(
getParams
,
app
);
}
else
{
// await this.cacheManager["ZxPayLocker"].release(getParams.trxid);//---测试时放开
...
...
@@ -1055,28 +1055,28 @@ class OrderService extends ServiceBase {
return
system
.
getResultFail
(
-
200
,
e
.
stack
);
}
}
/*
返回值:
-430:对应的业务支付订单号暂无
-450:对应的订单支付金额不符
-480:订单状态有误
其余为事务处理会抛出异常
*/
async
notifyOpDb
(
obj
,
app
)
{
var
accountType
=
"other"
;
/*
返回值:
-430:对应的业务支付订单号暂无
-450:对应的订单支付金额不符
-480:订单状态有误
其余为事务处理会抛出异常
*/
async
notifyOpDb
(
obj
,
app
)
{
var
accountType
=
"other"
;
if
(
obj
.
req_accountType
==
"wx"
)
{
accountType
=
"wx"
;
}
if
(
obj
.
req_accountType
==
"alipay"
)
{
if
(
obj
.
req_accountType
==
"alipay"
)
{
accountType
=
"alipay"
;
}
// var account_type_list = uiconfig.config.pdict.accountType;
// var account_type_name = account_type_list[obj.req_accountType];
// obj.account_type_name = account_type_name;
var
sqlWheres
=
{
orderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
};
var
sqlWheres
=
{
orderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
};
var
orderItem
=
await
this
.
dao
.
model
.
findOne
({
where
:
sqlWheres
,
raw
:
true
raw
:
true
});
if
(
!
orderItem
)
{
return
system
.
getResultFail
(
-
430
,
"对应的业务支付订单号暂无"
);
...
...
@@ -1090,41 +1090,41 @@ class OrderService extends ServiceBase {
var
self
=
this
;
return
await
this
.
db
.
transaction
(
async
function
(
t
)
{
// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
var
putParams
=
{
orderPayStatus
:
"yfk"
,
payDate
:
new
Date
()
};
var
putParams
=
{
orderPayStatus
:
"yfk"
,
payDate
:
new
Date
()
};
await
self
.
dao
.
updateByWhere
(
putParams
,
{
where
:
sqlWheres
},
t
);
var
otmp
=
await
self
.
ordertmproductDao
.
model
.
findOne
({
where
:
{
sourceOrderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
raw
:
true
var
otmp
=
await
self
.
ordertmproductDao
.
model
.
findOne
({
where
:
{
sourceOrderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
raw
:
true
});
if
(
otmp
&&
otmp
.
id
)
{
var
otmpObj
=
{
payStatus
:
"yfk"
if
(
otmp
&&
otmp
.
id
)
{
var
otmpObj
=
{
payStatus
:
"yfk"
};
// await self.ordertmproductDao.model.update(otmpObj, t);
await
self
.
ordertmproductDao
.
model
.
update
(
otmpObj
,
{
where
:
{
sourceOrderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
transaction
:
t
});
await
self
.
ordertmproductDao
.
model
.
update
(
otmpObj
,
{
where
:
{
sourceOrderNo
:
obj
.
out_trade_no
,
app_id
:
app
.
id
},
transaction
:
t
});
}
//订单流程log
self
.
orderflowDao
.
create
({
app_id
:
app
.
id
,
isShow
:
1
,
app_id
:
app
.
id
,
isShow
:
1
,
createuser_id
:
orderItem
.
createuser_id
,
sourceOrderNo
:
orderItem
.
orderNo
,
opContent
:
"订单已成功支付,方式为"
+
accountType
,
},
t
);
//帐户类型( 支付类型):cash: 现金, bank: 银行 ,wx:微信,alipay:支付宝,other:其它
var
orderReceiptVoucherObj
=
{
sourceType
:
"order"
,
receiptType
:
"sk"
,
itemCode
:
orderItem
.
itemCode
,
itemName
:
orderItem
.
itemName
,
channelItemCode
:
orderItem
.
channelItemCode
,
createapp_id
:
app
.
id
,
payOrderNo
:
obj
.
trxid
,
var
orderReceiptVoucherObj
=
{
sourceType
:
"order"
,
receiptType
:
"sk"
,
itemCode
:
orderItem
.
itemCode
,
itemName
:
orderItem
.
itemName
,
channelItemCode
:
orderItem
.
channelItemCode
,
createapp_id
:
app
.
id
,
payOrderNo
:
obj
.
trxid
,
accountType
:
accountType
,
payDate
:
new
Date
(),
//支付时间
totalSum
:
orderItem
.
totalSum
,
//订单总额
sourceOrderNo
:
orderItem
.
orderNo
,
busPayOrderCode
:
obj
.
trxid
//业务支付订单号
sourceOrderNo
:
orderItem
.
orderNo
,
busPayOrderCode
:
obj
.
trxid
//业务支付订单号
};
var
receiptVoucher
=
await
self
.
receiptvoucherDao
.
create
(
orderReceiptVoucherObj
,
t
);
var
receiptVoucher
=
await
self
.
receiptvoucherDao
.
create
(
orderReceiptVoucherObj
,
t
);
// var orderReceiptVoucher = await self.orderReceiptVoucherDao.create(orderReceiptVoucherObj,t);
var
resdata
=
{
"busPayOrderCode"
:
obj
.
trxid
,
...
...
@@ -1140,7 +1140,7 @@ class OrderService extends ServiceBase {
}
//-------------------------通联支付------end---------------------------------------------------------
}
module
.
exports
=
OrderService
;
// var task = new OrderService();
...
...
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