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
959377fc
Commit
959377fc
authored
Jan 07, 2019
by
testshenbd
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ccw' of git.shenbd.com:qm-develop/shenbd into master_dev
parents
f17d6530
326dfcc6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
9 deletions
+34
-9
TencentPay.php
application/library/Payment/TencentPay.php
+11
-4
WxLitePay.php
application/library/Payment/WxLitePay.php
+0
-1
OrderService.php
application/models/Business/Order/OrderService.php
+6
-1
RefundReturn.php
application/models/DAO/Order/RefundReturn.php
+17
-3
No files found.
application/library/Payment/TencentPay.php
View file @
959377fc
...
...
@@ -26,8 +26,8 @@ class TencentPay {
protected
$prepay_id
=
''
;
protected
$tradeType
=
''
;
public
$data
;
//接收到的数据,类型为关联数组
var
$returnParameters
;
//返回参数,类型为关联数组
var
$parameters
;
//请求参数,类型为关联数组
public
$returnParameters
;
//返回参数,类型为关联数组
public
$parameters
;
//请求参数,类型为关联数组
public
function
setRequestParams
(
$orderInfo
){
$pay_sn
=
$orderInfo
[
'paySn'
];
...
...
@@ -158,7 +158,11 @@ class TencentPay {
{
if
(
$signType
==
'MD5'
){
//echo '加签参数:'.json_encode($this->parameters)."\n";
$this
->
parameters
[
"sign"
]
=
$this
->
getSign
(
$this
->
parameters
);
//签名
if
(
empty
(
$this
->
parameters
)){
echo
234234
;
exit
;
}
$tempParam
=
$this
->
parameters
;
$this
->
parameters
[
"sign"
]
=
$this
->
getSign
(
$tempParam
);
//签名
}
else
{
$this
->
parameters
[
"sign"
]
=
$this
->
getHMACSHA1Sign
(
$this
->
parameters
,
'sha256'
);
}
...
...
@@ -280,6 +284,9 @@ class TencentPay {
*/
public
function
getSign
(
$Obj
)
{
/*if(empty($Obj)){
$Obj = $this->parameters;
}*/
foreach
(
$Obj
as
$k
=>
$v
)
{
$Parameters
[
$k
]
=
$v
;
...
...
@@ -287,11 +294,11 @@ class TencentPay {
//签名步骤一:按字典序排序参数
ksort
(
$Parameters
);
$String
=
$this
->
formatBizQueryParaMap
(
$Parameters
,
false
);
$String
=
$String
.
"&key="
.
$this
->
key
;
$String
=
str_replace
(
array
(
"
\r\n
"
,
"
\r
"
,
"
\n
"
,
" "
),
""
,
$String
);
$String
=
md5
(
$String
);
$result_
=
strtoupper
(
$String
);
//echo "\r\n sign:"."$result_";
return
$result_
;
}
...
...
application/library/Payment/WxLitePay.php
View file @
959377fc
...
...
@@ -91,7 +91,6 @@ class WxLitePay extends \Payment\TencentPay{
$this
->
parameters
[
'out_trade_no'
]
=
$param
[
'outTradeNo'
];
$this
->
parameters
[
'out_refund_no'
]
=
$param
[
'refundOrderNo'
];
$xml
=
$this
->
createXml
();
$response
=
$this
->
postXmlSSLCurl
(
$xml
,
$this
->
refundUrl
,
6
);
$values
=
$this
->
xmlToArray
(
$response
);
...
...
application/models/Business/Order/OrderService.php
View file @
959377fc
...
...
@@ -895,7 +895,8 @@ class OrderServiceModel extends \Business\AbstractModel
// }
// }
$orderInfo
[
'refundOrderNo'
]
=
$refundSn
;
if
(
$refundReturnDao
->
refundMoney
(
$orderInfo
)){
$refundRes
=
$refundReturnDao
->
refundMoney
(
$orderInfo
);
if
(
$refundRes
){
$where
[
'order_id'
]
=
$orderInfo
[
'orderId'
];
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData
[
'is_refund'
]
=
1
;
...
...
@@ -906,6 +907,7 @@ class OrderServiceModel extends \Business\AbstractModel
echo
$refundReturnDao
->
errorMessage
.
"orderId:"
.
$orderId
;
return
false
;
}
$orderDao
->
update
(
array
(
'order_id'
=>
$orderInfo
[
'orderId'
]),
array
(
'order_note'
=>
$refundReturnDao
->
errorMessage
));
}
...
...
@@ -1085,10 +1087,12 @@ class OrderServiceModel extends \Business\AbstractModel
if
(
$order
[
'paymentTime'
]
>
ApiConst
::
zero
&&
in_array
(
$order
[
'paymentType'
],
ArrayConst
::
orderPayTypeOnlines
))
{
$isRefunMoney
=
$this
->
changeOrderStateCancelUnconditional
(
$order
);
if
(
!
$isRefunMoney
){
$orderDao
->
db
->
doRollback
();
continue
;
}
}
array_push
(
$orderIds
,
$order
[
'orderId'
]);
$this
->
updateOrderGoodsStoregeByOrderIds
(
$orderIds
);
array_push
(
$newOrders
,
$order
);
...
...
@@ -1097,6 +1101,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao
->
deleteOrderCache
(
$order
[
'buyerId'
],(
string
)
$order
[
'orderId'
],
$order
[
'storeId'
],
true
);
$storeDao
->
deleteStoreCache
(
$order
[
'storeId'
],
$order
[
'orderId'
]);
$push
=
\Our\Push
::
getInstance
();
echo
json_encode
(
$order
);
$pushData
=
array
(
'storeId'
=>
$order
[
'storeId'
],
'type'
=>
ApiConst
::
messageWaitReceive
,
'waitReceiveCount'
=>
ApiConst
::
reduceOne
,
...
...
application/models/DAO/Order/RefundReturn.php
View file @
959377fc
...
...
@@ -474,6 +474,7 @@ class RefundReturnModel extends \DAO\AbstractModel
$param
[
'refundFee'
]
=
$orderInfo
[
'orderAmount'
];
//全额退款
$param
[
'storeId'
]
=
$orderInfo
[
'storeId'
];
$param
[
'buyerId'
]
=
$orderInfo
[
'buyerId'
];
if
(
CURRENTVERSION
!=
\Our\NameConst
::
versionDefault
&&
in_array
(
intval
(
$orderInfo
[
'paymentType'
]),
array
(
\Our\ApiConst
::
wxAppPayType
,
\Our\ApiConst
::
wxProgram
)))
{
$mchIdArray
=
\DAO\StoreModel
::
getInstance
()
->
getStoreWxMchId
(
$param
[
'storeId'
]);
if
(
$mchIdArray
[
'errorCode'
]
>
0
)
{
...
...
@@ -483,17 +484,23 @@ class RefundReturnModel extends \DAO\AbstractModel
$param
[
'subMchId'
]
=
$mchIdArray
[
'mchId'
];
}
if
(
intval
(
$orderInfo
[
'paymentType'
])
==
ApiConst
::
wxAppPayType
)
{
$wxpay
=
\Payment\WxPay
::
getInstance
();
$wxpay
=
new
\Payment\WxPay
();
//unset($param['subMchId']);
$refund_return
=
$wxpay
->
refund
(
$param
);
unset
(
$wxpay
);
$this
->
errorMessage
=
"微信返回:"
.
json_encode
(
$refund_return
);
if
(
!
(
$refund_return
[
'return_code'
]
==
'SUCCESS'
&&
$refund_return
[
'result_code'
]
==
'SUCCESS'
))
{
if
(
$refund_return
[
'err_code_des'
]
==
'订单已全额退款'
||
$refund_return
[
'err_code_des'
]
==
'订单已Q68额退款'
){
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
$refund_return
[
'err_code_des'
]
.
$orderInfo
[
'orderId'
]
.
"
\r\n
"
;
return
true
;
}
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
'微信退款操作执行失败!'
.
$orderInfo
[
'orderId'
]
.
"
\r\n
"
;
return
false
;
}
}
else
if
(
intval
(
$orderInfo
[
'paymentType'
])
==
ApiConst
::
alipay
)
{
$aliPay
=
\Payment\Alipay
::
getInstance
();
$aliPay
=
new
\Payment\Alipay
();
$return
=
$aliPay
->
refund
(
$param
);
unset
(
$aliPay
);
$this
->
errorMessage
=
"支付宝返回:"
.
json_encode
(
$return
);
$resultCode
=
$return
->
code
;
if
(
!
empty
(
$resultCode
)
&&
$resultCode
==
ApiConst
::
alipayRefundSuccess
)
{
...
...
@@ -503,13 +510,20 @@ class RefundReturnModel extends \DAO\AbstractModel
return
false
;
}
}
else
if
(
intval
(
$orderInfo
[
'paymentType'
])
==
ApiConst
::
wxProgram
)
{
$wxpay
=
\Payment\WxLitePay
::
getInstance
();
$wxpay
=
new
\Payment\WxLitePay
();
$refund_return
=
$wxpay
->
refund
(
$param
);
unset
(
$wxpay
);
$this
->
errorMessage
=
"微信返回:"
.
json_encode
(
$refund_return
)
.
"
\r\n
"
;
if
(
!
(
$refund_return
[
'return_code'
]
==
'SUCCESS'
&&
$refund_return
[
'result_code'
]
==
'SUCCESS'
))
{
if
(
$refund_return
[
'err_code_des'
]
==
'订单已全额退款'
||
$refund_return
[
'err_code_des'
]
==
'订单已Q68额退款'
){
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
$refund_return
[
'err_code_des'
]
.
$orderInfo
[
'orderId'
]
.
"
\r\n
"
;
return
true
;
}
$this
->
errorMessage
=
date
(
'Y-m-d'
)
.
'微信退款操作执行失败!'
.
$orderInfo
[
'orderId'
]
.
"
\r\n
"
;
return
false
;
}
}
return
true
;
}
...
...
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