36 lines
1.6 KiB
PHP
36 lines
1.6 KiB
PHP
<?php
|
|
namespace addon\alipay\event;
|
|
use addon\dividemoney\model\OrderPay;
|
|
use app\model\system\Pay as PayCommon;
|
|
class ZmPay
|
|
{
|
|
public function handle($param)
|
|
{
|
|
$msg_method = $param['msg_method'] ?? '';
|
|
if ($msg_method) {
|
|
$biz_content = $param['biz_content'];
|
|
switch ($msg_method) {
|
|
case 'zhima.credit.payafteruse.creditbizorder.changed': //芝麻订单变化通知
|
|
$order_status = $biz_content['order_status'];
|
|
if ($order_status == 'INIT') { //订单签约
|
|
$pay = new PayCommon();
|
|
$out_trade_no = $biz_content['out_order_no'];
|
|
$pay_info = $pay->getPayInfo($out_trade_no);
|
|
$pay_info = $pay_info['data'];
|
|
$trade_no = $biz_content['trade_no'];
|
|
if (!empty($pay_info)) {
|
|
$pay_common = new PayCommon();
|
|
$pay_common->onlinePay($out_trade_no, "zmxxpay", $trade_no, "alipay");
|
|
}
|
|
} else if ($order_status == 'TRADE_CLOSED') {//订单取消
|
|
|
|
} else if ($order_status == 'TRADE_FINISHED') {//扣款成功 发起分账
|
|
$biz_content['out_order_id'] = $biz_content['out_order_no'];
|
|
model('order')->update(['is_deduction' => 1], ['out_trade_no' => $biz_content['out_order_no'], 'pay_type' => 'zmxxpay'])
|
|
(new OrderPay())->aliSettleSplitAccount($biz_content);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |