info.php 5.6 KB

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