source.php 10.0 KB

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