'关闭', 2 => '开启', ); $status = array ( 1 => '待机', 2 => '运行中', 3 => '抓取中', 4 => '已完成', ); $cate = function() { $array = array(); $cate = Dever::load('spider/cate-main'); if ($cate) { $array += $cate; } return $array; }; $cate_child = function() { $cate = Dever::load('spider/cate-child'); return $cate; }; $search_cate = function() { $array = array ( -1 => array('id' => '-1', 'name' => '所有分类'), ); $cate = Dever::load('forum/cate.all'); if ($cate) { $array += $cate; } return $array; }; return array ( # 表名 'name' => 'project', # 显示给用户看的名称 'lang' => '项目管理', # 后台菜单排序 'order' => 20, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => '项目ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, 'order' => 'desc', ), 'name' => array ( 'type' => 'varchar-100', 'name' => '项目名称', 'default' => '', 'desc' => '请输入项目名称', 'match' => 'is_string', 'update' => 'text', 'search' => 'order,fulltext', 'list' => true, 'edit' => true, ), 'cate_id_parent' => array ( 'type' => 'int-11', 'name' => '选择分类', 'default' => '0', 'desc' => '请选择分类', 'match' => 'is_numeric', 'update' => 'select', //'search' => 'order,select', 'list_name' => '父级分类', 'option' => $cate, # 当值改变时,执行下一步操作 'child_name' => 'cate_id', 'child' => $cate_child, 'child_value' => '{cate_id}', ), 'cate_id' => array ( 'type' => 'int-11', 'name' => '子分类', 'default' => '0', 'desc' => '请选择子分类', 'match' => 'is_numeric', 'search' => 'group', 'option' => $search_cate, 'list_name' => '分类', 'list' => '{cate_id} > 0 ? Dever::load("spider/cate-one#name", {cate_id}) : "无"', ), 'site' => array ( 'type' => 'text-255', 'name' => '采集网址-多个网址换行隔开', 'default' => '', 'desc' => '采集网址', 'match' => 'option', 'update' => 'textarea', //'list' => true, //'edit' => 'textarea', ), 'collect_rule' => array ( 'type' => 'varchar-500', 'name' => '采集规则-支持dom解析、正则', 'default' => '', 'desc' => '采集规则', 'match' => 'is_string', 'update' => 'textarea', 'edit' => true, 'list' => true, ), 'page_rule' => array ( 'type' => 'varchar-300', 'name' => '采集页数规则-填写采集的页数的正则表达式', 'default' => '', 'desc' => '采集页数规则', 'match' => 'option', 'update' => 'textarea', ), 'page_num' => array ( 'type' => 'int-11', 'name' => '采集页数', 'default' => '10', 'desc' => '采集页数', 'match' => 'option', 'update' => 'text', ), 'status' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '状态', 'match' => 'is_numeric', 'option' => $status, 'list' => true, //'update' => 'radio', ), 'num' => array ( 'type' => 'int-11', 'name' => '抓取次数', 'default' => '0', 'desc' => '抓取次数', 'match' => 'is_numeric', 'list' => true, ), 'sdate' => array ( 'type' => 'int-11', 'name' => '抓取开始时间', 'default' => '0', 'desc' => '抓取开始时间', 'match' => 'is_numeric', 'update' => 'date', 'list' => 'date("Y-m-d H:i:s", {sdate})', 'callback' => 'maketime', ), 'intervals' => array ( 'type' => 'int-11', 'name' => '抓取间隔秒数-填写开始时间之后的间隔抓取的秒数,为0则只抓取一次', 'default' => '0', 'desc' => '抓取间隔秒数', 'match' => 'is_numeric', 'update' => 'text', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越大越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', //'update' => 'text', 'search' => 'order', 'list' => true, 'edit' => true, 'order' => 'desc', ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), '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 ( # 更新数据时,要显示的按钮,这里填写js脚本事件即可。保存当前数据可为固定参数:"save-data",复制数据为:copy-data 'update_button' => array ( '提交保存' => 'save-data', '放弃保存' => "msg({status:1,msg:'yes'})", '复制数据' => 'copy-data', ), # 不允许编辑 //'edit' => false, # 列表页的类型 //'list_type' => 'parent', # 可以删除 'list_button' => array ( 'list_col' => array('字段设置', '"col&search_option_project_id={id}"'), 'list_data' => array('数据列表', '"data&search_option_project_id={id}&oper_save_jump=project&oper_parent=project"'), //'delete' => array('采集数据', 'Dever::url("spider/data.daemon?id={id}&")'), ), //'desc' => '注意:命令码', ), # request 请求接口定义 'request' => array ( # 获取所有待机并且符合当前时间的配置 'get' => array ( 'option' => array ( 'id' => 'yes', 'status' => array('yes', '<='), 'sdate' => array('yes-sdate`+`time', '<='), 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'id' => 'desc'), 'col' => '*', ), # 获取所有运行中的数据 'getOne' => array ( 'option' => array ( 'id' => 'yes', 'status' => array('yes'), 'sdate' => array('yes-sdate`+`time', '<='), 'state' => 1, ), 'type' => 'one', ), ) );