支付结果通知

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() 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(); $order = Payment::where('trade_no', $message['out_trade_no'])->find();
if (! $order || $order->paid_at) { if (! $order || $order->paid_at) {
@@ -163,10 +164,9 @@ class Wechat
$zhuLi = env("ZHULI_VALUE") ?? 150; $zhuLi = env("ZHULI_VALUE") ?? 150;
Db::name("student")->inc("hot", $zhuLi)->where("id", $order_detail->id)->update(); 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(); Db::name("student")->inc("hot_count", 1)->where("id", $order_detail->id)->update();
return true;
} else {
$fail('Order not exists.');
} }
return $fail('Order not exists.');
}); });
} }