stat.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. 'hb' => array
  64. (
  65. 'type' => 'varchar-11',
  66. 'name' => '新增环比增长率',
  67. 'default' => '0',
  68. 'desc' => '新增环比增长率',
  69. 'match' => 'option',
  70. 'update' => 'text',
  71. 'list' => 'Dever::load("passport/lib/manage.getHb", "{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. //'search' => 'date',
  90. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  91. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  92. ),
  93. ),
  94. 'manage' => array
  95. (
  96. 'delete' => false,
  97. 'edit' => false,
  98. 'insert' => false,
  99. 'chart' => array
  100. (
  101. 'x' => 'day',
  102. 'data' => array('user'),
  103. ),
  104. 'data' => array
  105. (
  106. array('用户总量', function() {return Dever::db('passport/user')->total();}),
  107. array('今日新增用户量', function() {list($start, $end) = Dever::day();return Dever::db('passport/user')->total(array('start' => $start, 'end' => $end));}),
  108. array('昨日新增用户量', function() {list($start, $end) = Dever::day(1);return Dever::db('passport/user')->total(array('start' => $start, 'end' => $end));}),
  109. array('本月新增用户量', function() {list($start, $end) = Dever::month();return Dever::db('passport/user')->total(array('start' => $start, 'end' => $end));}),
  110. ),
  111. ),
  112. 'request' => array
  113. (
  114. # 获取总金额
  115. 'getAll' => array
  116. (
  117. # 匹配的正则或函数 选填项
  118. 'option' => array
  119. (
  120. 'start' => array('yes-day', '>='),
  121. 'end' => array('yes-day', '<='),
  122. 'state' => 1,
  123. ),
  124. 'type' => 'all',
  125. 'col' => '*',
  126. ),
  127. 'prev' => array
  128. (
  129. # 匹配的正则或函数 选填项
  130. 'option' => array
  131. (
  132. 'day' => array('yes-day', '<'),
  133. //'start_day' => array('yes-day', '>='),
  134. //'end_day' => array('yes-day', '<='),
  135. 'state' => 1,
  136. ),
  137. 'order' => array('day' => 'desc', 'id' => 'desc'),
  138. 'type' => 'one',
  139. 'col' => '*',
  140. # 允许自定义以上配置
  141. 'config' => true,
  142. ),
  143. ),
  144. );