ranking_data.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. $ranking_id = Dever::input('search_option_ranking_id');
  3. $periods = function() use($ranking_id)
  4. {
  5. $array = array();
  6. $info = Dever::db('collection/ranking_periods')->state(array('ranking_id' => $ranking_id));
  7. if($info)
  8. {
  9. $array += $info;
  10. }
  11. return $array;
  12. };
  13. return array
  14. (
  15. # 表名
  16. 'name' => 'ranking_data',
  17. # 显示给用户看的名称
  18. 'lang' => '榜单数据',
  19. 'menu' => false,
  20. 'check' => 'info_id,ranking_id,uid,periods_id',
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. 'search' => 'order',
  32. 'update' => 'hidden',
  33. //'list' => true,
  34. ),
  35. 'info_id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => '合集',
  39. 'default' => '',
  40. 'desc' => '合集',
  41. 'match' => 'is_numeric',
  42. 'update' => 'hidden',
  43. 'value' => Dever::input('search_option_info_id')
  44. ),
  45. 'ranking_id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => '榜单id',
  49. 'default' => '',
  50. 'desc' => '榜单id',
  51. 'match' => 'is_numeric',
  52. 'update' => 'hidden',
  53. 'value' => Dever::input('search_option_ranking_id')
  54. ),
  55. 'uid' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '用户名',
  59. 'default' => '0',
  60. 'desc' => '请选择用户',
  61. 'match' => 'is_numeric',
  62. 'update' => 'text',
  63. //'search' => 'select',
  64. 'search' => array
  65. (
  66. 'api' => 'passport/user-all',
  67. 'col' => 'username',
  68. 'result' => 'id',
  69. ),
  70. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  71. ),
  72. 'periods_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '期数',
  76. 'default' => '1',
  77. 'desc' => '期数',
  78. 'match' => 'is_numeric',
  79. 'update' => 'select',
  80. 'option' => $periods,
  81. 'search' => 'select',
  82. 'list' => true,
  83. ),
  84. 'num' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '榜单数据',
  88. 'default' => '0',
  89. 'desc' => '榜单数据',
  90. 'match' => 'is_numeric',
  91. 'update' => 'text',
  92. 'order' => 'desc',
  93. 'list' => '"{num}"',
  94. ),
  95. 'state' => array
  96. (
  97. 'type' => 'tinyint-1',
  98. 'name' => '状态',
  99. 'default' => '1',
  100. 'desc' => '请选择状态',
  101. 'match' => 'is_numeric',
  102. ),
  103. 'cdate' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '创建时间',
  107. 'match' => array('is_numeric', time()),
  108. 'desc' => '',
  109. # 只有insert时才生效
  110. 'insert' => true,
  111. 'search' => 'date',
  112. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  113. ),
  114. ),
  115. 'manage' => array
  116. (
  117. //'insert' => false,
  118. 'delete' => false,
  119. ),
  120. 'request' => array
  121. (
  122. 'getAll' => array
  123. (
  124. # 匹配的正则或函数 选填项
  125. 'option' => array
  126. (
  127. 'uid' => 'yes',
  128. 'info_id' => 'yes',
  129. 'ranking_id' => 'yes',
  130. 'periods_id' => 'yes',
  131. 'state' => 1,
  132. ),
  133. 'type' => 'all',
  134. 'order' => array('num' => 'desc', 'cdate' => 'desc'),
  135. 'limit' => '0,20',
  136. 'col' => '*',
  137. ),
  138. ),
  139. );