TestJob.php 758 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Jobs;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Foundation\Bus\Dispatchable;
  6. use Illuminate\Queue\InteractsWithQueue;
  7. use Illuminate\Queue\SerializesModels;
  8. use Illuminate\Support\Facades\DB;
  9. class TestJob implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable;
  12. private $str;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct(string $str)
  19. {
  20. $this->str = $str;
  21. }
  22. /**
  23. * Execute the job.
  24. *
  25. * @return void
  26. */
  27. public function handle()
  28. {
  29. DB::select("call stu_out('{$this->str}',@str)");
  30. echo json_encode(DB::selectOne("select @str"));
  31. }
  32. }