mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
[api] torrents list exclude special
This commit is contained in:
@@ -21,6 +21,7 @@ class TorrentController extends Controller
|
|||||||
{
|
{
|
||||||
$params = $request->all();
|
$params = $request->all();
|
||||||
$params['visible'] = Torrent::VISIBLE_YES;
|
$params['visible'] = Torrent::VISIBLE_YES;
|
||||||
|
$params['category_mode'] = get_setting('main.browsecat');
|
||||||
$result = $this->repository->getList($params);
|
$result = $this->repository->getList($params);
|
||||||
$resource = TorrentResource::collection($result);
|
$resource = TorrentResource::collection($result);
|
||||||
$resource->additional([
|
$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);
|
list($sortField, $sortType) = $this->getSortFieldAndType($params);
|
||||||
$query->orderBy($sortField, $sortType);
|
$query->orderBy($sortField, $sortType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user