user.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. 'order_id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => '订单',
  44. 'default' => '',
  45. 'desc' => '订单',
  46. 'match' => 'is_numeric',
  47. 'update' => 'text',
  48. ),
  49. 'uid' => array
  50. (
  51. 'type' => 'varchar-150',
  52. 'name' => '用户',
  53. 'default' => '',
  54. 'desc' => '用户id',
  55. 'match' => 'is_string',
  56. 'update' => 'text',
  57. //'search' => 'fulltext',
  58. //'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  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. 'times' => array
  71. (
  72. 'type' => 'int-11',
  73. 'name' => '答题次数',
  74. 'default' => '0',
  75. 'desc' => '答题次数',
  76. 'match' => 'is_string',
  77. 'update' => 'text',
  78. 'list' => true,
  79. ),
  80. 'index' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => '答题进度',
  84. 'default' => '0',
  85. 'desc' => '答题进度',
  86. 'match' => 'option',
  87. 'update' => 'textarea',
  88. 'list' => true,
  89. ),
  90. 'status' => array
  91. (
  92. 'type' => 'tinyint-1',
  93. 'name' => '答题状态',
  94. 'default' => '1',
  95. 'desc' => '答题状态',
  96. 'match' => 'is_numeric',
  97. //'update' => 'radio',
  98. 'option' => $status,
  99. 'control' => 'type',
  100. 'list' => true,
  101. ),
  102. 'state' => array
  103. (
  104. 'type' => 'tinyint-1',
  105. 'name' => '状态',
  106. 'default' => '1',
  107. 'desc' => '请选择状态',
  108. 'match' => 'is_numeric',
  109. ),
  110. 'cdate' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '更新时间',
  114. 'match' => array('is_numeric', time()),
  115. 'desc' => '',
  116. # 只有insert时才生效
  117. //'insert' => true,
  118. 'search' => 'date',
  119. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  120. ),
  121. ),
  122. 'manage' => array
  123. (
  124. 'insert' => false,
  125. 'edit' => false,
  126. 'delete' => false,
  127. ),
  128. 'request' => array
  129. (
  130. # 获取最新一条的用户信息
  131. 'get' => array
  132. (
  133. # 匹配的正则或函数 选填项
  134. 'where' => array
  135. (
  136. 'uid' => 'yes',
  137. 'state' => 1,
  138. ),
  139. 'type' => 'one',
  140. 'order' => array('times' => 'desc', 'id' => 'desc'),
  141. 'col' => '*',
  142. ),
  143. # 获取已完成记录
  144. 'getFinish' => array
  145. (
  146. # 匹配的正则或函数 选填项
  147. 'where' => array
  148. (
  149. 'status' => array('yes', '>='),
  150. 'exam_id' => 'yes',
  151. 'uid' => 'yes',
  152. 'state' => 1,
  153. ),
  154. 'type' => 'one',
  155. 'order' => array('times' => 'desc', 'id' => 'desc'),
  156. 'col' => 'times,status',
  157. ),
  158. # 获取未完成记录
  159. 'getUnFinish' => array
  160. (
  161. # 匹配的正则或函数 选填项
  162. 'where' => array
  163. (
  164. 'status' => array('yes', '<'),
  165. 'exam_id' => 'yes',
  166. 'uid' => 'yes',
  167. 'state' => 1,
  168. ),
  169. 'type' => 'one',
  170. 'col' => '*',
  171. ),
  172. )
  173. );