user.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?php
  2. $status = array
  3. (
  4. 1 => '未开始',
  5. 2 => '正在答题',
  6. 3 => '中止答题',//也算完成
  7. 4 => '完成答题',
  8. );
  9. return array
  10. (
  11. # 表名
  12. 'name' => 'user',
  13. # 显示给用户看的名称
  14. 'lang' => '用户参与表',
  15. # 是否显示在后台菜单
  16. 'menu' => false,
  17. # 数据结构
  18. 'struct' => array
  19. (
  20. 'id' => array
  21. (
  22. 'type' => 'int-11',
  23. 'name' => 'ID',
  24. 'default' => '',
  25. 'desc' => '',
  26. 'match' => 'is_numeric',
  27. 'order' => 'desc',
  28. 'list' => true,
  29. ),
  30. 'uid' => array
  31. (
  32. 'type' => 'varchar-150',
  33. 'name' => '用户',
  34. 'default' => '',
  35. 'desc' => '用户id',
  36. 'match' => 'is_string',
  37. 'update' => 'text',
  38. 'search' => 'fulltext',
  39. 'list' => true,
  40. ),
  41. 'exam_id' => array
  42. (
  43. 'type' => 'int-11',
  44. 'name' => '活动',
  45. 'default' => '1',
  46. 'desc' => '活动id',
  47. 'match' => 'is_numeric',
  48. 'list' => '{exam_id} > 0 ? Dever::load("question/exam-one#name", {exam_id}) : "未知"',
  49. ),
  50. 'info_ids' => array
  51. (
  52. 'type' => 'varchar-300',
  53. 'name' => '题库ID列表',
  54. 'default' => '',
  55. 'desc' => '题库ID列表',
  56. 'match' => 'option',
  57. 'update' => 'textarea',
  58. //'list' => true,
  59. ),
  60. 'score' => array
  61. (
  62. 'type' => 'int-11',
  63. 'name' => '当前得分',
  64. 'default' => '0',
  65. 'desc' => '当前得分',
  66. 'match' => 'option',
  67. 'update' => 'text',
  68. 'list' => true,
  69. ),
  70. 'num' => array
  71. (
  72. 'type' => 'int-11',
  73. 'name' => '题目数量',
  74. 'default' => '0',
  75. 'desc' => '题目数量',
  76. 'match' => 'is_string',
  77. 'update' => 'text',
  78. ),
  79. 'times' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '答题次数',
  83. 'default' => '0',
  84. 'desc' => '答题次数',
  85. 'match' => 'is_string',
  86. 'update' => 'text',
  87. 'list' => true,
  88. ),
  89. 'user_info_ids' => array
  90. (
  91. 'type' => 'varchar-300',
  92. 'name' => '答过的题目id列表',
  93. 'default' => '',
  94. 'desc' => '答过的题目id列表',
  95. 'match' => 'option',
  96. 'update' => 'textarea',
  97. //'list' => true,
  98. ),
  99. 'index' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '答题进度',
  103. 'default' => '0',
  104. 'desc' => '答题进度',
  105. 'match' => 'option',
  106. 'update' => 'textarea',
  107. 'list' => true,
  108. ),
  109. 'status' => array
  110. (
  111. 'type' => 'tinyint-1',
  112. 'name' => '答题状态',
  113. 'default' => '1',
  114. 'desc' => '答题状态',
  115. 'match' => 'is_numeric',
  116. //'update' => 'radio',
  117. 'option' => $status,
  118. 'control' => 'type',
  119. 'list' => true,
  120. ),
  121. 'state' => array
  122. (
  123. 'type' => 'tinyint-1',
  124. 'name' => '状态',
  125. 'default' => '1',
  126. 'desc' => '请选择状态',
  127. 'match' => 'is_numeric',
  128. ),
  129. 'cdate' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '更新时间',
  133. 'match' => array('is_numeric', time()),
  134. 'desc' => '',
  135. # 只有insert时才生效
  136. //'insert' => true,
  137. 'search' => 'date',
  138. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  139. ),
  140. ),
  141. 'manage' => array
  142. (
  143. 'insert' => false,
  144. 'edit' => false,
  145. 'delete' => false,
  146. ),
  147. 'request' => array
  148. (
  149. # 获取最新一条的用户信息
  150. 'get' => array
  151. (
  152. # 匹配的正则或函数 选填项
  153. 'where' => array
  154. (
  155. 'uid' => 'yes',
  156. 'state' => 1,
  157. ),
  158. 'type' => 'one',
  159. 'order' => array('times' => 'desc', 'id' => 'desc'),
  160. 'col' => '*',
  161. ),
  162. # 获取已完成记录
  163. 'getFinish' => array
  164. (
  165. # 匹配的正则或函数 选填项
  166. 'where' => array
  167. (
  168. 'status' => array('yes', '>='),
  169. 'exam_id' => 'yes',
  170. 'uid' => 'yes',
  171. 'state' => 1,
  172. ),
  173. 'type' => 'one',
  174. 'order' => array('times' => 'desc', 'id' => 'desc'),
  175. 'col' => 'times,status',
  176. ),
  177. # 获取未完成记录
  178. 'getUnFinish' => array
  179. (
  180. # 匹配的正则或函数 选填项
  181. 'where' => array
  182. (
  183. 'status' => array('yes', '<'),
  184. 'exam_id' => 'yes',
  185. 'uid' => 'yes',
  186. 'state' => 1,
  187. ),
  188. 'type' => 'one',
  189. 'col' => '*',
  190. ),
  191. )
  192. );