mirror of
https://github.com/v2board/v2board.git
synced 2025-06-13 21:28:27 +08:00
update: logic optimization
This commit is contained in:
@ -78,6 +78,16 @@ class OrderController extends Controller
|
||||
abort(500, __('Subscription plan does not exist'));
|
||||
}
|
||||
|
||||
if ($plan[$request->input('period')] === NULL) {
|
||||
abort(500, __('This payment period cannot be purchased, please choose another period'));
|
||||
}
|
||||
|
||||
if ($request->input('period') === 'reset_price') {
|
||||
if ($user->expired_at <= time() || !$user->plan_id) {
|
||||
abort(500, __('Subscription has expired or no active subscription, unable to purchase Data Reset Package'));
|
||||
}
|
||||
}
|
||||
|
||||
if ((!$plan->show && !$plan->renew) || (!$plan->show && $user->plan_id !== $plan->id)) {
|
||||
if ($request->input('period') !== 'reset_price') {
|
||||
abort(500, __('This subscription has been sold out, please choose another subscription'));
|
||||
@ -88,15 +98,6 @@ class OrderController extends Controller
|
||||
abort(500, __('This subscription cannot be renewed, please change to another subscription'));
|
||||
}
|
||||
|
||||
if ($plan[$request->input('period')] === NULL) {
|
||||
abort(500, __('This payment period cannot be purchased, please choose another period'));
|
||||
}
|
||||
|
||||
if ($request->input('period') === 'reset_price') {
|
||||
if ($user->expired_at <= time() || !$user->plan_id) {
|
||||
abort(500, __('Subscription has expired or no active subscription, unable to purchase Data Reset Package'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$plan->show && $plan->renew && !$userService->isAvailable($user)) {
|
||||
abort(500, __('This subscription has expired, please change to another subscription'));
|
||||
|
Reference in New Issue
Block a user