12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkAdmin
- // +----------------------------------------------------------------------
- // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
- // +----------------------------------------------------------------------
- // | 官方网站: http://demo.thinkadmin.top
- // +----------------------------------------------------------------------
- // | 开源协议 ( https://mit-license.org )
- // +----------------------------------------------------------------------
- // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
- // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
- // +----------------------------------------------------------------------
- namespace app\admin\controller;
- use library\Controller;
- use think\Console;
- /**
- * 系统系统任务
- * Class Queue
- * @package app\admin\controller
- */
- class Queue extends Controller
- {
- /**
- * 绑定数据表
- * @var string
- */
- protected $table = 'SystemQueue';
- /**
- * 系统系统任务
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- * @throws \think\exception\PDOException
- */
- public function index()
- {
- if (session('admin_user.username') === 'admin') try {
- $this->cmd = 'php ' . env('root_path') . 'think xtask:start';
- $this->message = Console::call('xtask:state')->fetch();
- } catch (\Exception $exception) {
- $this->message = $exception->getMessage();
- }
- $this->title = '系统任务管理';
- $query = $this->_query($this->table)->dateBetween('create_at,end_at');
- $query->like('title,preload')->equal('status')->order('id desc')->page();
- }
- /**
- * 重启系统任务
- * @auth true
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function redo()
- {
- $this->_save($this->table, ['status' => '1']);
- }
- /**
- * 删除系统任务
- * @auth true
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function remove()
- {
- $this->_delete($this->table);
- }
- }
|