From 308181618962d05aa6c7fa8003a1586afd968a89 Mon Sep 17 00:00:00 2001 From: Akkariin Meiko Date: Sun, 19 Jan 2020 22:17:37 +0800 Subject: [PATCH] Fix: Traffic calc bug --- daemon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.php b/daemon.php index 75f5301..edf3ab4 100644 --- a/daemon.php +++ b/daemon.php @@ -101,7 +101,7 @@ function updateTraffic($conn, $user, $traffic) { mysqli_query($conn, "UPDATE `proxies` SET `status`='0' WHERE `username`='{$user}' AND `status`='2'"); } else { // 数据库里的当日流量大于统计得到的流量,说明这一天已经过完了,将新的流量计入数据库 - $newTraffic = $userTraffic - $traffic; + $newTraffic = round(($userTraffic - $traffic) / 1024 / 1024, 2); if($newTraffic < 0) { $newTraffic = 0; }