Fix: Traffic calc bug

This commit is contained in:
Akkariin Meiko 2020-01-19 22:17:37 +08:00 committed by GitHub
parent 9eb8fc37f8
commit 3081816189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}