支付结果通知

This commit is contained in:
2022-09-15 16:57:56 +08:00
parent 126e5cfe2f
commit d97b1542dc

View File

@@ -144,9 +144,10 @@ class Wechat
*/
public function paid()
{
$this->initWechat();
$config = Config::get('wechat.payment');
$payment = Factory::payment($config);
return $this->app->handlePaidNotify(function ($message, $fail) {
return $payment->handlePaidNotify(function ($message, $fail) {
$order = Payment::where('trade_no', $message['out_trade_no'])->find();
if (! $order || $order->paid_at) {
@@ -163,10 +164,9 @@ class Wechat
$zhuLi = env("ZHULI_VALUE") ?? 150;
Db::name("student")->inc("hot", $zhuLi)->where("id", $order_detail->id)->update();
Db::name("student")->inc("hot_count", 1)->where("id", $order_detail->id)->update();
} else {
$fail('Order not exists.');
return true;
}
return $fail('Order not exists.');
});
}