review.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. $table = array
  3. (
  4. 1 => '资讯',
  5. 2 => '课程',
  6. );
  7. return array
  8. (
  9. # 表名
  10. 'name' => 'review',
  11. # 显示给用户看的名称
  12. 'lang' => '评论',
  13. # 是否显示在后台菜单
  14. 'order' => 80,
  15. # 数据结构
  16. 'struct' => array
  17. (
  18. 'id' => array
  19. (
  20. 'type' => 'int-11',
  21. 'name' => 'ID',
  22. 'default' => '',
  23. 'desc' => '',
  24. 'match' => 'is_numeric',
  25. 'order' => 'desc',
  26. //'list' => true,
  27. ),
  28. 'uid' => array
  29. (
  30. 'type' => 'int-11',
  31. 'name' => '用户',
  32. 'default' => '0',
  33. 'desc' => '请选择用户',
  34. 'match' => 'is_numeric',
  35. //'update' => 'select',
  36. //'search' => 'select',
  37. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  38. ),
  39. 'info_id' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '所属小程序',
  43. 'default' => '1',
  44. 'desc' => '请选择所属小程序',
  45. 'match' => 'is_numeric',
  46. 'update' => 'select',
  47. 'option' => $info,
  48. 'search' => 'select',
  49. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  50. ),
  51. 'source_table' => array
  52. (
  53. 'type' => 'tinyint-1',
  54. 'name' => '评论类别',
  55. 'default' => '',
  56. 'desc' => '评论类别',
  57. 'match' => 'option',
  58. 'option' => $table,
  59. 'list' => true,
  60. ),
  61. 'source_id' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '标题',
  65. 'default' => '',
  66. 'desc' => '标题',
  67. 'match' => 'option',
  68. 'list' => '{source_table} == 1 ? Dever::load("content/news-one#name", {source_id}) : Dever::load("content/course-one#name", {source_id})',
  69. ),
  70. 'content' => array
  71. (
  72. 'type' => 'text-255',
  73. 'name' => '内容',
  74. 'update' => 'editor',
  75. 'key' => 1,
  76. 'default' => '',
  77. 'desc' => '请输入内容',
  78. 'match' => 'is_string',
  79. 'search' => 'fulltext',
  80. 'list' => 'table',
  81. 'modal' => '查看详情',
  82. ),
  83. 'ip' => array
  84. (
  85. 'type' => 'varchar-32',
  86. 'name' => 'IP',
  87. 'default' => '',
  88. 'desc' => '请输入IP',
  89. 'match' => 'option',
  90. 'update' => 'text',
  91. //'search' => 'fulltext',
  92. 'list' => true,
  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. ),
  117. # request 请求接口定义
  118. 'request' => array
  119. (
  120. 'getAll' => array
  121. (
  122. # 匹配的正则或函数 选填项
  123. 'option' => array
  124. (
  125. 'info_id' => 'yes',
  126. 'source_table' => 'yes',
  127. 'source_id' => 'yes',
  128. ),
  129. 'type' => 'all',
  130. 'order' => array('id' => 'desc'),
  131. 'page' => array(10, 'list'),
  132. 'col' => '*',
  133. ),
  134. ),
  135. );