问题代码:

if(!Redis::scontains($redisKey, $path)){
                return response()->json([
                    'code' => 99998,
                    'message' => '无操作权限'
                ], 200);
}

if(!Redis::hget($redisKey, 'admin_id')){
                return response()->json([
                     'code' => -1,
                     'message' => '未登录'
                 ], 200);
}

将获取结果放在条件里面做判断报错

解决办法用   try{   }catch(){   }

try{
                $contain = Redis::scontains($redisKey,$path);
            }catch (\Exception $exception){
                $contain = false;
            }
            if(!$contain){
                return response()->json([
                    'code' => 99999,
                    'message' => '无权限操作'
                ],200);
}

try{
            $adminId = Redis::hget($redisKey, 'admin_id');
        }catch (\Exception $e){
            $adminId = 0;
        }

         if(!$adminId){
            return response()->json([
                'code' => -1,
                'message' => '未登录'
            ], 200);
}