diff --git a/include/functions.php b/include/functions.php index fd76112f..e3fee399 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5588,14 +5588,15 @@ function calculate_seed_bonus($uid, $torrentIdArr = null): array $A = 0; $count = $torrent_peer_count = 0; $logPrefix = "[CALCULATE_SEED_BONUS], uid: $uid, torrentIdArr: " . json_encode($torrentIdArr); - $whereTorrent = ''; if ($torrentIdArr !== null) { if (empty($torrentIdArr)) { $torrentIdArr = [-1]; } - $whereTorrent = sprintf("and peers.torrent in (%s)", implode(',', $torrentIdArr)); + $idStr = implode(',', \Illuminate\Support\Arr::wrap($torrentIdArr)); + $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, 'NO_PEER_ID' as peerID from torrents WHERE id in ($idStr)"; + } else { + $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' group by peers.torrent, peers.peer_id"; } - $sql = "select torrents.id, torrents.added, torrents.size, torrents.seeders, peers.id as peerID from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' $whereTorrent group by peers.torrent, peers.peer_id"; $torrentResult = \Nexus\Database\NexusDB::select($sql); do_log("$logPrefix, sql: $sql, count: " . count($torrentResult)); foreach ($torrentResult as $torrent) diff --git a/public/complains.php b/public/complains.php index a4a31590..bf598c2f 100644 --- a/public/complains.php +++ b/public/complains.php @@ -134,7 +134,7 @@ if($_SERVER['REQUEST_METHOD'] === 'POST'){ - +