1
0

提交代码

This commit is contained in:
2020-08-06 14:45:56 +08:00
commit 9d0d5f4be9
361 changed files with 36445 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Agent\Controllers;
use App\Events\CardOrderPaid;
use App\Models\CardPayment;
use Illuminate\Http\Request;
class NotifyController extends Controller
{
public function payment(Request $request)
{
$app = app('wechat.payment');
return $app->handlePaidNotify(function ($message, $fail) {
$payment = CardPayment::where('trade_no', $message['out_trade_no'])->first();
$order = $payment->order;
if ($payment->state != 'SUCCESS') {
$payment->state = 'SUCCESS';
$payment->transaction_id = $message['transaction_id'];
$payment->paid_at = $message['time_end'];
$payment->save();
$order->status = 1;
$order->save();
event(new CardOrderPaid($payment));
}
return true;
});
}
}