col.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <?php
  2. # 定义几个常用的选项
  3. $type = array
  4. (
  5. 1 => '文本内容',
  6. 2 => '文件资源',
  7. );
  8. $local = array
  9. (
  10. 1 => '是',
  11. 2 => '否',
  12. );
  13. return array
  14. (
  15. # 表名
  16. 'name' => 'col',
  17. # 显示给用户看的名称
  18. 'lang' => '采集字段管理',
  19. 'menu' => false,
  20. # 后台菜单排序
  21. 'order' => 6,
  22. 'desc' => '字段唯一标识符:如果用逗号隔开,则前面的是dever公共函数,如maketime.date,则会调用Dever::maketime()来处理date的数据
  23. <br />
  24. <a href="'.Dever::url('spider/lib/api.test?id=' . Dever::input('search_option_pid', -1)).'" target="_blank">点此进行测试</a>:请按住ctrl打开新页面并查看源代码',
  25. # 数据结构
  26. 'struct' => array
  27. (
  28. 'id' => array
  29. (
  30. 'type' => 'int-11',
  31. 'name' => 'ID',
  32. 'default' => '',
  33. 'desc' => '',
  34. 'match' => 'is_numeric',
  35. 'search' => 'order',
  36. 'list' => true,
  37. 'order' => 'desc',
  38. ),
  39. 'name' => array
  40. (
  41. 'type' => 'varchar-100',
  42. 'name' => '字段名称',
  43. 'default' => '',
  44. 'desc' => '字段名称',
  45. 'match' => 'is_string',
  46. 'update' => 'text',
  47. 'search' => 'fulltext',
  48. 'list' => true,
  49. 'edit' => true,
  50. ),
  51. 'key' => array
  52. (
  53. 'type' => 'varchar-100',
  54. 'name' => '字段唯一标识符',
  55. 'default' => '',
  56. 'desc' => '字段唯一标识符',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. 'search' => 'fulltext',
  60. 'list' => true,
  61. 'edit' => true,
  62. ),
  63. 'pid' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '项目id',
  67. 'default' => Dever::input('search_option_pid', -1),
  68. 'desc' => '请选择项目id',
  69. 'match' => 'is_numeric',
  70. 'search' => 'order',
  71. 'update' => 'hidden',
  72. ),
  73. 'type' => array
  74. (
  75. 'type' => 'tinyint-1',
  76. 'name' => '字段类型-如果选择文件类型,将只会保存文件的网络地址',
  77. 'default' => '1',
  78. 'desc' => '字段类型',
  79. 'match' => 'is_numeric',
  80. 'option' => $type,
  81. 'update' => 'radio',
  82. 'list' => true,
  83. 'control' => 'type',
  84. ),
  85. 'local' => array
  86. (
  87. 'type' => 'tinyint-1',
  88. 'name' => '资源是否本地化-资源包括图片、视频等,本地化后将转成本地地址',
  89. 'default' => '2',
  90. 'desc' => '资源是否本地化',
  91. 'match' => 'is_numeric',
  92. 'option' => $local,
  93. 'update' => 'radio',
  94. 'control' => 'local',
  95. ),
  96. 'res_key' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '资源库ID-直接输入资源库的配置ID,将根据配置传入到相应的资源库里',
  100. 'default' => '1',
  101. 'desc' => '资源库ID',
  102. 'match' => 'is_numeric',
  103. 'update' => 'text',
  104. 'show' => 'local=1',
  105. ),
  106. 'collect_rule' => array
  107. (
  108. 'type' => 'varchar-500',
  109. 'name' => '采集规则-支持dom解析、JSON、正则,dom解析如$(".info .title a").html(),JSON如data.url,正则就是正则表达式,如果想直接用其他字段,直接输入其他字段的唯一标识符即可,输入第二行可以解析其他字段',
  110. 'default' => '',
  111. 'desc' => '采集规则',
  112. 'match' => 'is_string',
  113. 'update' => 'textarea',
  114. 'list' => true,
  115. 'edit' => 'textarea',
  116. ),
  117. 'collect_include' => array
  118. (
  119. 'type' => 'varchar-500',
  120. 'name' => '包含字符-如果填写该项,则只保留包含有该字符的,多个换行隔开,多个是或的关系',
  121. 'default' => '',
  122. 'desc' => '采集规则',
  123. 'match' => 'option',
  124. 'update' => 'textarea',
  125. ),
  126. 'collect_exclude' => array
  127. (
  128. 'type' => 'varchar-500',
  129. 'name' => '不包含字符-如果填写该项,则只保留不包含有该字符的,多个换行隔开,多个是且的关系',
  130. 'default' => '',
  131. 'desc' => '采集规则',
  132. 'match' => 'option',
  133. 'update' => 'textarea',
  134. ),
  135. 'collect_filter' => array
  136. (
  137. 'type' => 'varchar-500',
  138. 'name' => '过滤规则-如果填写该项,则过滤掉符合该规则的字符,仅支持字符串和正则,输入=>可以替换成后边的字符,如不如输入则过滤为空,多个换行隔开',
  139. 'default' => '',
  140. 'desc' => '采集规则',
  141. 'match' => 'option',
  142. 'update' => 'textarea',
  143. ),
  144. 'collect_filter_link' => array
  145. (
  146. 'type' => 'tinyint-1',
  147. 'name' => '是否过滤链接-将过滤内容中的链接',
  148. 'default' => '2',
  149. 'desc' => '是否过滤链接',
  150. 'match' => 'is_numeric',
  151. 'option' => $local,
  152. 'update' => 'radio',
  153. 'control' => 'local',
  154. ),
  155. 'state' => array
  156. (
  157. 'type' => 'tinyint-1',
  158. 'name' => '数据状态',
  159. 'default' => '1',
  160. 'desc' => '请选择状态',
  161. 'match' => 'is_numeric',
  162. ),
  163. 'cdate' => array
  164. (
  165. 'type' => 'int-11',
  166. 'name' => '录入时间',
  167. 'match' => array('is_numeric', time()),
  168. 'desc' => '',
  169. # 只有insert时才生效
  170. 'insert' => true,
  171. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  172. ),
  173. ),
  174. 'request' => array
  175. (
  176. 'getList' => array
  177. (
  178. 'where' => array
  179. (
  180. 'pid' => 'yes',
  181. 'state' => 1,
  182. ),
  183. 'type' => 'all',
  184. 'order' => array
  185. (
  186. 'id' => 'desc',
  187. ),
  188. 'col' => '*|key',
  189. ),
  190. )
  191. );