From 1f9cec1729ac0fa3ee3462741f1a5a673fdf78d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 13 Apr 2017 19:09:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E6=B5=8B=E8=AF=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Notify.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/application/wechat/controller/Notify.php b/application/wechat/controller/Notify.php index 25e9330a8..f5aa368d8 100644 --- a/application/wechat/controller/Notify.php +++ b/application/wechat/controller/Notify.php @@ -26,7 +26,26 @@ use think\Controller; class Notify extends Controller { public function index() { + // 实例支付接口 + $pay = &load_wechat('Pay'); + // 获取支付通知 + $notifyInfo = $pay->getNotify(); + p($notifyInfo); + + // 支付通知数据获取失败 + if ($notifyInfo === FALSE) { + // 接口失败的处理 + echo $pay->errMsg; + } else { + //支付通知数据获取成功 + if ($notifyInfo['result_code'] == 'SUCCESS' && $notifyInfo['return_code'] == 'SUCCESS') { + // 支付状态完全成功,可以更新订单的支付状态了 + // @todo 这里去完成你的订单状态修改操作 + // 回复xml,replyXml方法是终态方法 + $pay->replyXml(['return_code' => 'SUCCESS', 'return_msg' => 'DEAL WITH SUCCESS']); + } + } } }