AixSchedulingController.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2019/2/13
  6. * Time: 16:52
  7. */
  8. namespace App\Admin\Controllers;
  9. use Encore\Admin\Facades\Admin;
  10. use Encore\Admin\Layout\Content;
  11. use Encore\Admin\Scheduling\Scheduling;
  12. use Illuminate\Http\Request;
  13. class AixSchedulingController
  14. {
  15. public function index()
  16. {
  17. return Admin::content(function (Content $content) {
  18. $content->header('Task scheduling');
  19. $scheduling = new Scheduling();
  20. $events = $scheduling->getTasks();
  21. $content->body(view('admin.schedling.index', [
  22. 'events' => $events,
  23. ]));
  24. });
  25. }
  26. /**
  27. * @param Request $request
  28. *
  29. * @return array
  30. */
  31. public function runEvent(Request $request)
  32. {
  33. $scheduling = new Scheduling();
  34. $scheduling->runTask($request->get('id'));
  35. return [
  36. 'status' => true,
  37. 'message' => 'success',
  38. 'data' => '已提交至队列任务中',
  39. ];
  40. }
  41. }