mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -4,6 +4,7 @@ namespace App\Console\Commands; | ||||
|  | ||||
| use Illuminate\Console\Command; | ||||
| use App\Models\User; | ||||
| use App\Models\MailLog; | ||||
| use App\Jobs\SendEmail; | ||||
|  | ||||
| class SendRemindMail extends Command | ||||
| @@ -60,14 +61,23 @@ class SendRemindMail extends Command | ||||
|     } | ||||
|  | ||||
|     private function remindTraffic ($user) { | ||||
|         function isWarnValue ($ud, $transfer_enable) { | ||||
|             if ($ud <= 0) return false; | ||||
|             if (($ud / $transfer_enable * 100) < 80) return false; | ||||
|             return true; | ||||
|         } | ||||
|         if (isWarnValue(($user->u + $user->d), $user->transfer_enable)) { | ||||
|              | ||||
|         if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) { | ||||
|             if (MailLog::where('created_at', '>=', strtotime(date('Y-m-1'))->count > 0)) return; | ||||
|             SendEmail::dispatch([ | ||||
|                 'email' => $user->email, | ||||
|                 'subject' => '在' . config('v2board.app_name', 'V2board') . '的流量使用已达到80%', | ||||
|                 'template_name' => 'mail.sendRemindTraffic', | ||||
|                 'template_value' => [ | ||||
|                     'name' => config('v2board.app_name', 'V2Board') | ||||
|                 ] | ||||
|             ]); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     private function remindTrafficIsWarnValue ($ud, $transfer_enable) { | ||||
|         if ($ud <= 0) return false; | ||||
|         if (($ud / $transfer_enable * 100) < 80) return false; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
							
								
								
									
										135
									
								
								resources/views/mail/sendRemindTraffic.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								resources/views/mail/sendRemindTraffic.blade.php
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user