From a33394c2aa6f24783c02470bec397d550860c28b Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 21 Apr 2022 17:09:48 +0800 Subject: [PATCH] calculate bonus group by torrent_id and peer_id --- app/Repositories/TrackerRepository.php | 2 +- include/functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Repositories/TrackerRepository.php b/app/Repositories/TrackerRepository.php index 1230f4f1..bdb9f439 100644 --- a/app/Repositories/TrackerRepository.php +++ b/app/Repositories/TrackerRepository.php @@ -704,7 +704,7 @@ class TrackerRepository extends BaseRepository 'downloaded_increment' => $realDownloaded, 'downloaded_increment_for_user' => $realDownloaded * $downRatio, ]; - do_log("$log, result: " . json_encode($result)); + do_log("$log, result: " . json_encode($result), 'alert'); return $result; } diff --git a/include/functions.php b/include/functions.php index 9538a05a..0ddb270b 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5530,7 +5530,7 @@ function calculate_seed_bonus($uid): array $A = 0; $count = $torrent_count = 0; - $torrentres = sql_query("select torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' group by torrents.id"); + $torrentres = sql_query("select torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = $uid AND peers.seeder ='yes' group by torrents.id, peers.peer_id"); while ($torrent = mysql_fetch_array($torrentres)) { $weeks_alive = ($timenow - strtotime($torrent['added'])) / $sectoweek;