score.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. $table = Dever::config('base')->type;
  3. return array
  4. (
  5. # 表名
  6. 'name' => 'score',
  7. # 显示给用户看的名称
  8. 'lang' => '积分排行榜',
  9. # 是否显示在后台菜单
  10. 'order' => 1,
  11. 'menu' => false,
  12. # 数据结构
  13. 'struct' => array
  14. (
  15. 'id' => array
  16. (
  17. 'type' => 'int-11',
  18. 'name' => 'ID',
  19. 'default' => '',
  20. 'desc' => '',
  21. 'match' => 'is_numeric',
  22. 'order' => 'desc',
  23. 'list' => true,
  24. ),
  25. 'uid' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => '用户名',
  29. 'default' => '0',
  30. 'desc' => '请选择用户',
  31. 'match' => 'is_numeric',
  32. 'update' => 'text',
  33. //'search' => 'select',
  34. 'search' => array
  35. (
  36. 'api' => 'passport/user-all',
  37. 'col' => 'username',
  38. 'result' => 'id',
  39. ),
  40. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  41. ),
  42. 'type' => array
  43. (
  44. 'type' => 'tinyint-1',
  45. 'name' => '订阅类别',
  46. 'default' => '',
  47. 'desc' => '订阅类别',
  48. 'match' => 'option',
  49. 'update' => 'select',
  50. //'search' => 'select',
  51. 'option' => $table,
  52. //'list' => true,
  53. 'list_name' => '手机号',
  54. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#mobile", {uid}) : "无"',
  55. ),
  56. 'data_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '标题',
  60. 'default' => '',
  61. 'desc' => '标题',
  62. 'update' => 'text',
  63. 'match' => 'option',
  64. 'list' => 'Dever::load("act/lib/manage.load", "{type}", "{data_id}")',
  65. ),
  66. 'user_log_id' => array
  67. (
  68. 'type' => 'int-11',
  69. 'name' => '用户积分日志id',
  70. 'default' => '',
  71. 'desc' => '用户积分日志id',
  72. 'update' => 'text',
  73. 'match' => 'option',
  74. ),
  75. 'score' => array
  76. (
  77. 'type' => 'int-11',
  78. 'name' => '积分',
  79. 'default' => '',
  80. 'desc' => '积分',
  81. 'match' => 'option',
  82. 'update' => 'text',
  83. 'order' => 'desc',
  84. 'list' => true,
  85. ),
  86. 'state' => array
  87. (
  88. 'type' => 'tinyint-1',
  89. 'name' => '状态',
  90. 'default' => '1',
  91. 'desc' => '请选择状态',
  92. 'match' => 'is_numeric',
  93. ),
  94. 'cdate' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '时间',
  98. 'match' => array('is_numeric', time()),
  99. 'desc' => '',
  100. # 只有insert时才生效
  101. 'insert' => true,
  102. //'search' => 'date',
  103. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  104. ),
  105. ),
  106. 'manage' => array
  107. (
  108. 'insert' => false,
  109. 'edit' => false,
  110. 'delete' => false,
  111. 'button' => array
  112. (
  113. '导出排行榜' => array('location', 'act/lib/score.out?id=' . Dever::input('search_option_data_id')),
  114. ),
  115. ),
  116. # 更新表结构
  117. 'alter' => array
  118. (
  119. 1 => array
  120. (
  121. array('update', 'score', 'score', 'int-11 0 积分'),
  122. //array('add', 'config', 'config', 'int-11 1 配置'),
  123. ),
  124. 'version' => 1,
  125. ),
  126. # request 请求接口定义
  127. 'request' => array
  128. (
  129. 'getAll' => array
  130. (
  131. # 匹配的正则或函数 选填项
  132. 'option' => array
  133. (
  134. 'uid' => 'yes',
  135. 'data_id' => 'yes',
  136. 'type' => 'yes',
  137. 'state' => 1,
  138. ),
  139. 'type' => 'all',
  140. 'order' => array('score' => 'desc','id' => 'desc'),
  141. 'page' => array(50, 'list'),
  142. 'col' => '*',
  143. ),
  144. )
  145. );