review.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. $table = array
  3. (
  4. 1 => '资讯',
  5. 2 => '课程',
  6. 3 => '会议',
  7. );
  8. $info = function()
  9. {
  10. $array = array();
  11. $info = Dever::load('set/info-state');
  12. if($info)
  13. {
  14. $array += $info;
  15. }
  16. return $array;
  17. };
  18. return array
  19. (
  20. # 表名
  21. 'name' => 'review',
  22. # 显示给用户看的名称
  23. 'lang' => '评论列表',
  24. # 是否显示在后台菜单
  25. 'order' => 80,
  26. # 数据结构
  27. 'struct' => array
  28. (
  29. 'id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => 'ID',
  33. 'default' => '',
  34. 'desc' => '',
  35. 'match' => 'is_numeric',
  36. 'order' => 'desc',
  37. //'list' => true,
  38. ),
  39. 'uid' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '用户',
  43. 'default' => '0',
  44. 'desc' => '请选择用户',
  45. 'match' => 'is_numeric',
  46. //'update' => 'select',
  47. //'search' => 'select',
  48. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  49. ),
  50. 'info_id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '所属小程序',
  54. 'default' => '1',
  55. 'desc' => '请选择所属小程序',
  56. 'match' => 'is_numeric',
  57. 'update' => 'select',
  58. 'option' => $info,
  59. 'search' => 'select',
  60. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  61. ),
  62. 'source_table' => array
  63. (
  64. 'type' => 'tinyint-1',
  65. 'name' => '评论类别',
  66. 'default' => '',
  67. 'desc' => '评论类别',
  68. 'match' => 'option',
  69. 'option' => $table,
  70. 'list' => true,
  71. ),
  72. 'source_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '标题',
  76. 'default' => '',
  77. 'desc' => '标题',
  78. 'match' => 'option',
  79. 'list' => 'Dever::load("set/manage.load", "{source_table}", {source_id})',
  80. ),
  81. 'num_up' => array
  82. (
  83. 'type' => 'int-11',
  84. 'name' => '赞数',
  85. 'default' => '0',
  86. 'desc' => '请填写赞数',
  87. 'match' => 'option',
  88. //'search' => 'order',
  89. 'list' => true,
  90. //'list' => '"赞数:{num_up}<br />浏览量:{num_view}+{num_add_view}<br />观看人数:{num_watch}<br />回复数:{num_review}<br />"',
  91. //'list_name' => '统计数字',
  92. ),
  93. 'content' => array
  94. (
  95. 'type' => 'text-255',
  96. 'name' => '内容',
  97. 'update' => 'editor',
  98. 'key' => 1,
  99. 'default' => '',
  100. 'desc' => '请输入内容',
  101. 'match' => 'is_string',
  102. 'search' => 'fulltext',
  103. 'list' => 'table',
  104. 'modal' => '查看详情',
  105. ),
  106. 'state' => array
  107. (
  108. 'type' => 'tinyint-1',
  109. 'name' => '状态',
  110. 'default' => '1',
  111. 'desc' => '请选择状态',
  112. 'match' => 'is_numeric',
  113. ),
  114. 'cdate' => array
  115. (
  116. 'type' => 'int-11',
  117. 'name' => '录入时间',
  118. 'match' => array('is_numeric', time()),
  119. 'desc' => '',
  120. # 只有insert时才生效
  121. 'insert' => true,
  122. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  123. ),
  124. ),
  125. 'manage' => array
  126. (
  127. 'insert' => false,
  128. 'edit' => false,
  129. ),
  130. # request 请求接口定义
  131. 'request' => array
  132. (
  133. 'getAll' => array
  134. (
  135. # 匹配的正则或函数 选填项
  136. 'option' => array
  137. (
  138. 'info_id' => 'yes',
  139. 'source_table' => 'yes',
  140. 'source_id' => 'yes',
  141. ),
  142. 'type' => 'all',
  143. 'order' => array('cdate' => 'desc'),
  144. 'page' => array(10, 'list'),
  145. 'col' => '*',
  146. ),
  147. # 更新点赞数
  148. 'addUp' => array
  149. (
  150. 'type' => 'update',
  151. 'where' => array
  152. (
  153. 'id' => 'yes',
  154. ),
  155. 'set' => array
  156. (
  157. 'num_up' => array('1', '+='),
  158. ),
  159. ),
  160. # 更新点赞数
  161. 'desUp' => array
  162. (
  163. 'type' => 'update',
  164. 'where' => array
  165. (
  166. 'id' => 'yes',
  167. ),
  168. 'set' => array
  169. (
  170. 'num_up' => array('1', '-='),
  171. ),
  172. ),
  173. ),
  174. );