data.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '正常',
  6. 2 => '删除',
  7. );
  8. $use = array
  9. (
  10. 1 => '未使用',
  11. 2 => '已使用',
  12. );
  13. $pid = Dever::input('search_option_pid');
  14. return array
  15. (
  16. # 表名
  17. 'name' => 'data',
  18. # 显示给用户看的名称
  19. 'lang' => '数据管理',
  20. # 后台菜单排序
  21. 'order' => 6,
  22. 'menu' => false,
  23. # 数据结构
  24. 'struct' => array
  25. (
  26. 'id' => array
  27. (
  28. 'type' => 'int-11',
  29. 'name' => 'ID',
  30. 'default' => '',
  31. 'desc' => '',
  32. 'match' => 'is_numeric',
  33. 'search' => 'order',
  34. 'list' => true,
  35. 'order' => 'desc',
  36. ),
  37. 'pid' => array
  38. (
  39. 'type' => 'int-11',
  40. 'name' => '项目',
  41. 'default' => '1',
  42. 'desc' => '请选择项目id',
  43. 'match' => 'is_numeric',
  44. //'list' => '{pid} > 0 ? Dever::load("spider/project-one#name", {pid}) : "无"',
  45. # 开启显示控制,可以控制下边的表单
  46. //'show' => 'cate_id',
  47. ),
  48. 'source' => array
  49. (
  50. 'type' => 'varchar-2000',
  51. 'name' => '来源',
  52. 'default' => '',
  53. 'desc' => '来源',
  54. 'match' => 'is_string',
  55. 'update' => 'text',
  56. 'search' => 'fulltext',
  57. 'list' => true,
  58. ),
  59. 'value' => array
  60. (
  61. 'type' => 'text-1000',
  62. 'name' => '数据',
  63. 'default' => '',
  64. 'desc' => '数据',
  65. 'match' => 'is_string',
  66. //'update' => 'editor',
  67. 'search' => 'fulltext',
  68. 'list' => 'Dever::load("spider/data.value", {id})',
  69. //'modal' => '查看详情',
  70. ),
  71. 'log_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '日志id',
  75. 'default' => '1',
  76. 'desc' => '请输入日志id',
  77. 'match' => 'is_numeric',
  78. //'update' => 'text',
  79. 'search' => 'fulltext',
  80. //'list' => true,
  81. ),
  82. 'use' => array
  83. (
  84. 'type' => 'tinyint-1',
  85. 'name' => '使用状态',
  86. 'default' => '1',
  87. 'desc' => '使用状态',
  88. 'match' => 'is_numeric',
  89. 'option' => $use,
  90. 'update' => 'radio',
  91. 'list' => true,
  92. ),
  93. 'state' => array
  94. (
  95. 'type' => 'tinyint-1',
  96. 'name' => '数据状态',
  97. 'default' => '1',
  98. 'desc' => '请选择状态',
  99. 'match' => 'is_numeric',
  100. ),
  101. 'cdate' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '录入时间',
  105. 'match' => array('is_numeric', time()),
  106. 'desc' => '',
  107. # 只有insert时才生效
  108. //'insert' => true,
  109. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  110. ),
  111. ),
  112. 'manage' => array
  113. (
  114. # 开启批量管理
  115. //'mul' => true,
  116. 'insert' => false,
  117. 'edit' => false,
  118. //'delete' => false,
  119. # 自定义快捷新增和编辑
  120. 'button' => array
  121. (
  122. //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
  123. //'导出EXCEL' => array('location', 'spider/data.excel?id=' . $pid),
  124. '导出SQL' => array('location', 'spider/data.sql?id=' . $pid . '&time=' . time()),
  125. '重置使用状态' => array('oper', 'spider/data.use?id=' . $pid),
  126. '清空数据' => array('oper', 'spider/data.drop?id=' . $pid),
  127. ),
  128. ),
  129. # request 请求接口定义
  130. 'request' => array
  131. (
  132. # 更新浏览量
  133. 'addView' => array
  134. (
  135. 'type' => 'update',
  136. 'where' => array
  137. (
  138. 'id' => 'yes',
  139. ),
  140. 'set' => array
  141. (
  142. 'num_view' => array('1', '+='),
  143. ),
  144. ),
  145. 'getAll' => array
  146. (
  147. # 匹配的正则或函数 选填项
  148. 'option' => array
  149. (
  150. 'pid' => 'yes',
  151. 'use' => 'yes',
  152. 'state' => 1,
  153. ),
  154. 'type' => 'all',
  155. 'order' => array('id', 'asc'),
  156. 'limit' => '0,12',
  157. ),
  158. 'getOne' => array
  159. (
  160. # 匹配的正则或函数 选填项
  161. 'option' => array
  162. (
  163. 'pid' => 'yes',
  164. 'state' => 1,
  165. ),
  166. 'type' => 'one',
  167. 'order' => array('id', 'desc'),
  168. ),
  169. ),
  170. );