mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-01 16:00:53 -05:00
(Update) UserController
Remove up/download. Fix seedtime sum.
This commit is contained in:
@@ -1384,7 +1384,7 @@ class UserController extends Controller
|
||||
if ($request->has('view') && $request->input('view') == 'seeds') {
|
||||
$history = Peer::with(['torrent' => function ($query) {
|
||||
$query->withAnyStatus();
|
||||
}])->selectRaw('distinct(torrents.info_hash),max(peers.id) as id,max(torrents.name) as name,max(torrents.seeders) as seeders,max(torrents.leechers) as leechers,max(torrents.times_completed) as times_completed,max(torrents.size) as size,sum(peers.uploaded) as uploaded,sum(peers.downloaded) as downloaded,sum(history.seedtime) as seedtime,max(history.info_hash) as history_info_hash,max(history.created_at) as history_created_at,max(torrents.id) as torrent_id')->leftJoin('torrents', 'torrents.id', '=', 'peers.torrent_id')->leftJoin('history', 'history.info_hash', '=', 'torrents.info_hash')->where('peers.user_id', '=', $user->id)->where('history.seeder', '=', 1)
|
||||
}])->selectRaw('distinct(torrents.info_hash),max(peers.id) as id,max(torrents.name) as name,max(torrents.seeders) as seeders,max(torrents.leechers) as leechers,max(torrents.times_completed) as times_completed,max(torrents.size) as size,max(history.info_hash) as history_info_hash,max(history.created_at) as history_created_at,max(torrents.id) as torrent_id,max(ht.seed_total) as seedtime')->leftJoin('torrents', 'torrents.id', '=', 'peers.torrent_id')->leftJoin('history', 'history.info_hash', '=', 'torrents.info_hash')->leftJoin(DB::raw('(select distinct(history.info_hash),sum(history.seedtime) as seed_total from history group by history.info_hash) as ht'), 'ht.info_hash', '=', 'torrents.info_hash')->where('peers.user_id', '=', $user->id)->where('history.seeder', '=', 1)
|
||||
->where('peers.seeder', '=', 1)->groupBy('torrents.info_hash');
|
||||
|
||||
$order = null;
|
||||
@@ -2038,7 +2038,7 @@ class UserController extends Controller
|
||||
|
||||
$seeds = Peer::with(['torrent' => function ($query) {
|
||||
$query->withAnyStatus();
|
||||
}])->selectRaw('distinct(torrents.info_hash),max(peers.id) as id,max(torrents.name) as name,max(torrents.seeders) as seeders,max(torrents.leechers) as leechers,max(torrents.times_completed) as times_completed,max(torrents.size) as size,sum(peers.uploaded) as uploaded,sum(peers.downloaded) as downloaded,sum(history.seedtime) as seedtime,max(history.info_hash) as history_info_hash,max(history.created_at) as history_created_at,max(torrents.id) as torrent_id')->leftJoin('torrents', 'torrents.id', '=', 'peers.torrent_id')->leftJoin('history', 'history.info_hash', '=', 'torrents.info_hash')->where('peers.user_id', '=', $user->id)->where('history.seeder', '=', 1)
|
||||
}])->selectRaw('distinct(torrents.info_hash),max(peers.id) as id,max(torrents.name) as name,max(torrents.seeders) as seeders,max(torrents.leechers) as leechers,max(torrents.times_completed) as times_completed,max(torrents.size) as size,max(history.info_hash) as history_info_hash,max(history.created_at) as history_created_at,max(torrents.id) as torrent_id,max(ht.seed_total) as seedtime')->leftJoin('torrents', 'torrents.id', '=', 'peers.torrent_id')->leftJoin('history', 'history.info_hash', '=', 'torrents.info_hash')->leftJoin(DB::raw('(select distinct(history.info_hash),sum(history.seedtime) as seed_total from history group by history.info_hash) as ht'), 'ht.info_hash', '=', 'torrents.info_hash')->where('peers.user_id', '=', $user->id)->where('history.seeder', '=', 1)
|
||||
->where('peers.seeder', '=', 1)->orderBy('history_created_at', 'DESC')->groupBy('torrents.info_hash')
|
||||
->paginate(50);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user