|
@@ -0,0 +1,398 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+# 定义几个常用的选项
|
|
|
+$option = array
|
|
|
+(
|
|
|
+ 1 => '可用',
|
|
|
+ 2 => '不可用',
|
|
|
+);
|
|
|
+
|
|
|
+$mul = array
|
|
|
+(
|
|
|
+ 1 => '开启',
|
|
|
+ 2 => '关闭',
|
|
|
+);
|
|
|
+
|
|
|
+$pic = array
|
|
|
+(
|
|
|
+ 1 => '关闭',
|
|
|
+ 2 => '开启',
|
|
|
+);
|
|
|
+
|
|
|
+$status = array
|
|
|
+(
|
|
|
+ 1 => '待机',
|
|
|
+ 2 => '运行中',
|
|
|
+ 3 => '抓取中',
|
|
|
+ 4 => '已完成',
|
|
|
+);
|
|
|
+
|
|
|
+$cate = function()
|
|
|
+{
|
|
|
+ $array = array();
|
|
|
+ $cate = Dever::load('collect/cate-main');
|
|
|
+ if($cate)
|
|
|
+ {
|
|
|
+ $array += $cate;
|
|
|
+ }
|
|
|
+ return $array;
|
|
|
+};
|
|
|
+
|
|
|
+$cate_child = function()
|
|
|
+{
|
|
|
+ $cate = Dever::load('collect/cate-child');
|
|
|
+
|
|
|
+ return $cate;
|
|
|
+};
|
|
|
+
|
|
|
+return array
|
|
|
+(
|
|
|
+ # 表名
|
|
|
+ 'name' => 'config',
|
|
|
+ # 显示给用户看的名称
|
|
|
+ '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' => '父级分类',
|
|
|
+ //'list' => '{cate_id_parent} > 0 ? Dever::load("collect/cate-one#name", {cate_id_parent}) : "无"',
|
|
|
+ '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' => 'order',
|
|
|
+ 'list_name' => '子分类',
|
|
|
+ 'list' => '{cate_id} > 0 ? Dever::load("collect/cate-one#name", {cate_id}) : "无"',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'site' => array
|
|
|
+ (
|
|
|
+ 'type' => 'text-255',
|
|
|
+ 'name' => '采集网址-这里填写采集网址,如果采集的网址和分页的链接不同,需要加入|g|分隔符来确认与分页不同的部分,如果进行单页采集,则|g|失效,同时此处可以填写多个网址,多个换行隔开',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集网址',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ //'list' => true,
|
|
|
+ //'edit' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'site_rule_content' => array
|
|
|
+ (
|
|
|
+ 'type' => 'tinyint-1',
|
|
|
+ 'name' => '是否进行批量采集-默认开启,开启则根据“底层页采集规则”得到下级网址里的内容,否则直接读取采集网址的内容(单页采集)',
|
|
|
+ 'default' => '1',
|
|
|
+ 'desc' => '是否进行批量采集',
|
|
|
+ 'match' => 'is_numeric',
|
|
|
+ 'option' => $mul,
|
|
|
+ 'update' => 'radio',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'site_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '底层页采集规则-使用正则表达式,匹配出当前采集网址里的底层页网址',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '底层页采集规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'page_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '采集页数规则-填写采集的页数的正则表达式,加入|g|来设置共采集多少页,如[a-z]|g|10',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集页数规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'name_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '采集标题规则-填写采集的标题的正则表达式,用来读取的标题',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集标题规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'name_include' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '标题包含字符-如果填写该项,则进一步过滤,只保留包含有该字符的,不支持正则',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集标题规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'content_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '采集内容规则-填写采集的内容的正则表达式,用来读取的内容',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集内容规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'content_include' => array
|
|
|
+ (
|
|
|
+ 'type' => 'text-255',
|
|
|
+ 'name' => '内容过滤字符-如果填写该项,则进一步过滤内容,只保留不包含有该字符的内容(注意:和标题包含字符不同),多个规则直接换行,支持正则',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集内容规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'date_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '采集时间规则-填写采集的时间的正则表达式,用来读取的时间',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集时间规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'intro_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-300',
|
|
|
+ 'name' => '采集摘要规则-填写采集的摘要的正则表达式,用来读取的摘要,一般不需要特意采集',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集摘要规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'extend_rule' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-600',
|
|
|
+ 'name' => '采集扩展字段规则-如果需要采集除上述之外的字段的数据,可以通过这个扩展字段规则来定义,多个换行',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '采集扩展字段规则',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'extend_name' => array
|
|
|
+ (
|
|
|
+ 'type' => 'varchar-600',
|
|
|
+ 'name' => '扩展字段名称-必须与上述扩展字段规则一一对应,多个换行',
|
|
|
+ 'default' => '',
|
|
|
+ 'desc' => '扩展字段名称',
|
|
|
+ 'match' => 'option',
|
|
|
+ 'update' => 'textarea',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'pic_locate' => array
|
|
|
+ (
|
|
|
+ 'type' => 'tinyint-1',
|
|
|
+ 'name' => '图片本地化-默认关闭,将图片抓取到本站来,开启后抓取效率会降低',
|
|
|
+ 'default' => '1',
|
|
|
+ 'desc' => '图片本地化',
|
|
|
+ 'match' => 'is_numeric',
|
|
|
+ 'option' => $pic,
|
|
|
+ //'update' => 'radio',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'status' => array
|
|
|
+ (
|
|
|
+ 'type' => 'tinyint-1',
|
|
|
+ 'name' => '状态',
|
|
|
+ 'default' => '1',
|
|
|
+ 'desc' => '状态',
|
|
|
+ 'match' => 'is_numeric',
|
|
|
+ 'option' => $status,
|
|
|
+ 'list' => true,
|
|
|
+ 'edit' => 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',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'time' => 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,
|
|
|
+ 'order' => 'desc',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'state' => array
|
|
|
+ (
|
|
|
+ 'type' => 'tinyint-1',
|
|
|
+ 'name' => '状态',
|
|
|
+ 'default' => '1',
|
|
|
+ 'desc' => '请选择状态',
|
|
|
+ 'match' => 'is_numeric',
|
|
|
+ 'option' => $option,
|
|
|
+ 'update' => 'radio',
|
|
|
+ ),
|
|
|
+
|
|
|
+ '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
|
|
|
+ (
|
|
|
+ 11 => array('数据列表', '"data&option_config_id={id}&oper_save_jump=config&oper_parent=config"'),
|
|
|
+ 6 => array('采集数据', 'Dever::url("collect/data.daemon?id={id}&")'),
|
|
|
+ //22 => array('新增设备', '"system&option_system_id={id}&oper_save_jump=system&oper_parent=system"', '{system_id}==-1'),
|
|
|
+ //6 => '删除'
|
|
|
+ ),
|
|
|
+
|
|
|
+ //'desc' => '注意:命令码',
|
|
|
+ ),
|
|
|
+
|
|
|
+ 'alter' => array
|
|
|
+ (
|
|
|
+ 1 => array
|
|
|
+ (
|
|
|
+ array('update', 'content_include', 'content_include', 'text-255 内容'),//更新字段
|
|
|
+ ),
|
|
|
+ 'version' => 1,
|
|
|
+ ),
|
|
|
+
|
|
|
+ # 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',
|
|
|
+ ),
|
|
|
+ )
|
|
|
+);
|