feat: 更新 Task3 类,增加用户存在性检查以避免空指针异常
This commit is contained in:
parent
058cb8ba47
commit
04ba0d38d0
|
@ -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;
|
||||||
}
|
}
|
||||||
//获取该用户的父级
|
//获取该用户的父级
|
||||||
|
|
Loading…
Reference in New Issue