From 50d911b9f826701165887ba0acd4edb92d1aa2e7 Mon Sep 17 00:00:00 2001 From: daiyangcheng <48477757+Daiyangcheng@users.noreply.github.com> Date: Wed, 17 Jan 2024 01:27:40 +0800 Subject: [PATCH] Fix mathematical logic errors in traffic updates traffic's unit is "B" but userTraffic's unit is "MB" they can't minus when traffic's unit is "B" so we nned to change this line to ensure the unity of units --- daemon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.php b/daemon.php index edf3ab4..555b006 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 = round(($userTraffic - $traffic) / 1024 / 1024, 2); + $newTraffic = round(($userTraffic - $traffic / 1024 / 1024), 2); if($newTraffic < 0) { $newTraffic = 0; }