mirror of
https://github.com/v2board/v2board.git
synced 2025-01-26 16:09:09 +08:00
update
This commit is contained in:
parent
17e626493a
commit
7965a020b6
@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\MailLog;
|
||||||
use App\Jobs\SendEmail;
|
use App\Jobs\SendEmail;
|
||||||
|
|
||||||
class SendRemindMail extends Command
|
class SendRemindMail extends Command
|
||||||
@ -60,14 +61,23 @@ class SendRemindMail extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function remindTraffic ($user) {
|
private function remindTraffic ($user) {
|
||||||
function isWarnValue ($ud, $transfer_enable) {
|
if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) {
|
||||||
if ($ud <= 0) return false;
|
if (MailLog::where('created_at', '>=', strtotime(date('Y-m-1'))->count > 0)) return;
|
||||||
if (($ud / $transfer_enable * 100) < 80) return false;
|
SendEmail::dispatch([
|
||||||
return true;
|
'email' => $user->email,
|
||||||
}
|
'subject' => '在' . config('v2board.app_name', 'V2board') . '的流量使用已达到80%',
|
||||||
if (isWarnValue(($user->u + $user->d), $user->transfer_enable)) {
|
'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
Loading…
Reference in New Issue
Block a user