mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 01:11:46 +08:00 
			
		
		
		
	update: fix reset traffic
This commit is contained in:
		| @@ -44,18 +44,27 @@ class ResetTraffic extends Command | ||||
|     public function handle() | ||||
|     { | ||||
|         ini_set('memory_limit', -1); | ||||
|         foreach (Plan::get() as $plan) { | ||||
|             switch ($plan->reset_traffic_method) { | ||||
|         $resetMethods = Plan::select( | ||||
|             DB::raw("GROUP_CONCAT(`id`) as plan_ids"), | ||||
|             DB::raw("reset_traffic_method as method") | ||||
|         ) | ||||
|             ->groupBy('reset_traffic_method') | ||||
|             ->get() | ||||
|             ->toArray(); | ||||
|         foreach ($resetMethods as $resetMethod) { | ||||
|             $planIds = explode(',', $resetMethod['plan_ids']); | ||||
|             switch ($resetMethod['method']) { | ||||
|                 case null: { | ||||
|                     $resetTrafficMethod = config('v2board.reset_traffic_method', 0); | ||||
|                     $builder = with(clone($this->builder))->whereIn('plan_id', $planIds); | ||||
|                     switch ((int)$resetTrafficMethod) { | ||||
|                         // month first day | ||||
|                         case 0: | ||||
|                             $this->resetByMonthFirstDay($this->builder); | ||||
|                             $this->resetByMonthFirstDay($builder); | ||||
|                             break; | ||||
|                         // expire day | ||||
|                         case 1: | ||||
|                             $this->resetByExpireDay($this->builder); | ||||
|                             $this->resetByExpireDay($builder); | ||||
|                             break; | ||||
|                         // no action | ||||
|                         case 2: | ||||
| @@ -64,12 +73,12 @@ class ResetTraffic extends Command | ||||
|                     break; | ||||
|                 } | ||||
|                 case 0: { | ||||
|                     $builder = with(clone($this->builder))->where('plan_id', $plan->id); | ||||
|                     $builder = with(clone($this->builder))->whereIn('plan_id', $planIds); | ||||
|                     $this->resetByMonthFirstDay($builder); | ||||
|                     break; | ||||
|                 } | ||||
|                 case 1: { | ||||
|                     $builder = with(clone($this->builder))->where('plan_id', $plan->id); | ||||
|                     $builder = with(clone($this->builder))->whereIn('plan_id', $planIds); | ||||
|                     $this->resetByExpireDay($builder); | ||||
|                     break; | ||||
|                 } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user