source.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. $journal = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('journal/info')->state(array('buy' => 1));
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $source = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('source/info')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. $list = array
  23. (
  24. # 匹配的正则或函数 选填项
  25. 'option' => array
  26. (
  27. 'start_day_int' => array('yes-day_int', '>='),
  28. 'end_day_int' => array('yes-day_int', '<='),
  29. 'source_id' => 'yes',
  30. 'journal_id' => 'yes',
  31. 'state' => 1,
  32. ),
  33. 'type' => 'all',
  34. 'order' => array('day_int' => 'desc', 'id' => 'desc'),
  35. 'group' => 'day_int',
  36. 'page' => array(20, 'list'),
  37. 'col' => 'id,pv,uv,user_num,user_yes_num,sum(order_num) as order_num,sum(order_yes_num) as order_yes_num,sum(order_no_num) as order_no_num,sum(buy_num) as buy_num,sum(buy_cash) as buy_cash,cdate,journal_id,source_id,day_int,day_string',
  38. );
  39. $search = Dever::input('search_option_journal_id');
  40. if ($search && $search > 0) {
  41. unset($list['group']);
  42. $list['col'] = 'id,order_num,order_yes_num,order_no_num,buy_num,buy_cash,cdate,journal_id,source_id,day_int,day_string';
  43. }
  44. $config = array
  45. (
  46. # 表名
  47. 'name' => 'source',
  48. # 显示给用户看的名称
  49. 'lang' => '渠道订单',
  50. 'order' => '9',
  51. # 数据结构
  52. 'struct' => array
  53. (
  54. 'id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => 'ID',
  58. 'default' => '',
  59. 'desc' => '',
  60. 'match' => 'is_numeric',
  61. //'list' => true,
  62. ),
  63. 'day_string' => array
  64. (
  65. 'type' => 'varchar-60',
  66. 'name' => '统计日期',
  67. 'default' => '',
  68. 'desc' => '统计日期',
  69. 'match' => 'is_string',
  70. 'update' => 'text',
  71. //'search' => 'fulltext',
  72. 'list' => true,
  73. ),
  74. 'day_int' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => '统计日期',
  78. 'default' => '',
  79. 'desc' => '统计日期',
  80. 'match' => 'is_numeric',
  81. 'update' => 'text',
  82. 'search' => 'time',
  83. 'order' => 'desc',
  84. //'list' => true,
  85. ),
  86. 'source_id' => array
  87. (
  88. 'type' => 'int-11',
  89. 'name' => '渠道',
  90. 'default' => '',
  91. 'desc' => '渠道',
  92. 'match' => 'is_numeric',
  93. 'update' => 'select',
  94. 'search' => 'select',
  95. 'option' => $source,
  96. 'list' => true,
  97. ),
  98. 'journal_id' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '小刊',
  102. 'default' => '',
  103. 'desc' => '小刊',
  104. 'match' => 'is_numeric',
  105. 'update' => 'select',
  106. 'search' => 'select',
  107. 'option' => $journal,
  108. 'list' => 'Dever::load("stat/lib/manage.info", {journal_id})',
  109. ),
  110. 'pv' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => 'PV',
  114. 'default' => '0',
  115. 'match' => '落地页PV',
  116. 'match' => 'is_numeric',
  117. 'update' => 'text',
  118. 'list' => true,
  119. ),
  120. 'uv' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => 'UV',
  124. 'default' => '0',
  125. 'match' => '落地页UV',
  126. 'match' => 'is_numeric',
  127. 'update' => 'text',
  128. 'list' => true,
  129. ),
  130. 'user_num' => array
  131. (
  132. 'type' => 'int-11',
  133. 'name' => '用户量',
  134. 'default' => '0',
  135. 'match' => '用户量',
  136. 'match' => 'is_numeric',
  137. 'update' => 'text',
  138. //'list' => true,
  139. ),
  140. 'user_yes_num' => array
  141. (
  142. 'type' => 'int-11',
  143. 'name' => '用户量',
  144. 'default' => '0',
  145. 'match' => '用户授权量',
  146. 'match' => 'is_numeric',
  147. 'update' => 'text',
  148. 'list' => true,
  149. ),
  150. 'order_num' => array
  151. (
  152. 'type' => 'int-11',
  153. 'name' => '总订单',
  154. 'default' => '0',
  155. 'match' => '总订单数',
  156. 'match' => 'is_numeric',
  157. 'update' => 'text',
  158. 'list' => true,
  159. ),
  160. 'order_yes_num' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '支付订单',
  164. 'default' => '0',
  165. 'match' => '支付订单数',
  166. 'match' => 'is_numeric',
  167. 'update' => 'text',
  168. 'list' => true,
  169. ),
  170. 'order_no_num' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '未支付订单',
  174. 'default' => '0',
  175. 'match' => '未支付订单数',
  176. 'match' => 'is_numeric',
  177. 'update' => 'text',
  178. 'list' => true,
  179. ),
  180. 'buy_num' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '售出本数',
  184. 'default' => '0',
  185. 'match' => '售出本数',
  186. 'match' => 'is_numeric',
  187. 'update' => 'text',
  188. 'list' => true,
  189. ),
  190. 'buy_cash' => array
  191. (
  192. 'type' => 'int-11',
  193. 'name' => '售出金额',
  194. 'default' => '0',
  195. 'match' => '售出金额',
  196. 'match' => 'is_numeric',
  197. 'update' => 'text',
  198. 'list' => true,
  199. ),
  200. 'state' => array
  201. (
  202. 'type' => 'tinyint-1',
  203. 'name' => '状态',
  204. 'default' => '1',
  205. 'desc' => '请选择状态',
  206. 'match' => 'is_numeric',
  207. ),
  208. 'cdate' => array
  209. (
  210. 'type' => 'int-11',
  211. 'name' => '上次统计时间',
  212. 'match' => array('is_numeric', time()),
  213. 'desc' => '',
  214. # 只有insert时才生效
  215. 'insert' => true,
  216. //'search' => 'date',
  217. 'list' => 'date("Y-m-d H:i", {cdate})',
  218. ),
  219. ),
  220. 'manage' => array
  221. (
  222. 'insert' => false,
  223. 'edit' => false,
  224. 'delete' => false,
  225. 'num' => false,
  226. 'excel' => true,
  227. //'page_list' => 'journal',
  228. ),
  229. 'request' => array
  230. (
  231. 'list' => $list,
  232. 'getData' => array
  233. (
  234. # 匹配的正则或函数 选填项
  235. 'option' => array
  236. (
  237. 'start' => array('yes-day_int', '>='),
  238. 'end' => array('yes-day_int', '<='),
  239. 'state' => 1,
  240. ),
  241. 'type' => 'all',
  242. 'order' => array('day_int' => 'desc'),
  243. //'group' => 'day_int',
  244. 'col' => '*',
  245. ),
  246. ),
  247. );
  248. if ($search && $search > 0) {
  249. $config['struct']['pv']['list'] = $config['struct']['uv']['list'] = $config['struct']['user_num']['list'] = $config['struct']['user_yes_num']['list'] = false;
  250. }
  251. return $config;