info.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. $cate = function()
  3. {
  4. $array = array();
  5. $cate = Dever::load('question/cate-state');
  6. if($cate)
  7. {
  8. $array += $cate;
  9. }
  10. return $array;
  11. };
  12. $level = function()
  13. {
  14. $array = array();
  15. $cate = Dever::load('question/level-state');
  16. if($cate)
  17. {
  18. $array += $cate;
  19. }
  20. return $array;
  21. };
  22. return array
  23. (
  24. # 表名
  25. 'name' => 'info',
  26. # 显示给用户看的名称
  27. 'lang' => '题库列表',
  28. # 是否显示在后台菜单
  29. 'order' => 100,
  30. # 数据结构
  31. 'struct' => array
  32. (
  33. 'id' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => 'ID',
  37. 'default' => '',
  38. 'desc' => '',
  39. 'match' => 'is_numeric',
  40. 'order' => 'desc',
  41. 'list' => true,
  42. ),
  43. 'name' => array
  44. (
  45. 'type' => 'varchar-150',
  46. 'name' => '标题',
  47. 'default' => '',
  48. 'desc' => '标题',
  49. 'match' => 'is_string',
  50. 'update' => 'text',
  51. 'search' => 'fulltext',
  52. 'list' => true,
  53. ),
  54. 'level_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '难度',
  58. 'default' => '1',
  59. 'desc' => '难度',
  60. 'match' => 'is_numeric',
  61. 'update' => 'select',
  62. 'option' => $level,
  63. 'search' => 'select',
  64. 'list' => '{level_id} > 0 ? Dever::load("question/level-one#name", {level_id}) : "未知"',
  65. ),
  66. 'cate_id' => array
  67. (
  68. 'type' => 'int-11',
  69. 'name' => '分类',
  70. 'default' => '1',
  71. 'desc' => '请选择分类',
  72. 'match' => 'is_numeric',
  73. 'update' => 'select',
  74. 'option' => $cate,
  75. 'search' => 'select',
  76. //'search_parent' => 'info_id',//根据哪个字段来确定本搜索选项的内容
  77. 'list' => '{cate_id} > 0 ? Dever::load("question/cate-one#name", {cate_id}) : "未知"',
  78. ),
  79. 'pic' => array
  80. (
  81. 'type' => 'varchar-150',
  82. 'name' => '背景图',
  83. 'default' => '',
  84. 'desc' => '背景图',
  85. 'match' => 'option',
  86. 'update' => 'image',
  87. 'key' => '1',
  88. 'place' => '150',
  89. ),
  90. 'content' => array
  91. (
  92. 'type' => 'text-255',
  93. 'name' => '选项设置',
  94. 'default' => '',
  95. 'desc' => '选项设置',
  96. 'match' => 'is_string',
  97. 'update' => array
  98. (
  99. array
  100. (
  101. 'col' => 'score',
  102. 'name' => '选项分数-0为错误选项,大于1则为正确选项',
  103. 'default' => '0',
  104. 'desc' => '选项分数',
  105. 'match' => 'is_string',
  106. 'update' => 'text',
  107. ),
  108. array
  109. (
  110. 'col' => 'title',
  111. 'name' => '选项标题',
  112. 'default' => '',
  113. 'desc' => '请输入选项标题',
  114. 'match' => 'is_string',
  115. 'update' => 'text',
  116. ),
  117. array
  118. (
  119. 'col' => 'pic',
  120. 'name' => '选项图片',
  121. 'default' => '',
  122. 'desc' => '选项图片',
  123. 'match' => 'is_string',
  124. 'update' => 'image',
  125. 'key' => '1',
  126. ),
  127. array
  128. (
  129. 'col' => 'info',
  130. 'name' => '描述',
  131. 'default' => '',
  132. 'desc' => '请输入描述',
  133. 'match' => 'is_string',
  134. 'update' => 'textarea',
  135. ),
  136. ),
  137. ),
  138. 'state' => array
  139. (
  140. 'type' => 'tinyint-1',
  141. 'name' => '状态',
  142. 'default' => '1',
  143. 'desc' => '请选择状态',
  144. 'match' => 'is_numeric',
  145. ),
  146. 'cdate' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '录入时间',
  150. 'match' => array('is_numeric', time()),
  151. 'desc' => '',
  152. # 只有insert时才生效
  153. 'insert' => true,
  154. 'search' => 'date',
  155. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  156. ),
  157. ),
  158. 'manage' => array
  159. (
  160. ),
  161. 'request' => array
  162. (
  163. 'getAll' => array
  164. (
  165. # 匹配的正则或函数 选填项
  166. 'option' => array
  167. (
  168. 'cate_id' => array('yes', 'in'),
  169. 'ids' => array('yes-id', 'in'),
  170. 'level_id' => 'yes',
  171. 'idno' => array('yes-id', 'notin'),
  172. 'state' => 1,
  173. ),
  174. 'type' => 'all',
  175. //'limit' => '0,100000',
  176. 'col' => '*|id',
  177. ),
  178. )
  179. );