Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
14078b773181b4aec12fb91e501776e2b9515ef8
1 parent
483b017c
添加更多的支付有关的日志
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
library/WebPlugin/Pay/weixin/PayNotifyCallBack.php
library/WebPlugin/Pay/weixin/lib/WxPayNotify.php
yohobuy/www.yohobuy.com/application/modules/Pay/controllers/Notice.php
library/WebPlugin/Pay/weixin/PayNotifyCallBack.php
View file @
14078b7
...
...
@@ -38,7 +38,13 @@ class PayNotifyCallBack extends WxPayNotify
{
$input
=
new
WxPayOrderQuery
();
$input
->
SetTransaction_id
(
$transaction_id
);
$this
->
log
->
LogInfo
(
'微信扫码支付交易号:'
.
$transaction_id
);
$result
=
WxPayApi
::
orderQuery
(
$input
);
$this
->
log
->
LogInfo
(
'begin PayNotifyCallBack->Queryorder'
);
$this
->
log
->
LogInfo
(
'===开始查询微信扫码订单====='
);
$this
->
log
->
LogInfo
(
var_export
(
$result
,
true
));
if
(
array_key_exists
(
"return_code"
,
$result
)
&&
array_key_exists
(
"result_code"
,
$result
)
&&
$result
[
"return_code"
]
==
"SUCCESS"
&&
$result
[
"result_code"
]
==
"SUCCESS"
)
{
$orderCode
=
substr
(
$result
[
'out_trade_no'
],
self
::
ORDER_CODE_START
);
$payment
=
21
;
// 微信扫码支付
...
...
@@ -84,13 +90,18 @@ class PayNotifyCallBack extends WxPayNotify
//重写回调处理函数
public
function
NotifyProcess
(
$data
,
&
$msg
)
{
$this
->
log
->
LogInfo
(
'begin notifyProcess'
);
$this
->
log
->
LogInfo
(
var_export
(
$data
,
true
));
if
(
!
array_key_exists
(
"transaction_id"
,
$data
))
{
$msg
=
"输入参数不正确"
;
$this
->
log
->
LogInfo
(
'=====微信扫码支付通知结果为:'
.
$msg
.
'====='
);
return
false
;
}
//查询订单,判断订单真实性
if
(
!
$this
->
Queryorder
(
$data
[
"transaction_id"
]))
{
$msg
=
"订单查询失败"
;
$this
->
log
->
LogInfo
(
'=====微信扫码支付通知结果为:'
.
$msg
.
'====='
);
return
false
;
}
...
...
library/WebPlugin/Pay/weixin/lib/WxPayNotify.php
View file @
14078b7
<?php
namespace
WebPlugin\Pay\weixin\lib
;
use
WebPlugin\PhpLog
;
/**
*
...
...
@@ -10,6 +11,10 @@ namespace WebPlugin\Pay\weixin\lib;
*/
class
WxPayNotify
extends
WxPayNotifyReply
{
// 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志
const
ORDER_STATUS_LOG
=
'/Data/logs/pc_pay/order_status'
;
// 日志等级,2表示记录信息等级的日志
const
LOG_LEVEL
=
2
;
/**
*
...
...
@@ -18,15 +23,22 @@ class WxPayNotify extends WxPayNotifyReply
*/
final
public
function
Handle
(
$needSign
=
true
)
{
// 初始化日志
$log
=
new
PhpLog
(
self
::
ORDER_STATUS_LOG
,
'PRC'
,
self
::
LOG_LEVEL
);
$log
->
LogInfo
(
'begin WxPayNotify->Handle'
);
$msg
=
"OK"
;
//当返回false的时候,表示notify中调用NotifyCallBack回调失败获取签名校验失败,此时直接回复失败
$result
=
WxpayApi
::
notify
(
array
(
$this
,
'NotifyCallBack'
),
$msg
);
$log
->
LogInfo
(
var_export
(
$result
,
true
));
if
(
$result
==
false
)
{
$log
->
LogInfo
(
'===微信扫码支付Handle失败==='
);
$this
->
SetReturn_code
(
"FAIL"
);
$this
->
SetReturn_msg
(
$msg
);
$this
->
ReplyNotify
(
false
);
return
;
}
else
{
$log
->
LogInfo
(
'===微信扫码支付Handle成功==='
);
//该分支在成功回调到NotifyCallBack方法,处理完成之后流程
$this
->
SetReturn_code
(
"SUCCESS"
);
$this
->
SetReturn_msg
(
"OK"
);
...
...
yohobuy/www.yohobuy.com/application/modules/Pay/controllers/Notice.php
View file @
14078b7
...
...
@@ -284,6 +284,7 @@ class NoticeController extends WebAction
$uid
=
$this
->
getSession
(
self
::
SESSION_UID_KEY
);
$this
->
setSession
(
self
::
SESSION_UID_KEY
,
null
);
}
$this
->
log
->
LogInfo
(
$uid
);
$notify
=
new
PayNotifyCallBack
(
$uid
);
$notify
->
handle
(
false
);
}
...
...
Please
register
or
login
to post a comment