IndexController.php 795 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace App\Controller;
  12. use App\Crontab\SckwChgrobotCrontab;
  13. use Hyperf\Di\Annotation\Inject;
  14. class IndexController extends AbstractController
  15. {
  16. #[Inject]
  17. public SckwChgrobotCrontab $sckwChgrobotCrontab;
  18. public function index()
  19. {
  20. $user = $this->request->input('user', 'Hyperf');
  21. $method = $this->request->getMethod();
  22. return [
  23. 'method' => $method,
  24. 'message' => "Hello {$user}.",
  25. ];
  26. }
  27. public function test()
  28. {
  29. $this->sckwChgrobotCrontab->execute();
  30. }
  31. }