mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-21 10:27:27 +08:00
fix torrent searchbox id
This commit is contained in:
@@ -62,7 +62,12 @@ class HitAndRun extends NexusModel
|
||||
if ($this->status != self::STATUS_INSPECTING) {
|
||||
return '---';
|
||||
}
|
||||
$inspectTime = HitAndRun::getConfig('inspect_time', $this->torrent->basic_category->mode);
|
||||
$searchBoxId = $this->torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $this->torrent_id), 'error');
|
||||
return '---';
|
||||
}
|
||||
$inspectTime = HitAndRun::getConfig('inspect_time', $searchBoxId);
|
||||
$diffInSeconds = Carbon::now()->diffInSeconds($this->snatch->completedat->addHours($inspectTime));
|
||||
return mkprettytime($diffInSeconds);
|
||||
}
|
||||
@@ -72,7 +77,12 @@ class HitAndRun extends NexusModel
|
||||
if ($this->status != self::STATUS_INSPECTING) {
|
||||
return '---';
|
||||
}
|
||||
$seedTimeMinimum = HitAndRun::getConfig('seed_time_minimum', $this->torrent->basic_category->mode);
|
||||
$searchBoxId = $this->torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $this->torrent_id), 'error');
|
||||
return '---';
|
||||
}
|
||||
$seedTimeMinimum = HitAndRun::getConfig('seed_time_minimum', $searchBoxId);
|
||||
$diffInSeconds = 3600 * $seedTimeMinimum - $this->snatch->seedtime;
|
||||
return mkprettytime($diffInSeconds);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,12 @@ class Torrent extends NexusModel
|
||||
public function getHrAttribute(): string
|
||||
{
|
||||
// $hrMode = Setting::get('hr.mode');
|
||||
$hrMode = HitAndRun::getConfig('mode', $this->basic_category->mode);
|
||||
$searchBoxId = $this->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s, category: %s invalid', $this->id, $this->category), 'error');
|
||||
return self::HR_NO;
|
||||
}
|
||||
$hrMode = HitAndRun::getConfig('mode', $searchBoxId);
|
||||
if ($hrMode == HitAndRun::MODE_GLOBAL) {
|
||||
return self::HR_YES;
|
||||
}
|
||||
|
||||
@@ -301,8 +301,12 @@ class SearchRepository extends BaseRepository
|
||||
$idName => $this->getTorrentId($torrent->id),
|
||||
'routing' => $torrent->owner,
|
||||
];
|
||||
$searchBoxId = $torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $torrent->id), 'error');
|
||||
}
|
||||
$data = Arr::only($torrent->toArray(), $baseFields);
|
||||
$data['mode'] = $torrent->basic_category->mode;
|
||||
$data['mode'] = $searchBoxId;
|
||||
$body = array_merge($data, [
|
||||
'_doc_type' => $docType,
|
||||
'torrent_id' => $torrent->id,
|
||||
|
||||
@@ -1093,7 +1093,12 @@ class TrackerRepository extends BaseRepository
|
||||
return;
|
||||
}
|
||||
// $hrMode = Setting::get('hr.mode');
|
||||
$hrMode = HitAndRun::getConfig('mode', $torrent->basic_category->mode);
|
||||
$searchBoxId = $torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $torrent->id), 'error');
|
||||
return;
|
||||
}
|
||||
$hrMode = HitAndRun::getConfig('mode', $searchBoxId);
|
||||
if ($hrMode == HitAndRun::MODE_DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user