jh-admin/addon/supply/event/SupplyRechargePayNotify.php

40 lines
1.4 KiB
PHP

<?php
namespace addon\supply\event;
use think\facade\Cache;
use think\facade\Db;
class SupplyRechargePayNotify
{
public function handle($param)
{
$payInfo = $param['payInfo'] ?? '';
if ($payInfo && $payInfo['event'] == 'SupplyRechargePayNotify') {
$pay_detail = explode('_', $payInfo['pay_detail']);
$site_id = $pay_detail[0];
$uid = $pay_detail[1];
$id = $pay_detail[1];
$condition = [
'id' => $id
];
$order_status = Db::name('supply_order')->where(['out_trade_no' => $payInfo['out_trade_no']])->value('order_status');
if (!$order_status) {
model('supply_app')->setInc($condition, 'usable_price', $payInfo['pay_money']);
Db::name('supply_order')->where(['out_trade_no' => $payInfo['out_trade_no']])->update(['order_status' => 4, 'pay_status' => 1]);
$log = array(
"uid" => $uid,
"username" => $site_id,
"site_id" => $site_id,
"url" => '',
"ip" => '',
"data" => '',
"action_name" => '货款预存' . $payInfo['pay_money'] . '元',
"create_time" => time(),
);
model("user_log")->add($log);
}
}
}
}