search.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. $status = Dever::config('base')->status;
  3. $cate = function()
  4. {
  5. $array = array();
  6. $info = Dever::db('content/cate')->select();
  7. if($info)
  8. {
  9. $array += $info;
  10. }
  11. return $array;
  12. };
  13. $type = array
  14. (
  15. 1 => '文章',
  16. 2 => '相册',
  17. 3 => '视频',
  18. );
  19. return array
  20. (
  21. # 表名
  22. 'name' => 'search',
  23. # 显示给用户看的名称
  24. 'lang' => '搜索数据',
  25. # 后台菜单排序
  26. 'order' => 7,
  27. 'menu' => false,
  28. # 数据结构
  29. 'struct' => array
  30. (
  31. 'id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => 'ID',
  35. 'default' => '',
  36. 'desc' => '',
  37. 'match' => 'is_numeric',
  38. 'search' => 'order',
  39. //'list' => true,
  40. 'order' => 'desc',
  41. ),
  42. 'cate_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '所属栏目',
  46. 'default' => '1',
  47. 'desc' => '所属栏目',
  48. 'match' => 'is_numeric',
  49. 'update' => 'select',
  50. 'option' => $cate,
  51. 'search' => 'select',
  52. 'list' => true,
  53. ),
  54. 'type' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '类型',
  58. 'default' => '1',
  59. 'desc' => '类型',
  60. 'match' => 'is_numeric',
  61. 'update' => 'radio',
  62. 'option' => $type,
  63. 'search' => 'select',
  64. 'list' => true,
  65. //'edit' => true,
  66. ),
  67. 'data_id' => array
  68. (
  69. 'type' => 'varchar-80',
  70. 'name' => '数据ID',
  71. 'default' => '',
  72. 'desc' => '数据id',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. //'search' => 'fulltext',
  76. //'list' => true,
  77. ),
  78. 'name' => array
  79. (
  80. 'type' => 'varchar-80',
  81. 'name' => '标题',
  82. 'default' => '',
  83. 'desc' => '标题',
  84. 'match' => 'is_string',
  85. 'update' => 'text',
  86. 'search' => 'fulltext',
  87. 'list' => true,
  88. ),
  89. 'status' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '发布状态',
  93. 'default' => '1',
  94. 'desc' => '发布状态',
  95. 'match' => 'is_numeric',
  96. //'update' => 'select',
  97. 'option' => $status,
  98. 'search' => 'select',
  99. 'list' => true,
  100. 'edit' => true,
  101. ),
  102. 'pdate' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => '发布时间',
  106. 'match' => 'is_numeric',
  107. 'default' => '',
  108. 'desc' => '',
  109. 'update' => 'date',
  110. 'callback' => 'maketime',
  111. 'list' => 'date("Y-m-d H:i:s", {pdate})',
  112. ),
  113. 'reorder' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '排序(数值越大越靠前)',
  117. 'default' => '1',
  118. 'desc' => '请输入排序',
  119. 'match' => 'option',
  120. //'update' => 'text',
  121. 'search' => 'order',
  122. //'list' => true,
  123. 'order' => 'desc',
  124. //'edit' => true,
  125. ),
  126. 'state' => array
  127. (
  128. 'type' => 'tinyint-1',
  129. 'name' => '状态',
  130. 'default' => '1',
  131. 'desc' => '请选择状态',
  132. 'match' => 'is_numeric',
  133. 'edit' => false,
  134. ),
  135. 'cdate' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '录入时间',
  139. 'match' => array('is_numeric', time()),
  140. 'desc' => '',
  141. # 只有insert时才生效
  142. 'insert' => true,
  143. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  144. ),
  145. ),
  146. 'manage' => array
  147. (
  148. 'delete' => false,
  149. 'edit' => false,
  150. 'insert' => false,
  151. 'mul' => true,
  152. 'list_button' => array
  153. (
  154. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?audit=1'))),
  155. ),
  156. ),
  157. # request 请求接口定义
  158. 'request' => array
  159. (
  160. 'getAll' => array
  161. (
  162. # 匹配的正则或函数 选填项
  163. 'option' => array
  164. (
  165. 'name' => array('yes', 'like'),
  166. 'cate_id' => 'yes',
  167. 'type' => 'yes',
  168. 'type_no' => array('yes-type', '!='),
  169. 'status' => 1,
  170. 'state' => 1,
  171. ),
  172. 'type' => 'all',
  173. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  174. 'page' => array(12, 'list'),
  175. 'col' => '*',
  176. ),
  177. 'getIn' => array
  178. (
  179. # 匹配的正则或函数 选填项
  180. 'option' => array
  181. (
  182. 'id' => array('yes', 'in'),
  183. ),
  184. 'type' => 'all',
  185. 'order' => array('id' => 'desc'),
  186. 'col' => '*',
  187. ),
  188. )
  189. );