whereIn('id', $arr)->get(); if ($res){ return $res->toArray(); }else{ return []; } } public static function getNodeById($id) { if (empty($id) || !is_numeric($id)) { throw new \Exception('参数有误', ERROR_CODE_PARAM_INVALID); } $res = self::where('id', $id)->first(); if (!$res){ return []; } return $res->toArray(); } }