'可执行', 2 => '已完成', ); $info = Dever::load('manage/project.get'); $path = $info['manage']['path']; if(isset($info['manage']['setup'])) { $path = $info['manage']['setup']; } # 获取project $project = function() use ($info) { $data = array(); foreach($info as $k => $v) { //$k = $v['lib']; if (isset($v['lang']) && isset($v['name'])) { $data[$k]['id'] = $v['name']; $data[$k]['name'] = $v['lang'] . '('.$v['name'].')'; } } return $data; }; return array ( # 表名 'name' => 'cron', # 显示给用户看的名称 'lang' => '计划任务', 'desc' => Dever::markdown('**启动cron的方法,以下三项任选其一:** 1. 常规任务:请将 ```* * * * * root php '.$path.'daemon/main.php``` 放到cron中[建议每分钟执行一次] 2. 用户触发:请在 ```config/base.php里开启cron=true``` [一般适用于虚拟主机] 3. 长期运行:请执行 ```php '.$path.'daemon/loop.php 1>/dev/null 2>&1 &``` 指令,放置后台运行[一般用于队列等需要长期运行的项目]'), # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, ), 'name' => array ( 'type' => 'varchar-32', 'name' => '任务名', 'default' => '', 'desc' => '请输入任务名', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'project' => array ( 'type' => 'varchar-30', 'name' => '项目', 'default' => '', 'desc' => '请选择项目', 'match' => 'is_string', 'update' => 'select', 'option' => $project, 'list' => true, ), 'interface' => array ( 'type' => 'varchar-100', 'name' => '接口(命令行)', 'default' => '', 'desc' => '请输入接口(命令行)', 'match' => 'is_string', 'update' => 'text', ), 'ldate' => array ( 'type' => 'int-11', 'name' => '执行时间', 'match' => 'is_numeric', 'desc' => '请选择执行时间', 'update' => 'date', 'callback' => 'maketime', 'list' => 'date("Y-m-d H:i:s", {ldate})', ), 'time' => array ( 'type' => 'int-11', 'name' => '时间间隔(为0则执行一次)', 'default' => '0', 'match' => 'is_numeric', 'desc' => '请输入时间间隔', 'update' => 'text', 'list' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', 'option' => $option, 'update' => 'radio', 'list' => true, ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, //'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), 'manage' => array ( //'delete' => false ), # request 请求接口定义 'request' => array ( # get 'get' => array ( 'where' => array ( 'ldate' => array('yes', '<='), 'state' => 1, ), 'type' => 'all', 'order' => array('id', 'desc'), 'col' => '*', ), # get 'getOne' => array ( 'where' => array ( 'project' => 'yes', 'interface' => 'yes', ), 'type' => 'one', ), ), );