mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-19 00:01:00 +08:00
H&R: add reach by leech time
This commit is contained in:
@@ -202,6 +202,20 @@ class HitAndRunRepository extends BaseRepository
|
||||
continue;
|
||||
}
|
||||
|
||||
//check leech time
|
||||
if (isset($setting['leech_time_minimum']) && $setting['leech_time_minimum'] > 0) {
|
||||
$targetLeechTime = $row->snatch->leechtime;
|
||||
$requireLeechTime = bcmul($setting['leech_time_minimum'], 3600);
|
||||
do_log("$currentLog, targetLeechTime: $targetLeechTime, requireLeechTime: $requireLeechTime");
|
||||
if ($targetLeechTime >= $requireLeechTime) {
|
||||
$result = $this->reachedByLeechTime($row, $setting);
|
||||
if ($result) {
|
||||
$successCounts++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//check share ratio
|
||||
$targetShareRatio = bcdiv($row->snatch->uploaded, $row->torrent->size, 4);
|
||||
$requireShareRatio = $setting['ignore_when_ratio_reach'];
|
||||
@@ -273,6 +287,20 @@ class HitAndRunRepository extends BaseRepository
|
||||
return $this->inspectingToReached($hitAndRun, $update, __FUNCTION__);
|
||||
}
|
||||
|
||||
private function reachedByLeechTime(HitAndRun $hitAndRun, array $setting): bool
|
||||
{
|
||||
do_log(__METHOD__);
|
||||
$comment = nexus_trans('hr.reached_by_leech_time_comment', [
|
||||
'now' => Carbon::now()->toDateTimeString(),
|
||||
'leech_time' => bcdiv($hitAndRun->snatch->leechtime, 3600, 1),
|
||||
'leech_time_minimum' => $setting['leech_time_minimum'],
|
||||
], $hitAndRun->user->locale);
|
||||
$update = [
|
||||
'comment' => $comment
|
||||
];
|
||||
return $this->inspectingToReached($hitAndRun, $update, __FUNCTION__);
|
||||
}
|
||||
|
||||
private function reachedBySpecialUserClass(HitAndRun $hitAndRun): bool
|
||||
{
|
||||
do_log(__METHOD__);
|
||||
|
||||
Reference in New Issue
Block a user