revert peer count

This commit is contained in:
xiaomlove
2022-04-22 01:32:17 +08:00
parent 686ec2754c
commit b9190d9f6e
7 changed files with 18 additions and 30 deletions
+10 -3
View File
@@ -770,9 +770,16 @@ class TrackerRepository extends BaseRepository
do_log("no event, return", 'debug');
return;
}
$torrentId = $torrent->id;
$torrent->seeders = count_peer("torrent = $torrentId and to_go = 0");
$torrent->leechers = count_peer("torrent = $torrentId and to_go > 0");
$torrent->seeders = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '=',0)
->count();
$torrent->leechers = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '>', 0)
->count();
$torrent->visible = Torrent::VISIBLE_YES;
$torrent->last_action = Carbon::now();