score.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. ),
  54. 'data_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '标题',
  58. 'default' => '',
  59. 'desc' => '标题',
  60. 'update' => 'text',
  61. 'match' => 'option',
  62. 'list' => 'Dever::load("act/lib/manage.load", "{type}", "{data_id}")',
  63. ),
  64. 'user_log_id' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '用户积分日志id',
  68. 'default' => '',
  69. 'desc' => '用户积分日志id',
  70. 'update' => 'text',
  71. 'match' => 'option',
  72. ),
  73. 'score' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '积分',
  77. 'default' => '',
  78. 'desc' => '积分',
  79. 'match' => 'option',
  80. 'update' => 'text',
  81. 'order' => 'desc',
  82. 'list' => true,
  83. ),
  84. 'state' => array
  85. (
  86. 'type' => 'tinyint-1',
  87. 'name' => '状态',
  88. 'default' => '1',
  89. 'desc' => '请选择状态',
  90. 'match' => 'is_numeric',
  91. ),
  92. 'cdate' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '时间',
  96. 'match' => array('is_numeric', time()),
  97. 'desc' => '',
  98. # 只有insert时才生效
  99. 'insert' => true,
  100. //'search' => 'date',
  101. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  102. ),
  103. ),
  104. 'manage' => array
  105. (
  106. 'insert' => false,
  107. 'edit' => false,
  108. 'delete' => false,
  109. ),
  110. # 更新表结构
  111. 'alter' => array
  112. (
  113. 1 => array
  114. (
  115. array('update', 'score', 'score', 'int-11 0 积分'),
  116. //array('add', 'config', 'config', 'int-11 1 配置'),
  117. ),
  118. 'version' => 1,
  119. ),
  120. # request 请求接口定义
  121. 'request' => array
  122. (
  123. 'getAll' => array
  124. (
  125. # 匹配的正则或函数 选填项
  126. 'option' => array
  127. (
  128. 'data_id' => 'yes',
  129. 'type' => 'yes',
  130. 'state' => 1,
  131. ),
  132. 'type' => 'all',
  133. 'order' => array('score' => 'desc','id' => 'desc'),
  134. 'page' => array(50, 'list'),
  135. 'col' => '*',
  136. ),
  137. )
  138. );