From 93c90ddaf04014d8019968f923223fd9b3f2e53e Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Sat, 7 Nov 2020 16:04:42 +0800 Subject: [PATCH] fix: bug --- app/Services/MailService.php | 2 +- app/Services/UserService.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Services/MailService.php b/app/Services/MailService.php index 4aa7e55f..195622b1 100644 --- a/app/Services/MailService.php +++ b/app/Services/MailService.php @@ -29,7 +29,7 @@ class MailService private function remindTrafficIsWarnValue($ud, $transfer_enable) { - if ($ud <= 0) return false; + if (!$ud) return false; if (!$transfer_enable) return false; $percentage = ($ud / $transfer_enable) * 100; if ($percentage < 80) return false; diff --git a/app/Services/UserService.php b/app/Services/UserService.php index e3a53864..ef3e7c3d 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -88,8 +88,12 @@ class UserService if (!$user->save()) { return false; } - $mailService = new MailService(); - $mailService->remindTraffic($user); + try { + $mailService = new MailService(); + $mailService->remindTraffic($user); + } catch (\Exception $e) { + return true; + } return true; } }