update: fix order update

This commit is contained in:
tokumeikoi 2021-08-25 18:06:08 +09:00
parent 3600c9a166
commit b26a3e0e70
2 changed files with 5 additions and 2 deletions

View File

@ -83,6 +83,7 @@ class OrderController extends Controller
if (!$orderService->success(time())) {
abort(500, '更新失败');
}
break;
}
case 2: {
if (!$orderService->cancel()) {

View File

@ -12,7 +12,8 @@ class MailService
public function remindTraffic (User $user)
{
if (!$user->remind_traffic) return;
if (!$this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) return;
$trafficTotal = $user->u + $user->d;
if (!$this->remindTrafficIsWarnValue($user->u, $user->d, $user->transfer_enable)) return;
$flag = CacheKey::get('LAST_SEND_EMAIL_REMIND_TRAFFIC', $user->id);
if (Cache::get($flag)) return;
if (!Cache::put($flag, 1, 24 * 3600)) return;
@ -27,8 +28,9 @@ class MailService
]);
}
private function remindTrafficIsWarnValue($ud, $transfer_enable)
private function remindTrafficIsWarnValue($u, $d, $transfer_enable)
{
$ud = $u + $d;
if (!$ud) return false;
if (!$transfer_enable) return false;
$percentage = ($ud / $transfer_enable) * 100;