source.php 8.4 KB

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