func.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?php
  2. $col = function()
  3. {
  4. $array = array
  5. (
  6. -1 => array('id' => '-1', 'name' => '请选择字段',),
  7. );
  8. $info = Dever::db('page/col')->state();
  9. if($info)
  10. {
  11. $array += $info;
  12. }
  13. return $array;
  14. };
  15. $type = array
  16. (
  17. 1 => '接口',
  18. 2 => '特殊',
  19. );
  20. return array
  21. (
  22. # 表名
  23. 'name' => 'func',
  24. # 显示给用户看的名称
  25. 'lang' => '功能设置',
  26. # 后台菜单排序
  27. 'order' => 2,
  28. 'menu' => false,
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => 'ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. 'search' => 'order',
  40. 'list' => true,
  41. 'order' => 'desc',
  42. ),
  43. 'name' => array
  44. (
  45. 'type' => 'varchar-32',
  46. 'name' => '功能名称',
  47. 'default' => '',
  48. 'desc' => '功能名称',
  49. 'match' => 'is_string',
  50. 'update' => 'text',
  51. 'search' => 'fulltext',
  52. 'list' => true,
  53. ),
  54. 'type' => array
  55. (
  56. 'type' => 'tinyint-1',
  57. 'name' => '功能类型',
  58. 'default' => '1',
  59. 'desc' => '功能类型',
  60. 'match' => 'is_numeric',
  61. 'update' => 'radio',
  62. 'option' => $type,
  63. 'search' => 'select',
  64. 'list' => true,
  65. 'control' => 'type',
  66. ),
  67. 'search' => array
  68. (
  69. 'type' => 'varchar-200',
  70. 'name' => '数据检索-直接输入项目/表名即可',
  71. 'default' => '',
  72. 'desc' => '数据检索',
  73. 'match' => 'is_string',
  74. 'update' => 'textarea',
  75. //'search' => 'fulltext',
  76. //'list' => true,
  77. ),
  78. 'api' => array
  79. (
  80. 'type' => 'varchar-200',
  81. 'name' => '数据获取-如果是接口类型,这里可以直接输入http接口地址,也可以使用dever接口,如果接口返回一条数据,就为单条,如果是多条,就是列表;如果是特殊类型,直接输入类型的值即可',
  82. 'default' => '',
  83. 'desc' => '功能接口',
  84. 'match' => 'is_string',
  85. 'update' => 'textarea',
  86. //'search' => 'fulltext',
  87. //'list' => true,
  88. ),
  89. 'col' => array
  90. (
  91. 'type' => 'text-1000',
  92. 'name' => '关联字段',
  93. 'default' => '',
  94. 'desc' => '关联字段',
  95. 'match' => 'is_string',
  96. 'show' => 'type=1',
  97. 'update_type' => 2,
  98. 'update' => array
  99. (
  100. array
  101. (
  102. 'col' => 'name',
  103. 'name' => '接口原始字段名-输入上述功能接口返回的原始字段的名字',
  104. 'default' => '',
  105. 'desc' => '接口原始字段名',
  106. 'match' => 'is_string',
  107. 'update' => 'text',
  108. ),
  109. array
  110. (
  111. 'col' => 'col_id',
  112. 'name' => '关联的字段',
  113. 'default' => '',
  114. 'desc' => '关联的字段',
  115. 'match' => 'is_numeric',
  116. 'update' => 'select',
  117. 'option' => $col,
  118. ),
  119. ),
  120. ),
  121. 'reorder' => array
  122. (
  123. 'type' => 'int-11',
  124. 'name' => '排序-数值越小越靠前',
  125. 'default' => '1',
  126. 'desc' => '请输入排序',
  127. 'match' => 'option',
  128. 'update' => 'text',
  129. 'search' => 'order',
  130. 'list' => true,
  131. 'order' => 'asc',
  132. 'edit' => true,
  133. ),
  134. 'state' => array
  135. (
  136. 'type' => 'tinyint-1',
  137. 'name' => '状态',
  138. 'default' => '1',
  139. 'desc' => '请选择状态',
  140. 'match' => 'is_numeric',
  141. ),
  142. 'cdate' => array
  143. (
  144. 'type' => 'int-11',
  145. 'name' => '录入时间',
  146. 'match' => array('is_numeric', time()),
  147. 'desc' => '',
  148. # 只有insert时才生效
  149. 'insert' => true,
  150. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  151. ),
  152. ),
  153. 'manage' => array
  154. (
  155. 'delete' => false,
  156. 'insert' => false,
  157. 'edit' => false,
  158. # 自定义快捷新增和编辑
  159. 'button' => array
  160. (
  161. '新增' => array('fast'),
  162. ),
  163. # 快捷更新
  164. 'list_button' => array
  165. (
  166. 'edit' => array('编辑'),
  167. ),
  168. ),
  169. 'request' => array
  170. (
  171. 'state' => array
  172. (
  173. # 匹配的正则或函数 选填项
  174. 'option' => array
  175. (
  176. 'state' => 1,
  177. ),
  178. 'type' => 'all',
  179. 'order' => array('reorder' => 'asc','id' => 'desc'),
  180. 'col' => '*|id',
  181. ),
  182. 'getAll' => array
  183. (
  184. # 匹配的正则或函数 选填项
  185. 'option' => array
  186. (
  187. 'state' => 1,
  188. # 小程序去掉视频栏目
  189. 'id_no' => array('yes-id', '!='),
  190. ),
  191. 'type' => 'all',
  192. 'order' => array('reorder' => 'asc','id' => 'desc'),
  193. 'col' => '*',
  194. ),
  195. ),
  196. );