知识付费支付宝支付订单状态过滤问题
修改文件:extend\service\AlipayTradeWapService
修改方法:AliPayNotify()
protected function AliPayNotify(callable $notifyFn)
{
$post = Request::instance()->post();
//卡劵红包类
$voucher_detail_list = Request::instance()->param('voucher_detail_list');
if ($voucher_detail_list) {
$post['voucher_detail_list'] = $voucher_detail_list;
}
$result = self::AliPaycheck($post);
if ($result) {
//商户订单号
$post['out_trade_no'] = isset($post['out_trade_no']) ? $post['out_trade_no'] : '';
//支付宝交易号
$post['trade_no'] = isset($post['trade_no']) ? $post['trade_no'] : '';
//交易状态
$post['trade_status'] = isset($post['trade_status']) ? $post['trade_status'] : '';
//备注
$post['attach'] = isset($post['passback_params']) ? urldecode($post['passback_params']) : '';
if(in_array($post['trade_status'], ['TRADE_SUCCESS', 'TRADE_FINISHED'])) {
//异步回调成功执行
try {
if (is_callable($notifyFn)) $notifyFn((object)$post, $result);
} catch (\Exception $e) {
self::$isDeBug && self::WriteLog('支付宝支付成功,订单号为:' . $post['out_trade_no'] . '.回调报错:' . $e->getMessage());
}
echo 'success';
} else {
echo 'fail';
}
} else {
echo 'fail';
}
self::$isDeBug && self::WriteLog($result);
return true;
}