Files
nexusphp/app/Console/Commands/HitAndRunUpdateStatus.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2021-06-21 02:01:26 +08:00
<?php
namespace App\Console\Commands;
use App\Repositories\HitAndRunRepository;
use Illuminate\Console\Command;
class HitAndRunUpdateStatus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
2022-03-28 19:52:10 +08:00
protected $signature = 'hr:update_status {--uid=} {--torrent_id=} {--ignore_time=}';
2021-06-21 02:01:26 +08:00
/**
* The console command description.
*
* @var string
*/
2022-03-28 19:52:10 +08:00
protected $description = 'Update H&R status, options: --uid, --torrent_id, --ignore_time';
2021-06-21 02:01:26 +08:00
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$uid = $this->option('uid');
$torrentId = $this->option('torrent_id');
2022-03-28 19:52:10 +08:00
$ignoreTime = $this->option('ignore_time');
2021-06-21 02:01:26 +08:00
$rep = new HitAndRunRepository();
2025-09-08 03:05:55 +07:00
$rep->cronjobUpdateStatus($uid, $torrentId, $ignoreTime);
2021-06-21 02:01:26 +08:00
$log = sprintf(
2025-09-08 03:05:55 +07:00
'[%s], %s, uid: %s, torrentId: %s, ignoreTime: %s',
nexus()->getRequestId(), __METHOD__, $uid, $torrentId, $ignoreTime
2021-06-21 02:01:26 +08:00
);
$this->info($log);
do_log($log);
return 0;
}
}