improve cleanup calculate seed bonus

This commit is contained in:
xiaomlove
2023-07-15 01:44:48 +08:00
parent d8aef62b33
commit 8e5cd7dd60
8 changed files with 153 additions and 89 deletions

View File

@@ -14,14 +14,14 @@ class Cleanup extends Command
*
* @var string
*/
protected $signature = 'cleanup {--action=} {--begin_id=} {--end_id=} {--request_id=} {--delay=}';
protected $signature = 'cleanup {--action=} {--begin_id=} {--id_str=} {--end_id=} {--request_id=} {--delay=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Cleanup async job trigger, options: --begin_id, --end_id, --request_id, --delay, --action (seed_bonus, seeding_leeching_time, seeders_etc)';
protected $description = 'Cleanup async job trigger, options: --begin_id, --end_id, --id_str, --request_id, --delay, --action (seed_bonus, seeding_leeching_time, seeders_etc)';
/**
* Execute the console command.
@@ -33,15 +33,16 @@ class Cleanup extends Command
$action = $this->option('action');
$beginId = $this->option('begin_id');
$endId = $this->option('end_id');
$idStr = $this->option('id_str');
$commentRequestId = $this->option('request_id');
$delay = $this->option('delay') ?: 0;
$this->info("beginId: $beginId, endId: $endId, commentRequestId: $commentRequestId, delay: $delay, action: $action");
$this->info("beginId: $beginId, endId: $endId, idStr: $idStr, commentRequestId: $commentRequestId, delay: $delay, action: $action");
if ($action == 'seed_bonus') {
CalculateUserSeedBonus::dispatch($beginId, $endId, $commentRequestId)->delay($delay);
CalculateUserSeedBonus::dispatch($beginId, $endId, $idStr, $commentRequestId)->delay($delay);
} elseif ($action == 'seeding_leeching_time') {
UpdateUserSeedingLeechingTime::dispatch($beginId, $endId, $commentRequestId)->delay($delay);
UpdateUserSeedingLeechingTime::dispatch($beginId, $endId, $idStr, $commentRequestId)->delay($delay);
}elseif ($action == 'seeders_etc') {
UpdateTorrentSeedersEtc::dispatch($beginId, $endId, $commentRequestId)->delay($delay);
UpdateTorrentSeedersEtc::dispatch($beginId, $endId, $idStr, $commentRequestId)->delay($delay);
} else {
$msg = "[$commentRequestId], Invalid action: $action";
do_log($msg, 'error');

View File

@@ -98,9 +98,8 @@ class Test extends Command
*/
public function handle()
{
$redis = NexusDB::redis();
$r = CleanupRepository::recordBatch($redis, 99, 100);
dd($r);
CleanupRepository::recordBatch(NexusDB::redis(), "1", "5");
CleanupRepository::runBatchJobCalculateUserSeedBonus("bbbbb");
}
}