CrontabLog.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller\general;
  3. use app\common\controller\Backend;
  4. /**
  5. * 定时任务
  6. *
  7. * @icon fa fa-tasks
  8. * @remark 类似于Linux的Crontab定时任务,可以按照设定的时间进行任务的执行
  9. */
  10. class CrontabLog extends Backend
  11. {
  12. protected $model = null;
  13. public function _initialize()
  14. {
  15. parent::_initialize();
  16. $this->model = model('CrontabLog');
  17. $this->view->assign('statusList', $this->model->getStatusList());
  18. $this->assignconfig('statusList', $this->model->getStatusList());
  19. }
  20. /**
  21. * 查看
  22. */
  23. public function index()
  24. {
  25. if ($this->request->isAjax()) {
  26. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  27. $total = $this->model
  28. ->where($where)
  29. ->order($sort, $order)
  30. ->count();
  31. $list = $this->model
  32. ->where($where)
  33. ->order($sort, $order)
  34. ->limit($offset, $limit)
  35. ->select();
  36. $list = collection($list)->toArray();
  37. $result = array("total" => $total, "rows" => $list);
  38. return json($result);
  39. }
  40. return $this->view->fetch();
  41. }
  42. public function detail($ids = null)
  43. {
  44. $row = $this->model->get($ids);
  45. if (!$row) {
  46. $this->error(__('No Results were found'));
  47. }
  48. $this->view->assign("row", $row);
  49. return $this->view->fetch();
  50. }
  51. }