perf: 导出报表调整

This commit is contained in:
韦荣超
2022-03-02 15:19:48 +08:00
parent 54d215b8d1
commit 827bc97e8e
5 changed files with 130 additions and 1 deletions

View File

@@ -1732,6 +1732,33 @@ class Base
}
}
/**
* 时间秒数格式化
* @param int $time 时间秒数
* @return string
*/
public static function timeFormat($time)
{
if ($time > 86400) {
$day = floor($time / 86400);
$hour = ceil(($time - ($day * 86400)) / 3600);
if ($hour > 0) {
return $day . '天' . $hour . '小时';
} else {
return $day . '天';
}
} elseif ($time > 3600) {
return ceil($time / 3600) . '小时';
} elseif ($time > 60) {
return ceil($time / 60) . '分钟';
} elseif ($time > 1) {
return '1分钟内';
} else {
return '0秒';
}
}
/**
* 取ip前3段
* @param $ip