Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
defdae9f
Commit
defdae9f
authored
Dec 14, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付测试
parent
dcb2c438
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
TencentPay.php
application/library/Payment/TencentPay.php
+8
-5
OrderService.php
application/models/Business/Order/OrderService.php
+10
-3
PaymentService.php
application/models/Business/Order/PaymentService.php
+1
-0
application.ini
conf/application.ini
+2
-2
No files found.
application/library/Payment/TencentPay.php
View file @
defdae9f
...
@@ -108,19 +108,22 @@ class TencentPay {
...
@@ -108,19 +108,22 @@ class TencentPay {
return
$prepay_id
;
return
$prepay_id
;
}
}
function
getOrderPayResult
(
$pay_sn
,
$serviceFlag
=
false
){
function
getOrderPayResult
(
$pay_sn
,
$subMchId
=
false
){
if
(
$serviceFlag
){
if
(
$subMchId
){
$this
->
parameters
[
'appid'
]
=
$this
->
appid
;
$this
->
parameters
[
'mch_id'
]
=
$this
->
mch_id
;
}
else
{
$this
->
parameters
[
'appid'
]
=
$this
->
s_appid
;
$this
->
parameters
[
'appid'
]
=
$this
->
s_appid
;
$this
->
parameters
[
'mch_id'
]
=
$this
->
s_mch_id
;
$this
->
parameters
[
'mch_id'
]
=
$this
->
s_mch_id
;
$this
->
parameters
[
'sub_appid'
]
=
$this
->
appid
;
$this
->
parameters
[
'sub_mch_id'
]
=
$subMchId
;
$this
->
key
=
$this
->
s_key
;
$this
->
key
=
$this
->
s_key
;
}
else
{
$this
->
parameters
[
'appid'
]
=
$this
->
appid
;
$this
->
parameters
[
'mch_id'
]
=
$this
->
mch_id
;
}
}
$this
->
parameters
[
'out_trade_no'
]
=
$pay_sn
;
$this
->
parameters
[
'out_trade_no'
]
=
$pay_sn
;
$this
->
parameters
[
'nonce_str'
]
=
\Our\CommonExtension
::
createNoncestr
(
32
);
$this
->
parameters
[
'nonce_str'
]
=
\Our\CommonExtension
::
createNoncestr
(
32
);
$this
->
postXml
(
$this
->
orderquery_url
);
$this
->
postXml
(
$this
->
orderquery_url
);
$this
->
result
=
$this
->
xmlToArray
(
$this
->
response
);
$this
->
result
=
$this
->
xmlToArray
(
$this
->
response
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$this
->
result
),
'/data/log/apptest'
);
if
(
$this
->
result
[
'return_code'
]
==
"SUCCESS"
&&
$this
->
result
[
'result_code'
]
==
"SUCCESS"
&&
$this
->
result
[
'trade_state'
]
==
"SUCCESS"
){
if
(
$this
->
result
[
'return_code'
]
==
"SUCCESS"
&&
$this
->
result
[
'result_code'
]
==
"SUCCESS"
&&
$this
->
result
[
'trade_state'
]
==
"SUCCESS"
){
return
true
;
return
true
;
}
}
...
...
application/models/Business/Order/OrderService.php
View file @
defdae9f
...
@@ -1162,18 +1162,26 @@ class OrderServiceModel extends \Business\AbstractModel
...
@@ -1162,18 +1162,26 @@ class OrderServiceModel extends \Business\AbstractModel
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
noOrderListForPaySn
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
noOrderListForPaySn
);
}
}
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$orderPayModel
=
\DAO\Order\OrderPayModel
::
getInstance
();
$orderPayModel
=
\DAO\Order\OrderPayModel
::
getInstance
();
$paySn
=
$data
[
'paySn'
];
$paySn
=
$data
[
'paySn'
];
$oldOrderPay
=
$orderPayModel
->
find
(
array
(
'pay_sn'
=>
$paySn
));
$oldOrderPay
=
$orderPayModel
->
find
(
array
(
'pay_sn'
=>
$paySn
));
$orderStateArray
=
array_column
(
$orderList
,
'order_state'
);
$orderStateArray
=
array_column
(
$orderList
,
'order_state'
);
if
(
in_array
(
\Our\ApiConst
::
orderStateWaitPay
,
$orderStateArray
)
&&
in_array
(
$oldOrderPay
[
'pay_type'
],
array
(
\Our\ApiConst
::
wxAppPayType
,
\Our\ApiConst
::
wxLitePayType
))){
if
(
in_array
(
\Our\ApiConst
::
orderStateWaitPay
,
$orderStateArray
)
&&
in_array
(
$oldOrderPay
[
'pay_type'
],
array
(
\Our\ApiConst
::
wxAppPayType
,
\Our\ApiConst
::
wxLitePayType
))
&&
(
isset
(
$data
[
'payFlag'
])
&&
$data
[
'payFlag'
]
==
\Our\ApiConst
::
one
)
){
if
(
$oldOrderPay
[
'pay_type'
]
==
\Our\ApiConst
::
wxLitePayType
){
if
(
$oldOrderPay
[
'pay_type'
]
==
\Our\ApiConst
::
wxLitePayType
){
$wxLitePay
=
\Payment\WxLitePay
::
getInstance
();
$wxLitePay
=
\Payment\WxLitePay
::
getInstance
();
$payResult
=
$wxLitePay
->
getOrderPayResult
(
$paySn
,
true
);
$storeId
=
$orderList
[
0
][
'store_id'
];
$mchIdArray
=
$storeDao
->
getStoreWxMchId
(
$storeId
);
if
(
$mchIdArray
[
'errorCode'
]
>
0
){
\Error\ErrorModel
::
throwException
(
$mchIdArray
[
'errorCode'
]);
}
$subMchId
=
$mchIdArray
[
'mchId'
];
$payResult
=
$wxLitePay
->
getOrderPayResult
(
$paySn
,
$subMchId
);
}
else
{
}
else
{
$wxPay
=
\Payment\WxPay
::
getInstance
();
$wxPay
=
\Payment\WxPay
::
getInstance
();
$payResult
=
$wxPay
->
getOrderPayResult
(
$paySn
);
$payResult
=
$wxPay
->
getOrderPayResult
(
$paySn
);
}
}
\Our\Log
::
getInstance
()
->
write
(
'支付结果'
.
$payResult
,
'/data/log/apptest'
);
if
(
$payResult
){
if
(
$payResult
){
$orderConfirmUtil
=
\Order\OrderConfirmUtil
::
getInstance
();
$orderConfirmUtil
=
\Order\OrderConfirmUtil
::
getInstance
();
$return
=
$orderConfirmUtil
->
updateOrderToPayed
(
array
(
'paySn'
=>
$paySn
,
'pay_type'
=>
$oldOrderPay
[
'pay_type'
]));
$return
=
$orderConfirmUtil
->
updateOrderToPayed
(
array
(
'paySn'
=>
$paySn
,
'pay_type'
=>
$oldOrderPay
[
'pay_type'
]));
...
@@ -1189,7 +1197,6 @@ class OrderServiceModel extends \Business\AbstractModel
...
@@ -1189,7 +1197,6 @@ class OrderServiceModel extends \Business\AbstractModel
$orderTips
=
\Our\DescribeConst
::
paySuccessTips
;
$orderTips
=
\Our\DescribeConst
::
paySuccessTips
;
$orderSubTips
=
\Our\DescribeConst
::
paySuccessSubTips
;
$orderSubTips
=
\Our\DescribeConst
::
paySuccessSubTips
;
$orderContents
=
array
();
$orderContents
=
array
();
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$orderIds
=
array
();
$orderIds
=
array
();
$orderNos
=
array
();
$orderNos
=
array
();
$orderState
=
\Our\ApiConst
::
one
;
$orderState
=
\Our\ApiConst
::
one
;
...
...
application/models/Business/Order/PaymentService.php
View file @
defdae9f
...
@@ -40,6 +40,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
...
@@ -40,6 +40,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
}
else
{
}
else
{
$pay_type
=
\Our\ApiConst
::
wxAppPayType
;
$pay_type
=
\Our\ApiConst
::
wxAppPayType
;
}
}
var_dump
(
$pay_type
);
$resultOrderPay
=
$orderPayModel
->
update
(
array
(
'pay_type'
=>
$pay_type
),
array
(
'pay_sn'
=>
$paySn
));
$resultOrderPay
=
$orderPayModel
->
update
(
array
(
'pay_type'
=>
$pay_type
),
array
(
'pay_sn'
=>
$paySn
));
if
(
!
$resultOrderPay
){
if
(
!
$resultOrderPay
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
payTypeUpdateError
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
payTypeUpdateError
);
...
...
conf/application.ini
View file @
defdae9f
...
@@ -404,7 +404,7 @@ elastic.master.scheme="http";
...
@@ -404,7 +404,7 @@ elastic.master.scheme="http";
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
resources.database.params.hostname
=
"127.0.0.1"
resources.database.params.port
=
3306
resources.database.params.port
=
3306
resources.database.params.database
=
"qmcs"
resources.database.params.database
=
"
test
qmcs"
resources.database.params.username
=
"root"
resources.database.params.username
=
"root"
resources.database.params.password
=
"123456"
resources.database.params.password
=
"123456"
resources.database.params.charset
=
"UTF8"
resources.database.params.charset
=
"UTF8"
...
@@ -414,7 +414,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
...
@@ -414,7 +414,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.hostname
=
"127.0.0.1"
resources.database.slave.params.hostname
=
"127.0.0.1"
resources.database.slave.params.port
=
3306
resources.database.slave.params.port
=
3306
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.database
=
"
test
qmcs"
resources.database.slave.params.username
=
"root"
resources.database.slave.params.username
=
"root"
resources.database.slave.params.password
=
"123456"
resources.database.slave.params.password
=
"123456"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.charset
=
"UTF8"
...
...
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