1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Modules\Trade\Pay;
- use App\Modules\Product\Services\ProductService;
- use App\Modules\Subscribe\Services\OrderService;
- /**
- *
- */
- class OrderPaySuccess
- {
- /**
- * 支付成功回调处理订单
- * @param string $trade_no 订单号
- * @param string $transaction_id 微信商户号
- * @return bool
- */
- public static function handle(string $trade_no, string $transaction_id)
- {
- $order = OrderService::getByTradeNo($trade_no);
- $order->transaction_id = $transaction_id;
- if ($order) {
- if ($order->status == 'PAID') {
- myLog('pay_notify')->info('has_pay:' . $trade_no);
- return true;
- }
- $product = ProductService::getProductSingle($order->product_id);
- if ($product->type == 'YEAR_ORDER') {
- $app = new YearOrderPaySuccess($order);
- } elseif ($product->type == 'BOOK_ORDER') {
- $app = new BookOrderPaySuccess($order);
- } elseif ($product->type == 'TICKET_RECHARGE') {
- $app = new RechargeOrderPaySuccess($order, $product);
- }
- return $app->success();
- } else {
- return false;
- }
- }
- }
|