user.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. 'product_id' => array
  31. (
  32. 'type' => 'int-11',
  33. 'name' => '产品',
  34. 'default' => '',
  35. 'desc' => '产品',
  36. 'match' => 'is_numeric',
  37. 'update' => 'hidden',
  38. 'value' => Dever::input('search_option_product_id')
  39. ),
  40. 'uid' => array
  41. (
  42. 'type' => 'varchar-150',
  43. 'name' => '用户',
  44. 'default' => '',
  45. 'desc' => '用户id',
  46. 'match' => 'is_string',
  47. 'update' => 'text',
  48. 'search' => 'fulltext',
  49. //'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  50. ),
  51. 'score' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => '当前得分',
  55. 'default' => '0',
  56. 'desc' => '当前得分',
  57. 'match' => 'option',
  58. 'update' => 'text',
  59. 'list' => true,
  60. ),
  61. 'times' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '答题次数',
  65. 'default' => '0',
  66. 'desc' => '答题次数',
  67. 'match' => 'is_string',
  68. 'update' => 'text',
  69. 'list' => true,
  70. ),
  71. 'index' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '答题进度',
  75. 'default' => '0',
  76. 'desc' => '答题进度',
  77. 'match' => 'option',
  78. 'update' => 'textarea',
  79. 'list' => true,
  80. ),
  81. 'status' => array
  82. (
  83. 'type' => 'tinyint-1',
  84. 'name' => '答题状态',
  85. 'default' => '1',
  86. 'desc' => '答题状态',
  87. 'match' => 'is_numeric',
  88. //'update' => 'radio',
  89. 'option' => $status,
  90. 'control' => 'type',
  91. 'list' => true,
  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. 'search' => 'date',
  110. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  111. ),
  112. ),
  113. 'manage' => array
  114. (
  115. 'insert' => false,
  116. 'edit' => false,
  117. 'delete' => false,
  118. ),
  119. 'request' => array
  120. (
  121. # 获取最新一条的用户信息
  122. 'get' => array
  123. (
  124. # 匹配的正则或函数 选填项
  125. 'where' => array
  126. (
  127. 'uid' => 'yes',
  128. 'state' => 1,
  129. ),
  130. 'type' => 'one',
  131. 'order' => array('times' => 'desc', 'id' => 'desc'),
  132. 'col' => '*',
  133. ),
  134. # 获取已完成记录
  135. 'getFinish' => array
  136. (
  137. # 匹配的正则或函数 选填项
  138. 'where' => array
  139. (
  140. 'status' => array('yes', '>='),
  141. 'exam_id' => 'yes',
  142. 'uid' => 'yes',
  143. 'state' => 1,
  144. ),
  145. 'type' => 'one',
  146. 'order' => array('times' => 'desc', 'id' => 'desc'),
  147. 'col' => 'times,status',
  148. ),
  149. # 获取未完成记录
  150. 'getUnFinish' => array
  151. (
  152. # 匹配的正则或函数 选填项
  153. 'where' => array
  154. (
  155. 'status' => array('yes', '<'),
  156. 'exam_id' => 'yes',
  157. 'uid' => 'yes',
  158. 'state' => 1,
  159. ),
  160. 'type' => 'one',
  161. 'col' => '*',
  162. ),
  163. )
  164. );