mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
tracker always update torrent
This commit is contained in:
@@ -766,23 +766,19 @@ class TrackerRepository extends BaseRepository
|
||||
*/
|
||||
private function updateTorrent(Torrent $torrent, $queries, bool $isPeerExists)
|
||||
{
|
||||
if (empty($queries['event'])) {
|
||||
do_log("no event, return", 'debug');
|
||||
return;
|
||||
if (!empty($queries['event'])) {
|
||||
$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->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();
|
||||
|
||||
if ($isPeerExists && $queries['event'] == 'completed') {
|
||||
$torrent->times_completed = DB::raw("times_completed + 1");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user