fix:后台首页数据百分比计算bug修复

This commit is contained in:
xjh 2023-05-12 09:42:37 +08:00
parent 0b15640215
commit 86053de7e8

View File

@ -106,7 +106,9 @@ class Home
}; };
//上升百分比计算 //上升百分比计算
$percentage = round((($today_total_count - $yesterday_total_count) / $yesterday_total_count) * 100, 2); $dividend = ($today_total_count - $yesterday_total_count);
$divisor = $yesterday_total_count == 0 ? 1 : $yesterday_total_count;
$percentage = round(($dividend / $divisor) * 100, 2);
return [ return [
'count' => $today_total_count, 'count' => $today_total_count,