review.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '正常',
  6. 2 => '删除',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'review',
  12. # 显示给用户看的名称
  13. 'lang' => '评论',
  14. # 是否显示在后台菜单
  15. 'menu' => false,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'order' => 'desc',
  27. //'list' => true,
  28. ),
  29. 'posts_id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => '主题',
  33. 'update' => 'hidden',
  34. 'default' => Dever::input('option_posts_id'),
  35. 'desc' => '请输入主题',
  36. 'match' => 'is_string',
  37. //'list' => true,
  38. ),
  39. 'floor' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '楼层',
  43. 'update' => 'hidden',
  44. 'default' => '1',
  45. 'desc' => '请输入楼层',
  46. 'match' => 'is_string',
  47. 'order' => 'asc',
  48. 'list' => '"{floor}楼"',
  49. ),
  50. 'uid' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '作者',
  54. 'default' => '0',
  55. 'desc' => '请选择作者',
  56. 'match' => 'is_numeric',
  57. //'update' => 'select',
  58. //'search' => 'select',
  59. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  60. ),
  61. 'content' => array
  62. (
  63. 'type' => 'text-255',
  64. 'name' => '内容',
  65. 'update' => 'editor',
  66. 'key' => 1,
  67. 'default' => '',
  68. 'desc' => '请输入内容',
  69. 'match' => 'is_string',
  70. 'search' => 'fulltext',
  71. 'list' => 'table',
  72. 'modal' => '查看详情',
  73. ),
  74. 'ip' => array
  75. (
  76. 'type' => 'varchar-32',
  77. 'name' => 'IP',
  78. 'default' => '',
  79. 'desc' => '请输入IP',
  80. 'match' => 'option',
  81. 'update' => 'text',
  82. //'search' => 'fulltext',
  83. 'list' => true,
  84. ),
  85. 'num_up' => array
  86. (
  87. 'type' => 'int-11',
  88. 'name' => '赞数',
  89. 'default' => '0',
  90. 'desc' => '请填写赞数',
  91. 'match' => 'option',
  92. //'search' => 'order',
  93. //'list' => '"赞数:{num_up}<br />浏览量:{num_view}+{num_add_view}<br />回复数:{num_review}<br />"',
  94. //'list_name' => '统计数字',
  95. ),
  96. 'num_review' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '回复数',
  100. 'default' => '0',
  101. 'desc' => '请填写回复数',
  102. 'search' => 'order',
  103. 'match' => 'option',
  104. //'list' => true,
  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. ),
  129. # request 请求接口定义
  130. 'request' => array
  131. (
  132. # info 取一条正常的数据
  133. 'info' => array
  134. (
  135. # 匹配的正则或函数 必填项
  136. 'where' => array
  137. (
  138. 'floor' => 'yes',
  139. 'state' => 1,
  140. ),
  141. 'type' => 'one',
  142. ),
  143. # 取总数
  144. /*
  145. 'total' => array
  146. (
  147. # 匹配的正则或函数 必填项
  148. 'where' => array
  149. (
  150. 'posts_id' => 'yes',
  151. 'state' => 1,
  152. ),
  153. 'type' => 'count',
  154. ),
  155. */
  156. # 根据分页排序,取出最新的分页
  157. 'new' => array
  158. (
  159. # 匹配的正则或函数 选填项
  160. 'where' => array
  161. (
  162. 'posts_id' => 'yes',
  163. ),
  164. 'type' => 'all',
  165. 'order' => array('floor', 'desc'),
  166. 'limit' => array(1, 0),
  167. 'col' => 'floor',
  168. ),
  169. # 更新回复数
  170. 'addReview' => array
  171. (
  172. 'type' => 'update',
  173. 'where' => array
  174. (
  175. 'id' => 'yes',
  176. ),
  177. 'set' => array
  178. (
  179. 'num_review' => array('1', '+='),
  180. ),
  181. ),
  182. # 更新点赞数
  183. 'addUp' => array
  184. (
  185. 'type' => 'update',
  186. 'where' => array
  187. (
  188. 'id' => 'yes',
  189. ),
  190. 'set' => array
  191. (
  192. 'num_up' => array('1', '+='),
  193. ),
  194. ),
  195. # 更新点赞数
  196. 'desUp' => array
  197. (
  198. 'type' => 'update',
  199. 'where' => array
  200. (
  201. 'id' => 'yes',
  202. ),
  203. 'set' => array
  204. (
  205. 'num_up' => array('1', '-='),
  206. ),
  207. ),
  208. ),
  209. );