info.php 4.4 KB

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