add torrent pos_state_until

This commit is contained in:
xiaomlove
2022-09-17 18:55:26 +08:00
parent fedc67ad5e
commit 1a0ad86b32
10 changed files with 160 additions and 4 deletions

View File

@@ -462,6 +462,28 @@ function docleanup($forceAll = 0, $printProgress = false) {
if ($printProgress) {
printProgress($log);
}
//expire torrent sticky
$toBeExpirePosStates = [
\App\Models\Torrent::POS_STATE_STICKY_FIRST,
\App\Models\Torrent::POS_STATE_STICKY_SECOND,
];
$update = [
'pos_state' => \App\Models\Torrent::POS_STATE_STICKY_NONE,
'pos_state_until' => null,
];
\App\Models\Torrent::query()
->whereIn('pos_state', $toBeExpirePosStates)
->whereNotNull('pos_state_until')
->where('pos_state_until', '<', now())
->update($update);
$log = "expire torrent pos state";
do_log($log);
if ($printProgress) {
printProgress($log);
}
//automatically pick hot
if ($hotdays_torrent)
{

View File

@@ -5872,4 +5872,24 @@ function calculate_harem_addition($uid)
return $addition;
}
function datetimepicker_input($name, $value = '', $label = '')
{
\Nexus\Nexus::css('vendor/jquery-datetimepicker/jquery.datetimepicker.min.css', 'footer', true);
\Nexus\Nexus::js('vendor/jquery-datetimepicker/jquery.datetimepicker.full.min.js', 'footer', true);
$id = "datetime-picker-$name";
$input = sprintf('%s<input type="text" id="%s" name="%s" value="%s" autocomplete="off" >', $label, $id, $name, $value);
$lang = get_langfolder_cookie(true);
if ($lang == 'zh_CN') {
$lang = 'zh';
}
$lang = str_replace('_', '-', $lang);
$js = <<<JS
jQuery.datetimepicker.setLocale('{$lang}');
jQuery("#{$id}").datetimepicker({
format: 'Y-m-d H:i'
})
JS;
\Nexus\Nexus::js($js, 'footer', false);
return $input;
}
?>