review.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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' => '{source_table} == 1 ? Dever::load("content/news-one#name", {source_id}) : Dever::load("content/course-one#name", {source_id})',
  80. ),
  81. 'content' => array
  82. (
  83. 'type' => 'text-255',
  84. 'name' => '内容',
  85. 'update' => 'editor',
  86. 'key' => 1,
  87. 'default' => '',
  88. 'desc' => '请输入内容',
  89. 'match' => 'is_string',
  90. 'search' => 'fulltext',
  91. 'list' => 'table',
  92. 'modal' => '查看详情',
  93. ),
  94. 'state' => array
  95. (
  96. 'type' => 'tinyint-1',
  97. 'name' => '状态',
  98. 'default' => '1',
  99. 'desc' => '请选择状态',
  100. 'match' => 'is_numeric',
  101. ),
  102. 'cdate' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => '录入时间',
  106. 'match' => array('is_numeric', time()),
  107. 'desc' => '',
  108. # 只有insert时才生效
  109. 'insert' => true,
  110. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  111. ),
  112. ),
  113. 'manage' => array
  114. (
  115. 'insert' => false,
  116. 'edit' => false,
  117. ),
  118. # request 请求接口定义
  119. 'request' => array
  120. (
  121. 'getAll' => array
  122. (
  123. # 匹配的正则或函数 选填项
  124. 'option' => array
  125. (
  126. 'info_id' => 'yes',
  127. 'source_table' => 'yes',
  128. 'source_id' => 'yes',
  129. ),
  130. 'type' => 'all',
  131. 'order' => array('id' => 'desc'),
  132. 'page' => array(10, 'list'),
  133. 'col' => '*',
  134. ),
  135. ),
  136. );