mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -7,6 +7,7 @@ use App\Http\Controllers\Controller; | |||||||
| use App\Models\Order; | use App\Models\Order; | ||||||
| use Omnipay\Omnipay; | use Omnipay\Omnipay; | ||||||
| use Illuminate\Support\Facades\Log; | use Illuminate\Support\Facades\Log; | ||||||
|  | use Illuminate\Support\Facades\Redis; | ||||||
|  |  | ||||||
| class OrderController extends Controller | class OrderController extends Controller | ||||||
| { | { | ||||||
| @@ -70,9 +71,13 @@ class OrderController extends Controller | |||||||
|  |  | ||||||
|         $obj = $event->data->object; |         $obj = $event->data->object; | ||||||
|         if ($obj['status'] == 'chargeable') { |         if ($obj['status'] == 'chargeable') { | ||||||
|             $order = Order::where('callback_no', $obj['id'])->first(); |             $trade_no = Redis::get($obj['id']); | ||||||
|  |             if (!$trade_no) { | ||||||
|  |                 abort(500, 'redis is not found trade no by stripe source id.'); | ||||||
|  |             } | ||||||
|  |             $order = Order::where('trade_no', $trade_no)->first(); | ||||||
|             if (!$order) { |             if (!$order) { | ||||||
|                 abort(500, 'fail'); |                 abort(500, 'order is not found'); | ||||||
|             } |             } | ||||||
|             if ($order->status !== 0) { |             if ($order->status !== 0) { | ||||||
|                 die('order is paid'); |                 die('order is paid'); | ||||||
| @@ -81,6 +86,7 @@ class OrderController extends Controller | |||||||
|             if (!$order->save()) { |             if (!$order->save()) { | ||||||
|                 abort(500, 'fail'); |                 abort(500, 'fail'); | ||||||
|             } |             } | ||||||
|  |             Redis::del($obj['id']); | ||||||
|             die('success'); |             die('success'); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers; | |||||||
| use App\Http\Requests\OrderSave; | use App\Http\Requests\OrderSave; | ||||||
| use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||||
| use App\Http\Controllers\Controller; | use App\Http\Controllers\Controller; | ||||||
|  | use Illuminate\Support\Facades\Redis; | ||||||
| use App\Models\Order; | use App\Models\Order; | ||||||
| use App\Models\Plan; | use App\Models\Plan; | ||||||
| use App\Models\User; | use App\Models\User; | ||||||
| @@ -230,6 +231,9 @@ class OrderController extends Controller | |||||||
|         if (!$source['redirect']['url']) { |         if (!$source['redirect']['url']) { | ||||||
|             abort(500, '支付网关请求失败'); |             abort(500, '支付网关请求失败'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         Redis::set($source['id'], $order->trade_no); | ||||||
|  |         Redis::expire($source['id'], 3600); | ||||||
|         $order->callback_no = $source['id']; |         $order->callback_no = $source['id']; | ||||||
|         if (!$order->save()) { |         if (!$order->save()) { | ||||||
|             abort(500, '订单更新失败'); |             abort(500, '订单更新失败'); | ||||||
| @@ -254,6 +258,9 @@ class OrderController extends Controller | |||||||
|         if (!$source['wechat']['qr_code_url']) { |         if (!$source['wechat']['qr_code_url']) { | ||||||
|             abort(500, '支付网关请求失败'); |             abort(500, '支付网关请求失败'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         Redis::set($source['id'], $order->trade_no); | ||||||
|  |         Redis::expire($source['id'], 3600); | ||||||
|         $order->callback_no = $source['id']; |         $order->callback_no = $source['id']; | ||||||
|         if (!$order->save()) { |         if (!$order->save()) { | ||||||
|             abort(500, '订单更新失败'); |             abort(500, '订单更新失败'); | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								public/p__dashboard.async.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								public/p__dashboard.async.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								public/p__subscribe.async.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								public/p__subscribe.async.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user