AddTaskProgressCommand.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Module\Task\Commands;
  3. use App\Module\Game\Services\TaskTempService;
  4. use Illuminate\Console\Command;
  5. /**
  6. * 添加任务进度测试命令
  7. */
  8. class AddTaskProgressCommand extends Command
  9. {
  10. /**
  11. * 命令签名
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'task:add-progress {user_id : 用户ID}';
  16. /**
  17. * 命令描述
  18. *
  19. * @var string
  20. */
  21. protected $description = '添加任务进度更新测试数据';
  22. /**
  23. * 执行命令
  24. *
  25. * @return int
  26. */
  27. public function handle(): int
  28. {
  29. $userId = (int) $this->argument('user_id');
  30. // 添加进度更新数据
  31. TaskTempService::recordTaskProgressUpdate($userId, 2001, '每日收获任务', 50, [
  32. 'condition_id' => 1,
  33. 'current_value' => 5,
  34. 'target_value' => 10
  35. ]);
  36. $this->info("✓ 已为用户 {$userId} 添加任务进度更新数据");
  37. // 显示当前暂存数据
  38. $this->call('task:test-temp', ['user_id' => $userId]);
  39. return 0;
  40. }
  41. }