feat: 更新 Task3 类,增加用户存在性检查以避免空指针异常

This commit is contained in:
lingling 2025-03-08 20:46:08 +08:00
parent 058cb8ba47
commit 04ba0d38d0
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,7 @@ class Task3
$user_id = $value->user_id; $user_id = $value->user_id;
//判定有没有父级 这里父级没有默认是0 //判定有没有父级 这里父级没有默认是0
$user = User::find($user_id); $user = User::find($user_id);
if ($user->f_id==0) { if (!empty($user)&&$user->f_id==0) {
continue; continue;
} }
//获取该用户的父级 //获取该用户的父级