service.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. # 常用的col
  3. $col = '*';
  4. $cate = function()
  5. {
  6. $array = array();
  7. $info = Dever::db('content/service_cate')->state();
  8. if($info)
  9. {
  10. $array += $info;
  11. }
  12. return $array;
  13. };
  14. return array
  15. (
  16. # 表名
  17. 'name' => 'service',
  18. # 显示给用户看的名称
  19. 'lang' => '业务管理',
  20. 'order' => 99,
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. 'list' => true,
  32. ),
  33. 'name' => array
  34. (
  35. 'type' => 'varchar-80',
  36. 'name' => '标题',
  37. 'default' => '',
  38. 'desc' => '标题',
  39. 'match' => 'is_string',
  40. 'update' => 'text',
  41. 'list' => true,
  42. 'search' => 'fulltext',
  43. ),
  44. 'cate_id' => array
  45. (
  46. 'type' => 'int-11',
  47. 'name' => '所属分类',
  48. 'default' => '1',
  49. 'desc' => '所属分类',
  50. 'match' => 'is_numeric',
  51. 'update' => 'select',
  52. 'option' => $cate,
  53. 'search' => 'select',
  54. 'list' => true,
  55. ),
  56. 'desc' => array
  57. (
  58. 'type' => 'varchar-500',
  59. 'name' => '描述',
  60. 'default' => '',
  61. 'desc' => '描述',
  62. 'match' => 'is_string',
  63. 'update' => 'textarea',
  64. ),
  65. 'icon' => array
  66. (
  67. 'type' => 'varchar-150',
  68. 'name' => '业务图标',
  69. 'default' => '',
  70. 'desc' => '业务图标',
  71. 'match' => 'option',
  72. 'update' => 'image',
  73. 'key' => '1',
  74. 'place' => '60*60',
  75. ),
  76. 'cover' => array
  77. (
  78. 'type' => 'varchar-150',
  79. 'name' => '列表页封面图',
  80. 'default' => '',
  81. 'desc' => '列表页封面图',
  82. 'match' => 'option',
  83. 'update' => 'image',
  84. 'key' => '1',
  85. 'place' => '262*163',
  86. ),
  87. 'pic' => array
  88. (
  89. 'type' => 'varchar-150',
  90. 'name' => '详情页图片',
  91. 'default' => '',
  92. 'desc' => '详情页图片',
  93. 'match' => 'option',
  94. 'update' => 'image',
  95. 'key' => '1',
  96. 'place' => '836*398',
  97. ),
  98. 'content' => array
  99. (
  100. 'type' => 'text-255',
  101. 'name' => '内容',
  102. 'default' => '',
  103. 'desc' => '请输入内容',
  104. 'match' => 'is_string',
  105. 'update' => 'editor',
  106. 'key' => '1',
  107. ),
  108. 'reorder' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '排序-数值越大越靠前,相当于置顶',
  112. 'default' => '1',
  113. 'desc' => '请输入排序',
  114. 'match' => 'option',
  115. //'update' => 'text',
  116. 'search' => 'order',
  117. 'list' => true,
  118. 'order' => 'desc',
  119. 'edit' => true,
  120. ),
  121. 'state' => array
  122. (
  123. 'type' => 'tinyint-1',
  124. 'name' => '状态',
  125. 'default' => '1',
  126. 'desc' => '请选择状态',
  127. 'match' => 'is_numeric',
  128. ),
  129. 'cdate' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '录入时间',
  133. 'match' => array('is_numeric', time()),
  134. 'desc' => '',
  135. # 只有insert时才生效
  136. 'insert' => true,
  137. 'list' => 'date("Y-m-d H:i", {cdate})',
  138. ),
  139. ),
  140. # 管理功能
  141. 'manage' => array
  142. (
  143. 'lang' => 'name,desc,content',
  144. # 自定义快捷新增和编辑
  145. 'button' => array
  146. (
  147. '分类配置' => array('list', 'service_cate&project=content&oper_parent=service&oper_project=content'),
  148. ),
  149. # 列表
  150. 'list_button' => array
  151. (
  152. //'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
  153. ),
  154. ),
  155. # request 请求接口定义
  156. 'request' => array
  157. (
  158. 'search' => array
  159. (
  160. # 匹配的正则或函数 选填项
  161. 'option' => array
  162. (
  163. 'ids' => array('yes-id', 'in'),
  164. 'cate_id' => 'yes',
  165. 'name' => array('yes', 'like'),
  166. 'id' => 'yes',
  167. 'state' => 1,
  168. ),
  169. 'type' => 'all',
  170. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  171. 'limit' => '0,10',
  172. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  173. ),
  174. 'getFive' => array
  175. (
  176. # 匹配的正则或函数 选填项
  177. 'option' => array
  178. (
  179. 'state' => 1,
  180. ),
  181. 'type' => 'all',
  182. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  183. 'limit' => '0,5',
  184. 'col' => '*',
  185. ),
  186. ),
  187. );