'可执行', 2 => '已完成', ); # 获取project $project = function() { $info = Maze::load('manage/project.get'); $data = array(); foreach($info as $k => $v) { $k = $v['lib']; $data[$k]['id'] = $v['name']; $data[$k]['name'] = $v['lang']; } return $data; }; //print_r($project);die; return array ( # 表名 'name' => 'cron', # 显示给用户看的名称 'lang' => '计划任务', 'desc' => '请将* * * * * root php '.MAZE_PROJECT_PATH.'daemon/maze.php放到cron中[建议每分钟执行一次,虚拟主机请在config/base.php里开启cron=true]
如需一直后台运行,请执行 setsid php '.MAZE_PROJECT_PATH.'daemon/loop.php > /dev/null & 指令,放置后台运行', # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, ), 'name' => array ( 'type' => 'varchar-24', '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', //'list' => true, ), '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 ( 'list_button' => array(6 => '删除'), ), # 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', ), ), );