123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | role.php 角色表
- |--------------------------------------------------------------------------
- */
- # 定义几个常用的选项
- $option = array
- (
- 1 => '可执行',
- 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]<br />或者请执行 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',
- ),
- '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',
- ),
- ),
- );
|