info.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <?php
  2. $page = 10;
  3. $table = array
  4. (
  5. 1 => '合集',
  6. 2 => '合集章节',
  7. 3 => '合集内容',
  8. 20 => '主信息',
  9. 21 => '子信息',
  10. );
  11. $table_name = array
  12. (
  13. 1 => 'collection/info',
  14. 2 => 'collection/page',
  15. 3 => 'collection/content',
  16. 20 => 'community/info',
  17. 21 => 'community/info',
  18. );
  19. $cate = function()
  20. {
  21. $array = array();
  22. $info = Dever::load('attr/cate-state');
  23. if($info)
  24. {
  25. $array += $info;
  26. }
  27. return $array;
  28. };
  29. return array
  30. (
  31. # 表名
  32. 'name' => 'info',
  33. # 显示给用户看的名称
  34. 'lang' => '社区信息管理',
  35. # 是否显示在后台菜单
  36. 'order' => 80,
  37. 'config' => array
  38. (
  39. 'table' => $table,
  40. 'table_name' => $table_name,
  41. ),
  42. # 数据结构
  43. 'struct' => array
  44. (
  45. 'id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => 'ID',
  49. 'default' => '',
  50. 'desc' => '',
  51. 'match' => 'is_numeric',
  52. 'order' => 'desc',
  53. //'list' => true,
  54. ),
  55. 'uid' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '用户名',
  59. 'default' => '0',
  60. 'desc' => '请选择用户',
  61. 'match' => 'is_numeric',
  62. 'update' => 'text',
  63. //'search' => 'select',
  64. 'search' => array
  65. (
  66. 'api' => 'passport/user-all',
  67. 'col' => 'username',
  68. 'result' => 'id',
  69. ),
  70. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  71. ),
  72. 'cate_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '所属类别',
  76. 'default' => '1',
  77. 'desc' => '所属类别',
  78. 'match' => 'is_numeric',
  79. 'update' => 'select',
  80. 'option' => $cate,
  81. //'list' => '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
  82. ),
  83. 'type' => array
  84. (
  85. 'type' => 'tinyint-1',
  86. 'name' => '所属数据源',
  87. 'default' => '',
  88. 'desc' => '所属数据源',
  89. 'match' => 'option',
  90. 'option' => $table,
  91. 'search' => 'select',
  92. 'update' => 'select',
  93. 'list' => true,
  94. ),
  95. 'type_id' => array
  96. (
  97. 'type' => 'int-11',
  98. 'name' => '数据源id',
  99. 'default' => '',
  100. 'desc' => '数据源id',
  101. 'match' => 'option',
  102. 'update' => 'text',
  103. ),
  104. 'type_name' => array
  105. (
  106. 'type' => 'varchar-200',
  107. 'name' => '数据源标题',
  108. 'default' => '',
  109. 'desc' => '数据源标题',
  110. 'match' => 'option',
  111. 'search' => 'fulltext',
  112. 'update' => 'text',
  113. 'list' => true,
  114. ),
  115. 'num_up' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '点赞数',
  119. 'default' => '0',
  120. 'desc' => '点赞数',
  121. 'match' => 'option',
  122. //'search' => 'order',
  123. 'list' => true,
  124. ),
  125. 'num_oppose' => array
  126. (
  127. 'type' => 'int-11',
  128. 'name' => '反对数',
  129. 'default' => '0',
  130. 'desc' => '反对数',
  131. 'match' => 'option',
  132. //'search' => 'order',
  133. 'list' => true,
  134. ),
  135. 'num_comment' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '评论数',
  139. 'default' => '0',
  140. 'desc' => '评论数',
  141. 'match' => 'option',
  142. //'search' => 'order',
  143. 'list' => true,
  144. ),
  145. 'pic' => array
  146. (
  147. 'type' => 'text-255',
  148. 'name' => '图片-图片尺寸不等,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  149. 'default' => '',
  150. 'desc' => '图片',
  151. 'match' => 'is_string',
  152. 'update' => 'images',
  153. 'key' => '1',
  154. ),
  155. 'content' => array
  156. (
  157. 'type' => 'text-255',
  158. 'name' => '内容',
  159. 'update' => 'editor',
  160. 'key' => 1,
  161. 'default' => '',
  162. 'desc' => '请输入内容',
  163. 'match' => 'is_string',
  164. 'search' => 'fulltext',
  165. //'list' => 'table',
  166. //'modal' => '查看详情',
  167. 'list' => 'Dever::load("community/lib/info.content", "{content}", {id})',
  168. ),
  169. 'state' => array
  170. (
  171. 'type' => 'tinyint-1',
  172. 'name' => '状态',
  173. 'default' => '1',
  174. 'desc' => '请选择状态',
  175. 'match' => 'is_numeric',
  176. ),
  177. 'cdate' => array
  178. (
  179. 'type' => 'int-11',
  180. 'name' => '时间',
  181. 'match' => array('is_numeric', time()),
  182. 'desc' => '',
  183. # 只有insert时才生效
  184. 'insert' => true,
  185. 'search' => 'date',
  186. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  187. ),
  188. ),
  189. 'manage' => array
  190. (
  191. //'insert' => false,
  192. //'edit' => false,
  193. ),
  194. # request 请求接口定义
  195. 'request' => array
  196. (
  197. 'getAll' => array
  198. (
  199. # 匹配的正则或函数 选填项
  200. 'option' => array
  201. (
  202. 'uid' => 'yes',
  203. 'cate_id' => 'yes',
  204. 'type' => array('yes', 'in'),
  205. 'type_id' => 'yes',
  206. 'state' => 1,
  207. ),
  208. 'type' => 'all',
  209. 'order' => array('id' => 'desc'),
  210. 'page' => array($page, 'list'),
  211. 'col' => '*',
  212. ),
  213. 'getHot' => array
  214. (
  215. # 匹配的正则或函数 选填项
  216. 'option' => array
  217. (
  218. 'uid' => 'yes',
  219. 'cate_id' => 'yes',
  220. 'type' => array('yes', 'in'),
  221. 'type_id' => 'yes',
  222. 'state' => 1,
  223. ),
  224. 'type' => 'all',
  225. 'order' => array('num_comment' => 'desc', 'id' => 'desc'),
  226. 'limit' => '0,1',
  227. 'col' => '*',
  228. ),
  229. )
  230. );