remove leech warn

This commit is contained in:
xiaomlove
2022-05-13 15:56:09 +08:00
parent 6eeac797a4
commit 155d4ddcb6
10 changed files with 77 additions and 23 deletions

View File

@@ -282,6 +282,22 @@ class UserRepository extends BaseRepository
return true;
}
public function removeLeechWarn($operator, $uid): bool
{
if (!$operator instanceof User) {
$operator = User::query()->findOrFail(intval($operator), User::$commonFields);
}
$classRequire = Setting::get('authority.prfmanage');
if ($operator->class < $classRequire) {
throw new \RuntimeException("No permission.");
}
$user = User::query()->findOrFail($uid, User::$commonFields);
NexusDB::cache_del('user_'.$uid.'_content');
$user->leechwarn = 'no';
$user->leechwarnuntil = null;
return $user->save();
}
}