source.php 9.4 KB

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