mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
621658ba84
commit
be37bcb3bf
@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Models\Order;
|
||||
use Omnipay\Omnipay;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
@ -70,9 +71,13 @@ class OrderController extends Controller
|
||||
|
||||
$obj = $event->data->object;
|
||||
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) {
|
||||
abort(500, 'fail');
|
||||
abort(500, 'order is not found');
|
||||
}
|
||||
if ($order->status !== 0) {
|
||||
die('order is paid');
|
||||
@ -81,6 +86,7 @@ class OrderController extends Controller
|
||||
if (!$order->save()) {
|
||||
abort(500, 'fail');
|
||||
}
|
||||
Redis::del($obj['id']);
|
||||
die('success');
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Http\Requests\OrderSave;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use App\Models\Order;
|
||||
use App\Models\Plan;
|
||||
use App\Models\User;
|
||||
@ -230,6 +231,9 @@ class OrderController extends Controller
|
||||
if (!$source['redirect']['url']) {
|
||||
abort(500, '支付网关请求失败');
|
||||
}
|
||||
|
||||
Redis::set($source['id'], $order->trade_no);
|
||||
Redis::expire($source['id'], 3600);
|
||||
$order->callback_no = $source['id'];
|
||||
if (!$order->save()) {
|
||||
abort(500, '订单更新失败');
|
||||
@ -254,6 +258,9 @@ class OrderController extends Controller
|
||||
if (!$source['wechat']['qr_code_url']) {
|
||||
abort(500, '支付网关请求失败');
|
||||
}
|
||||
|
||||
Redis::set($source['id'], $order->trade_no);
|
||||
Redis::expire($source['id'], 3600);
|
||||
$order->callback_no = $source['id'];
|
||||
if (!$order->save()) {
|
||||
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
Loading…
Reference in New Issue
Block a user