source.php 9.7 KB

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