123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Modules\Trade\Pay;
- use App\Modules\Subscribe\Models\Order;
- /**
- *
- */
- class OrderPaySuccess
- {
- /**
- * 支付成功回调处理订单
- * @param string $trade_no 订单号
- * @param string $transaction_id 微信商户号
- * @return bool
- */
- public static function handle(string $trade_no, string $transaction_id)
- {
- $order = Order::where('trade_no', $trade_no)->first();
- $order->transaction_id = $transaction_id;
- if ($order) {
- if ($order->status == 'PAID') {
- myLog('pay_notify')->info('has_pay:' . $trade_no);
- return true;
- }
- if ($order->order_type == 'YEAR') {
- $app = new YearOrderPaySuccess($order);
- } elseif ($order->order_type == 'BOOK') {
- $app = new BookOrderPaySuccess($order);
- } elseif ($order->order_type == 'RECHARGE') {
- $app = new RechargeOrderPaySuccess($order);
- }
- return $app->success();
- } else {
- return false;
- }
- }
- }
|