tracker always update torrent

This commit is contained in:
xiaomlove
2022-04-22 13:23:54 +08:00
parent b9190d9f6e
commit f72d5a0f56
+2 -6
View File
@@ -766,10 +766,7 @@ class TrackerRepository extends BaseRepository
*/ */
private function updateTorrent(Torrent $torrent, $queries, bool $isPeerExists) private function updateTorrent(Torrent $torrent, $queries, bool $isPeerExists)
{ {
if (empty($queries['event'])) { if (!empty($queries['event'])) {
do_log("no event, return", 'debug');
return;
}
$torrent->seeders = Peer::query() $torrent->seeders = Peer::query()
->where('torrent', $torrent->id) ->where('torrent', $torrent->id)
->where('to_go', '=',0) ->where('to_go', '=',0)
@@ -779,10 +776,9 @@ class TrackerRepository extends BaseRepository
->where('torrent', $torrent->id) ->where('torrent', $torrent->id)
->where('to_go', '>', 0) ->where('to_go', '>', 0)
->count(); ->count();
}
$torrent->visible = Torrent::VISIBLE_YES; $torrent->visible = Torrent::VISIBLE_YES;
$torrent->last_action = Carbon::now(); $torrent->last_action = Carbon::now();
if ($isPeerExists && $queries['event'] == 'completed') { if ($isPeerExists && $queries['event'] == 'completed') {
$torrent->times_completed = DB::raw("times_completed + 1"); $torrent->times_completed = DB::raw("times_completed + 1");
} }