review.php 2.8 KB

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