mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 04:20:49 +08:00
[api] torrents list exclude special
This commit is contained in:
@@ -21,6 +21,7 @@ class TorrentController extends Controller
|
||||
{
|
||||
$params = $request->all();
|
||||
$params['visible'] = Torrent::VISIBLE_YES;
|
||||
$params['category_mode'] = get_setting('main.browsecat');
|
||||
$result = $this->repository->getList($params);
|
||||
$resource = TorrentResource::collection($result);
|
||||
$resource->additional([
|
||||
|
||||
@@ -74,6 +74,12 @@ class TorrentRepository extends BaseRepository
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($params['category_mode'])) {
|
||||
$query->whereHas('basic_category', function (Builder $query) use ($params) {
|
||||
$query->where('mode', $params['category_mode']);
|
||||
});
|
||||
}
|
||||
|
||||
list($sortField, $sortType) = $this->getSortFieldAndType($params);
|
||||
$query->orderBy($sortField, $sortType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user