refactor(ota): 优化文件路径计算逻辑
- 将 root_path() 函数调用替换为 ROOT_PATH 常量 - 提高代码可读性和性能 - 统一路径常量使用方式
This commit is contained in:
@@ -131,7 +131,7 @@ class Ota extends Api
|
||||
*/
|
||||
private function calculateFileInfo($relativePath)
|
||||
{
|
||||
$fullPath = root_path() . 'public' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . ltrim($relativePath, '/');
|
||||
$fullPath = ROOT_PATH . 'public' . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . ltrim($relativePath, '/');
|
||||
if (!file_exists($fullPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user