--- fenglin/bbs/list.php 2025/04/13 01:03:17 1.4 +++ fenglin/bbs/list.php 2025/04/15 01:10:48 1.5 @@ -244,6 +244,8 @@ } } + $author_list = array(); + while ($row = mysqli_fetch_array($rs)) { array_push($result_set["data"]["articles"], array( @@ -269,9 +271,48 @@ "last_reply_nickname" => $row["last_reply_nickname"], "visited" => (($_SESSION["BBS_uid"] > 0 && in_array($row["AID"], $visited_aid_list)) ? 1 : 0), )); + + if (!isset($author_list[$row["UID"]])) + { + $author_list[$row["UID"]] = true; + } + if (!isset($author_list[$row["last_reply_UID"]])) + { + $author_list[$row["last_reply_UID"]] = true; + } } mysqli_free_result($rs); + $uid_list = "-1"; + foreach ($author_list as $uid => $status) + { + $uid_list .= (", " . $uid); + } + unset($author_list); + + $author_list = array(); + + $sql = "SELECT UID FROM user_list WHERE UID IN ($uid_list) AND enable"; + + $rs = mysqli_query($db_conn, $sql); + if ($rs == false) + { + $result_set["return"]["code"] = -2; + $result_set["return"]["message"] = "Query user list error: " . mysqli_error($db_conn); + + mysqli_close($db_conn); + exit(json_encode($result_set)); + } + + while ($row = mysqli_fetch_array($rs)) + { + $author_list[$row["UID"]] = true; + } + mysqli_free_result($rs); + + $result_set["data"]["author_list"] = $author_list; + unset($author_list); + mysqli_close($db_conn); // Cleanup