mirror of
https://github.com/v2board/v2board.git
synced 2024-11-14 07:29:13 +08:00
update: remind mail i18n
This commit is contained in:
parent
982c47d0b4
commit
2d5fb03937
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Services\MailService;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\MailLog;
|
use App\Models\MailLog;
|
||||||
@ -41,23 +42,9 @@ class SendRemindMail extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$users = User::all();
|
$users = User::all();
|
||||||
|
$mailService = new MailService();
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ($user->remind_expire) $this->remindExpire($user);
|
if ($user->remind_expire) $mailService->remindExpire($user);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function remindExpire($user)
|
|
||||||
{
|
|
||||||
if ($user->expired_at !== NULL && ($user->expired_at - 86400) < time() && $user->expired_at > time()) {
|
|
||||||
SendEmailJob::dispatch([
|
|
||||||
'email' => $user->email,
|
|
||||||
'subject' => '在' . config('v2board.app_name', 'V2board') . '的服务即将到期',
|
|
||||||
'template_name' => 'remindExpire',
|
|
||||||
'template_value' => [
|
|
||||||
'name' => config('v2board.app_name', 'V2Board'),
|
|
||||||
'url' => config('v2board.app_url')
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,22 @@ class MailService
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function remindExpire(User $user)
|
||||||
|
{
|
||||||
|
if ($user->expired_at !== NULL && ($user->expired_at - 86400) < time() && $user->expired_at > time()) return;
|
||||||
|
SendEmailJob::dispatch([
|
||||||
|
'email' => $user->email,
|
||||||
|
'subject' => __('The service in :app_name is about to expire', [
|
||||||
|
'app_name' => config('v2board.app_name', 'V2board')
|
||||||
|
]),
|
||||||
|
'template_name' => 'remindExpire',
|
||||||
|
'template_value' => [
|
||||||
|
'name' => config('v2board.app_name', 'V2Board'),
|
||||||
|
'url' => config('v2board.app_url')
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
private function remindTrafficIsWarnValue($u, $d, $transfer_enable)
|
private function remindTrafficIsWarnValue($u, $d, $transfer_enable)
|
||||||
{
|
{
|
||||||
$ud = $u + $d;
|
$ud = $u + $d;
|
||||||
|
@ -83,5 +83,6 @@
|
|||||||
"Email can not be empty": "Email can not be empty",
|
"Email can not be empty": "Email can not be empty",
|
||||||
"Email format is incorrect": "Email format is incorrect",
|
"Email format is incorrect": "Email format is incorrect",
|
||||||
"Password can not be empty": "Password can not be empty",
|
"Password can not be empty": "Password can not be empty",
|
||||||
"The traffic usage in :app_name has reached 80%": "The traffic usage in :app has reached 80%"
|
"The traffic usage in :app_name has reached 80%": "The traffic usage in :app_name has reached 80%",
|
||||||
|
"The service in :app_name is about to expire": "The service in :app_name is about to expire"
|
||||||
}
|
}
|
||||||
|
@ -83,5 +83,6 @@
|
|||||||
"Email can not be empty": "邮箱不能为空",
|
"Email can not be empty": "邮箱不能为空",
|
||||||
"Email format is incorrect": "邮箱格式不正确",
|
"Email format is incorrect": "邮箱格式不正确",
|
||||||
"Password can not be empty": "密码不能为空",
|
"Password can not be empty": "密码不能为空",
|
||||||
"The traffic usage in :app_name has reached 80%": "在:app的流量使用已达到80%"
|
"The traffic usage in :app_name has reached 80%": "在:app_name的流量使用已达到80%",
|
||||||
|
"The service in :app_name is about to expire": "在:app_name的服务即将到期"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user