data.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. 'search' => 'select',
  91. 'update' => 'radio',
  92. 'list' => true,
  93. ),
  94. 'state' => array
  95. (
  96. 'type' => 'tinyint-1',
  97. 'name' => '数据状态',
  98. 'default' => '1',
  99. 'desc' => '请选择状态',
  100. 'match' => 'is_numeric',
  101. ),
  102. 'cdate' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => '录入时间',
  106. 'match' => array('is_numeric', time()),
  107. 'desc' => '',
  108. # 只有insert时才生效
  109. //'insert' => true,
  110. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  111. ),
  112. ),
  113. 'manage' => array
  114. (
  115. # 开启批量管理
  116. //'mul' => true,
  117. 'insert' => false,
  118. 'edit' => false,
  119. //'delete' => false,
  120. # 自定义快捷新增和编辑
  121. 'button' => array
  122. (
  123. //'新增兑换码' => array('fast', 1, 'config&where_id=1'),
  124. //'导出EXCEL' => array('location', 'spider/data.excel?id=' . $pid),
  125. '导出SQL' => array('location', 'spider/data.sql?id=' . $pid . '&time=' . time()),
  126. '重置使用状态' => array('oper', 'spider/data.use?id=' . $pid),
  127. '清空数据' => array('oper', 'spider/data.drop?id=' . $pid),
  128. ),
  129. ),
  130. # request 请求接口定义
  131. 'request' => array
  132. (
  133. # 更新浏览量
  134. 'addView' => array
  135. (
  136. 'type' => 'update',
  137. 'where' => array
  138. (
  139. 'id' => 'yes',
  140. ),
  141. 'set' => array
  142. (
  143. 'num_view' => array('1', '+='),
  144. ),
  145. ),
  146. 'getAll' => array
  147. (
  148. # 匹配的正则或函数 选填项
  149. 'option' => array
  150. (
  151. 'pid' => 'yes',
  152. 'use' => 'yes',
  153. 'state' => 1,
  154. ),
  155. 'type' => 'all',
  156. 'order' => array('id', 'asc'),
  157. 'limit' => '0,12',
  158. ),
  159. 'getOne' => array
  160. (
  161. # 匹配的正则或函数 选填项
  162. 'option' => array
  163. (
  164. 'pid' => 'yes',
  165. 'state' => 1,
  166. ),
  167. 'type' => 'one',
  168. 'order' => array('id', 'desc'),
  169. ),
  170. ),
  171. );