judge H&R count think about section

This commit is contained in:
xiaomlove
2022-10-01 01:58:18 +08:00
parent 6de5cb2f21
commit 28b85c7ecf
5 changed files with 14 additions and 7 deletions
+6 -1
View File
@@ -335,7 +335,12 @@ class HitAndRunRepository extends BaseRepository
//disable user
/** @var User $user */
$user = $hitAndRun->user;
$counts = $user->hitAndRuns()->where('status', HitAndRun::STATUS_UNREACHED)->count();
$counts = $user->hitAndRuns()
->where('status', HitAndRun::STATUS_UNREACHED)
->whereHas('torrent.basic_category', function (Builder $query) use ($searchBoxId) {
return $query->where('mode', $searchBoxId);
})
->count();
$disableCounts = HitAndRun::getConfig('ban_user_when_counts_reach', $searchBoxId);
do_log("user: {$user->id}, H&R counts: $counts, disableCounts: $disableCounts", 'notice');
if ($counts >= $disableCounts) {