mirror of
https://github.com/v2board/v2board.git
synced 2025-07-31 20:39:36 +08:00
update: rewrite buy limit
This commit is contained in:
@ -85,7 +85,7 @@ class OrderController extends Controller
|
||||
abort(500, __('Subscription plan does not exist'));
|
||||
}
|
||||
|
||||
if ($plan->inventory_limit !== NULL && !$plan->inventory_limit) {
|
||||
if (!$planService->haveCapacity()) {
|
||||
abort(500, __('Current product is sold out'));
|
||||
}
|
||||
|
||||
@ -160,10 +160,6 @@ class OrderController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (!$planService->decrementInventory()) {
|
||||
abort(500, __('Failed to create order'));
|
||||
}
|
||||
|
||||
if (!$order->save()) {
|
||||
DB::rollback();
|
||||
abort(500, __('Failed to create order'));
|
||||
|
Reference in New Issue
Block a user