mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
update order change process
This commit is contained in:
parent
15cd13c26c
commit
874648a4c0
@ -70,6 +70,9 @@ class CheckOrder extends Command
|
||||
{
|
||||
$plan = Plan::find($order->plan_id);
|
||||
// change plan process
|
||||
if ($order->type === 3) {
|
||||
$user->expired_at = time();
|
||||
}
|
||||
$user->transfer_enable = $plan->transfer_enable * 1073741824;
|
||||
$user->enable = 1;
|
||||
$user->u = 0;
|
||||
|
@ -142,7 +142,11 @@ class OrderController extends Controller
|
||||
if (!(int)config('v2board.plan_change_enable', 1)) abort(500, '目前不允许更改订阅,请联系管理员');
|
||||
$order->type = 3;
|
||||
$order->surplus_amount = $this->getSurplusValue($user);
|
||||
if ($order->surplus_amount >= $order->total_amount) {
|
||||
$order->total_amount = 0;
|
||||
} else {
|
||||
$order->total_amount = $order->total_amount - $order->surplus_amount;
|
||||
}
|
||||
} else if ($user->expired_at > time() && $order->plan_id == $user->plan_id) {
|
||||
$order->type = 2;
|
||||
} else {
|
||||
@ -174,12 +178,6 @@ class OrderController extends Controller
|
||||
// discount complete
|
||||
$order->total_amount = $order->total_amount - $order->discount_amount;
|
||||
// discount end
|
||||
|
||||
// free process
|
||||
if ($order->total_amount <= 0) {
|
||||
$order->total_amount = 0;
|
||||
$order->status = 1;
|
||||
}
|
||||
// invite process
|
||||
if ($user->invite_user_id && $order->total_amount > 0) {
|
||||
$order->invite_user_id = $user->invite_user_id;
|
||||
@ -213,6 +211,13 @@ class OrderController extends Controller
|
||||
if (!$order) {
|
||||
abort(500, '订单不存在或已支付');
|
||||
}
|
||||
// free process
|
||||
if ($order->total_amount <= 0) {
|
||||
$order->total_amount = 0;
|
||||
$order->status = 1;
|
||||
$order->save();
|
||||
exit();
|
||||
}
|
||||
switch ($method) {
|
||||
// return type => 0: QRCode / 1: URL
|
||||
case 0:
|
||||
|
Loading…
Reference in New Issue
Block a user