mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
[admin] set torrent pos_state_until
This commit is contained in:
@@ -598,11 +598,22 @@ class TorrentRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
public function setPosState($id, $posState): int
|
||||
public function setPosState($id, $posState, $posStateUntil = null): int
|
||||
{
|
||||
user_can('torrentsticky', true);
|
||||
if ($posState == Torrent::POS_STATE_STICKY_NONE) {
|
||||
$posStateUntil = null;
|
||||
}
|
||||
if ($posStateUntil && Carbon::parse($posStateUntil)->lte(now())) {
|
||||
$posState = Torrent::POS_STATE_STICKY_NONE;
|
||||
$posStateUntil = null;
|
||||
}
|
||||
$update = [
|
||||
'pos_state' => $posState,
|
||||
'pos_state_until' => $posStateUntil,
|
||||
];
|
||||
$idArr = Arr::wrap($id);
|
||||
return Torrent::query()->whereIn('id', $idArr)->update(['pos_state' => $posState]);
|
||||
return Torrent::query()->whereIn('id', $idArr)->update($update);
|
||||
}
|
||||
|
||||
public function buildUploadFieldInput($name, $value, $noteText, $btnText): string
|
||||
|
||||
Reference in New Issue
Block a user