user_task.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. $status = array
  3. (
  4. 1 => '进行中',
  5. 2 => '已提交报告',
  6. 3 => '已完成一次报告',
  7. 4 => '已完成',
  8. 9 => '冻结',
  9. );
  10. $company = function()
  11. {
  12. $array = array();
  13. $info = Dever::load('task/company-state');
  14. if($info)
  15. {
  16. $array += $info;
  17. }
  18. return $array;
  19. };
  20. $cate = function()
  21. {
  22. $array = array();
  23. $info = Dever::load('task/cate-state');
  24. if($info)
  25. {
  26. $array += $info;
  27. }
  28. return $array;
  29. };
  30. $level = function()
  31. {
  32. $array = array();
  33. $info = Dever::load('task/level-state');
  34. if($info)
  35. {
  36. $array += $info;
  37. }
  38. return $array;
  39. };
  40. return array
  41. (
  42. # 表名
  43. 'name' => 'user_task',
  44. # 显示给用户看的名称
  45. 'lang' => '用户任务',
  46. 'menu' => 'passport',
  47. 'order' => 100,
  48. # 数据结构
  49. 'struct' => array
  50. (
  51. 'id' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => 'ID',
  55. 'default' => '',
  56. 'desc' => '',
  57. 'match' => 'is_numeric',
  58. //'search' => 'order',
  59. 'order' => 'desc',
  60. 'list' => true,
  61. ),
  62. 'uid' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '用户名',
  66. 'default' => '',
  67. 'desc' => '用户名',
  68. 'match' => 'is_numeric',
  69. //'update' => 'text',
  70. 'search' => array
  71. (
  72. 'api' => 'passport/user-all',
  73. 'col' => 'username',
  74. 'result' => 'id',
  75. ),
  76. 'list' => 'Dever::load("passport/user-one#username", {uid})',
  77. ),
  78. 'task_id' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '任务名',
  82. 'default' => '-1',
  83. 'desc' => '任务名',
  84. 'match' => 'is_numeric',
  85. //'update' => 'select',
  86. 'search' => array
  87. (
  88. 'api' => 'task/info-all',
  89. 'col' => 'name',
  90. 'result' => 'id',
  91. ),
  92. 'list' => '{task_id} > 0 ? Dever::load("task/info-one#name", {task_id}) : "系统"',
  93. ),
  94. 'company_id' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '商家',
  98. 'default' => '-1',
  99. 'desc' => '商家',
  100. 'match' => 'is_numeric',
  101. //'update' => 'select',
  102. 'search' => 'select',
  103. 'option' => $company,
  104. 'list' => true,
  105. ),
  106. 'cate_id' => array
  107. (
  108. 'type' => 'int-11',
  109. 'name' => '类别',
  110. 'default' => '-1',
  111. 'desc' => '类别',
  112. 'match' => 'is_numeric',
  113. //'update' => 'select',
  114. 'search' => 'select',
  115. 'option' => $cate,
  116. 'list' => true,
  117. ),
  118. 'level_id' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '等级',
  122. 'default' => '-1',
  123. 'desc' => '等级',
  124. 'match' => 'is_numeric',
  125. //'update' => 'select',
  126. 'search' => 'select',
  127. 'option' => $level,
  128. 'list' => true,
  129. ),
  130. 'status' => array
  131. (
  132. 'type' => 'tinyint-1',
  133. 'name' => '状态',
  134. 'default' => '1',
  135. 'desc' => '状态',
  136. 'match' => 'is_numeric',
  137. 'update' => 'select',
  138. 'option' => $status,
  139. //'search' => 'select',
  140. //'list' => true,
  141. //'edit' => true,
  142. ),
  143. 'state' => array
  144. (
  145. 'type' => 'tinyint-1',
  146. 'name' => '状态',
  147. 'default' => '1',
  148. 'desc' => '请选择状态',
  149. 'match' => 'is_numeric',
  150. ),
  151. 'cdate' => array
  152. (
  153. 'type' => 'int-11',
  154. 'name' => '领取时间',
  155. 'match' => array('is_numeric', time()),
  156. 'desc' => '',
  157. # 只有insert时才生效
  158. 'insert' => true,
  159. 'search' => 'date',
  160. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  161. ),
  162. ),
  163. 'manage' => array
  164. (
  165. 'insert' => false,
  166. 'edit' => false,
  167. 'delete' => false,
  168. ),
  169. 'request' => array
  170. (
  171. 'getAll' => array
  172. (
  173. 'where' => array
  174. (
  175. 'uid' => 'yes',
  176. 'state' => 1,
  177. 'status' => 'yes-t_2.status',
  178. ),
  179. 'join' => array
  180. (
  181. array
  182. (
  183. 'table' => 'task/info',
  184. 'type' => 'left join',
  185. 'on' => array('task_id','id'),
  186. 'col' => 't_2.id as id',
  187. ),
  188. ),
  189. 'type' => 'all',
  190. 'page' => array(15, 'list'),
  191. 'order' => array('t_2.reorder' => 'desc', 't_2.edate' => 'asc'),
  192. 'col' => 'id,t_2.*,t_1.uid',
  193. ),
  194. )
  195. );