source.php 8.3 KB

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