0) { //查书中的一个段 PDO_Connect(_FILE_DB_RESRES_INDEX_); $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where book='{$book}' and paragraph='{$paragraph}' and type < '5' "; $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); if ($iFetch > 0) { //可用资源 foreach ($Fetch as $one_album) { array_push($res, array("book" => $book, "album_id" => $one_album["album"], "paragraph" => $paragraph, "type" => $one_album["type"], "title" => $one_album["title"], "author" => $one_album["author"], "editor" => $one_album["editor"], "edition" => $one_album["edition"], "language" => $one_album["language"], "level" => $one_album["level"], )); if ($one_album["type"] == 1) { array_push($res, array("book" => $book, "album_id" => UUID(), "paragraph" => $paragraph, "type" => 6, "title" => $one_album["title"], "author" => $one_album["author"], "editor" => $one_album["editor"], "edition" => $one_album["edition"], "language" => $one_album["language"], "level" => $one_album["level"], )); } } } //查共享文档 PDO_Connect(_FILE_DB_FILEINDEX_); $query = "select * from fileindex where book='$book' and paragraph=$paragraph and status>0 and share>0 order by create_time"; $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); if ($iFetch > 0) { foreach ($Fetch as $one_file) { array_push($res, array("type" => "share", "id" => $one_file["id"], "title" => $one_file["title"], "author" => $one_file["user_id"], )); } } //查我的文档 if ($UID != "") { $query = "select * from fileindex where book='$book' and paragraph=$paragraph and status!=0 and user_id='{$UID}' order by create_time DESC"; $Fetch = PDO_FetchAll($query); $iFetch = count($Fetch); if ($iFetch > 0) { foreach ($Fetch as $one_file) { array_push($res, array("type" => "mydoc", "id" => $one_file["id"], "title" => $one_file["title"], "file_name" => $one_file["file_name"], "author" => $one_file["user_id"], )); } } } } echo json_encode($res, JSON_UNESCAPED_UNICODE);