diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index b2519ea..c58e033 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -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.'); }); }