stat.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'stat',
  6. # 显示给用户看的名称
  7. 'lang' => '用户统计',
  8. 'order' => -100,
  9. 'menu' => false,
  10. # 数据结构
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. 'search' => 'order',
  21. //'list' => true,
  22. ),
  23. 'day' => array
  24. (
  25. 'type' => 'int-11',
  26. 'name' => '日期',
  27. 'default' => '',
  28. 'match' => 'is_numeric',
  29. 'desc' => '',
  30. 'search' => 'day',
  31. 'search_button' => array
  32. (
  33. 'sum' => 'user',
  34. 'option' => array(
  35. 'day' => '按天',
  36. 'week' => '按周',
  37. 'month' => '按月',
  38. ),
  39. ),
  40. 'order' => 'desc',
  41. 'list' => 'Dever::showDay("{day}")',
  42. ),
  43. 'user' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '新增用户量',
  47. 'default' => '0',
  48. 'desc' => '新增用户量',
  49. 'match' => 'option',
  50. 'update' => 'text',
  51. 'list' => true,
  52. ),
  53. 'order_user' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '下单用户量',
  57. 'default' => '0',
  58. 'desc' => '下单用户量',
  59. 'match' => 'option',
  60. 'update' => 'text',
  61. 'list' => Dever::config('base')->passport_stat_order ? true : false,
  62. ),
  63. 'qoq' => array
  64. (
  65. 'type' => 'varchar-11',
  66. 'name' => '新增环比增长率',
  67. 'default' => '0',
  68. 'desc' => '新增环比增长率',
  69. 'match' => 'option',
  70. 'update' => 'text',
  71. 'list' => 'Dever::load("user/lib/stat.qoq", "{user}", "{day}")',
  72. ),
  73. 'state' => array
  74. (
  75. 'type' => 'tinyint-1',
  76. 'name' => '状态',
  77. 'default' => '1',
  78. 'desc' => '请选择状态',
  79. 'match' => 'is_numeric',
  80. ),
  81. 'cdate' => array
  82. (
  83. 'type' => 'int-11',
  84. 'name' => '生成时间',
  85. 'match' => array('is_numeric', time()),
  86. 'desc' => '',
  87. # 只有insert时才生效
  88. 'insert' => true,
  89. ),
  90. ),
  91. 'manage' => array
  92. (
  93. 'delete' => false,
  94. 'edit' => false,
  95. 'insert' => false,
  96. 'chart' => array
  97. (
  98. 'x' => 'day',
  99. 'data' => array('user'),
  100. ),
  101. 'data' => array
  102. (
  103. array('用户总量', function() {return Dever::db('user/info')->total();}),
  104. array('今日新增用户量', function() {list($start, $end) = Dever::day();return Dever::db('user/info')->total(array('start' => $start, 'end' => $end));}),
  105. array('昨日新增用户量', function() {list($start, $end) = Dever::day(1);return Dever::db('user/info')->total(array('start' => $start, 'end' => $end));}),
  106. array('本月新增用户量', function() {list($start, $end) = Dever::month();return Dever::db('user/info')->total(array('start' => $start, 'end' => $end));}),
  107. ),
  108. ),
  109. 'request' => array
  110. (
  111. # 获取总金额
  112. 'getAll' => array
  113. (
  114. # 匹配的正则或函数 选填项
  115. 'option' => array
  116. (
  117. 'start' => array('yes-day', '>='),
  118. 'end' => array('yes-day', '<='),
  119. 'state' => 1,
  120. ),
  121. 'type' => 'all',
  122. 'col' => '*',
  123. ),
  124. 'prev' => array
  125. (
  126. # 匹配的正则或函数 选填项
  127. 'option' => array
  128. (
  129. 'day' => array('yes-day', '<'),
  130. //'start_day' => array('yes-day', '>='),
  131. //'end_day' => array('yes-day', '<='),
  132. 'state' => 1,
  133. ),
  134. 'order' => array('day' => 'desc', 'id' => 'desc'),
  135. 'type' => 'one',
  136. 'col' => '*',
  137. # 允许自定义以上配置
  138. 'config' => true,
  139. ),
  140. ),
  141. );