mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update: package limit
This commit is contained in:
		| @@ -85,7 +85,7 @@ class OrderController extends Controller | ||||
|             abort(500, __('Subscription plan does not exist')); | ||||
|         } | ||||
|  | ||||
|         if (!$planService->haveCapacity()) { | ||||
|         if (!$planService->haveCapacity() && $request->input('period') !== 'reset_price') { | ||||
|             abort(500, __('Current product is sold out')); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -18,7 +18,8 @@ class PlanService | ||||
|     public function haveCapacity(): bool | ||||
|     { | ||||
|         if ($this->plan->capacity_limit === NULL) return true; | ||||
|         $count = User::where('plan_id', $this->plan->plan_id)->count(); | ||||
|         $count = self::countActiveUsers(); | ||||
|         $count = $count[$this->plan->plan_id]; | ||||
|         return ($this->plan->capacity_limit - $count) > 0; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -55,7 +55,6 @@ class UserService | ||||
|     { | ||||
|         if ($user->expired_at <= time() || $user->expired_at === NULL) return null; | ||||
|         // if reset method is not reset | ||||
|         if (!isset($user->plan->reset_traffic_method)) return null; | ||||
|         if ($user->plan->reset_traffic_method === 2) return null; | ||||
|         switch (true) { | ||||
|             case ($user->plan->reset_traffic_method === NULL): { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user