user_stat.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'user_stat',
  6. # 显示给用户看的名称
  7. 'lang' => '门店用户复购统计',
  8. 'order' => -13,
  9. # 数据结构 不同的字段放这里
  10. 'struct' => array
  11. (
  12. 'id' => array
  13. (
  14. 'type' => 'int-11',
  15. 'name' => 'ID',
  16. 'default' => '',
  17. 'desc' => '',
  18. 'match' => 'is_numeric',
  19. //'list' => true,
  20. ),
  21. 'day' => array
  22. (
  23. 'type' => 'int-11',
  24. 'name' => '日期',
  25. 'default' => '',
  26. 'match' => 'is_numeric',
  27. 'desc' => '',
  28. 'search' => 'day',
  29. 'search_button' => array
  30. (
  31. 'sum' => 'num,total,order_num',
  32. 'option' => array(
  33. 'day' => '按天',
  34. 'week' => '按周',
  35. 'month' => '按月',
  36. ),
  37. 'group' => '',
  38. ),
  39. 'order' => 'desc',
  40. 'list' => 'Dever::showDay("{day}")',
  41. ),
  42. 'shop_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '门店名称',
  46. 'default' => '',
  47. 'desc' => '门店名称',
  48. 'match' => 'is_numeric',
  49. 'search' => 'select',
  50. //'option' => $shop,
  51. 'update' => 'hidden',
  52. 'search' => 'hidden',
  53. 'search' => array
  54. (
  55. 'api' => 'shop/info-like',
  56. 'col' => 'name',
  57. 'result' => 'id',
  58. ),
  59. 'value' => Dever::input('search_option_shop_id'),
  60. //'list' => 'Dever::load("shop/info-one#name", {shop_id})',
  61. ),
  62. 'area' => array
  63. (
  64. 'type' => 'varchar-500',
  65. 'name' => '所在街道',
  66. 'default' => '',
  67. 'desc' => '所在街道',
  68. 'match' => 'option',
  69. 'search' => 'linkage',
  70. 'update' => 'linkage',
  71. 'option' => Dever::url('lib/area.get', 'shop'),
  72. //'list' => 'Dever::load("area/api.string", "{area}")',
  73. ),
  74. 'total' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => '总下单客户数',
  78. 'default' => '0',
  79. 'desc' => '总下单客户数',
  80. 'match' => 'is_numeric',
  81. 'search' => 'order',
  82. 'list' => true,
  83. ),
  84. 'num' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '重复购买人数',
  88. 'default' => '0',
  89. 'desc' => '重复购买人数',
  90. 'match' => 'is_numeric',
  91. 'search' => 'order',
  92. 'list' => true,
  93. ),
  94. 'fg' => array
  95. (
  96. 'type' => 'varchar-100',
  97. 'name' => '复购率',
  98. 'default' => '0',
  99. 'desc' => '复购率',
  100. 'match' => 'is_string',
  101. 'search' => 'order',
  102. 'list' => 'Dever::load("shop/lib/manage.getUserStat#fg", "{num}", "{total}", "{order_num}")',
  103. ),
  104. 'hb' => array
  105. (
  106. 'type' => 'varchar-100',
  107. 'name' => '复购环比',
  108. 'default' => '0',
  109. 'desc' => '复购环比',
  110. 'match' => 'option',
  111. 'update' => 'text',
  112. 'list' => 'Dever::load("shop/lib/manage.getUserHb", "{num}", "{total}", "{time}")',
  113. ),
  114. 'order_num' => array
  115. (
  116. 'type' => 'int-11',
  117. 'name' => '购买次数',
  118. 'default' => '0',
  119. 'desc' => '购买次数',
  120. 'match' => 'is_numeric',
  121. //'search' => 'order',
  122. //'list' => true,
  123. ),
  124. 'per_num' => array
  125. (
  126. 'type' => 'varchar-100',
  127. 'name' => '人均购买频次',
  128. 'default' => '0',
  129. 'desc' => '人均购买频次',
  130. 'match' => 'is_numeric',
  131. 'search' => 'order',
  132. 'list' => 'Dever::load("shop/lib/manage.getUserStat#per_num", "{num}", "{total}", "{order_num}")',
  133. ),
  134. 'state' => array
  135. (
  136. 'type' => 'tinyint-1',
  137. 'name' => '数据状态',
  138. 'default' => '1',
  139. 'desc' => '请选择状态',
  140. 'match' => 'is_numeric',
  141. ),
  142. 'cdate' => array
  143. (
  144. 'type' => 'int-11',
  145. 'name' => '发布时间',
  146. 'match' => array('is_numeric', time()),
  147. 'desc' => '',
  148. # 只有insert时才生效
  149. 'insert' => true,
  150. //'search' => 'date',
  151. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  152. ),
  153. ),
  154. 'manage' => array
  155. (
  156. 'insert' => false,
  157. 'edit' => false,
  158. 'delete' => false,
  159. 'num' => false,
  160. 'excel' => true,
  161. ),
  162. # request 请求接口定义
  163. 'request' => array
  164. (
  165. 'list' => array
  166. (
  167. # 匹配的正则或函数 选填项
  168. 'option' => array
  169. (
  170. 'shop_id' => 'yes',
  171. 'area' => array('yes', 'like'),
  172. 'start_day' => array('yes-day', '>='),
  173. 'end_day' => array('yes-day', '<='),
  174. 'state' => 1,
  175. ),
  176. 'type' => 'all',
  177. 'order' => array('time' => 'desc', 'cdate' => 'desc'),
  178. 'page' => array(20, 'list'),
  179. 'group' => 'day',
  180. 'col' => '*,min(day) as time, sum(total) as total, sum(num) as num, sum(order_num) as order_num',
  181. ),
  182. 'prev' => array
  183. (
  184. # 匹配的正则或函数 选填项
  185. 'option' => array
  186. (
  187. 'day' => array('yes-day', '<'),
  188. //'start_day' => array('yes-day', '>='),
  189. //'end_day' => array('yes-day', '<='),
  190. 'state' => 1,
  191. ),
  192. 'order' => array('time' => 'desc', 'id' => 'desc'),
  193. 'type' => 'one',
  194. 'col' => '*,min(day) as time, sum(total) as total, sum(num) as num, sum(order_num) as order_num',
  195. 'group' => 'day',
  196. # 允许自定义以上配置
  197. 'config' => true,
  198. ),
  199. ),
  200. );
  201. return $config;