journal.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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. $zhou = Dever::input('search_zhou');
  34. if ($zhou) {
  35. $group = 'cate_id';
  36. } else {
  37. $group = 'day_int,cate_id';
  38. }
  39. $list = array
  40. (
  41. # 匹配的正则或函数 选填项
  42. 'option' => array
  43. (
  44. 'start_day_int' => array('yes-day_int', '>='),
  45. 'end_day_int' => array('yes-day_int', '<='),
  46. 'cate_id' => 'yes',
  47. 'journal_id' => 'yes',
  48. 'state' => 1,
  49. ),
  50. 'type' => 'all',
  51. 'order' => array('day_int' => 'desc', 'id' => 'desc'),
  52. 'group' => $group,
  53. 'page' => array(20, 'list'),
  54. //'col' => 'id,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,day_int,day_string,cate_id',
  55. 'col' => 'id,sum(order_yes_num) as order_yes_num,sum(buy_num) as buy_num,sum(buy_cash) as buy_cash,cdate,journal_id,day_int,day_string,cate_id',
  56. );
  57. //$search = Dever::input('search_option_journal_id');
  58. $search = Dever::input('search_linkage_cate_journal');
  59. $groupState = false;
  60. if ($search) {
  61. if ($search != -1 && isset($search[1]) && $search[1] > 0) {
  62. $list['option']['journal_id'] = $search[1];
  63. Dever::setInput('search_option_journal_id', $search[1]);
  64. } elseif (isset($search[0]) && $search[0] == -1) {
  65. Dever::setInput('search_option_journal_id', 0);
  66. $groupState = true;
  67. } else {
  68. $groupState = true;
  69. }
  70. } else {
  71. $groupState = true;
  72. }
  73. if (!$zhou && !$groupState) {
  74. unset($list['group']);
  75. $list['col'] = '*';
  76. }
  77. if ($auth) {
  78. $list['option']['cate_id'] = array($auth, 'in');
  79. }
  80. return array
  81. (
  82. # 表名
  83. 'name' => 'journal',
  84. # 显示给用户看的名称
  85. 'lang' => '电子刊订单统计',
  86. 'order' => '10',
  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. 'cate_journal' => array
  123. (
  124. 'name' => '电子刊',
  125. 'default' => '',
  126. 'desc' => '电子刊',
  127. 'search' => 'linkage',
  128. 'search_col' => 'cate_id,product_id',
  129. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  130. ),
  131. 'cate_id' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => '电子刊分类',
  135. 'default' => '1',
  136. 'desc' => '电子刊分类',
  137. 'match' => 'is_numeric',
  138. 'update' => 'select',
  139. 'option' => $cate,
  140. //'search' => 'select',
  141. 'list' => true,
  142. ),
  143. 'journal_id' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '电子刊',
  147. 'default' => '',
  148. 'desc' => '电子刊',
  149. 'match' => 'is_numeric',
  150. 'update' => 'select',
  151. //'search' => 'select',
  152. 'option' => $journal,
  153. 'list' => $zhou ? false : 'Dever::load("stat/lib/manage.info", {journal_id})',
  154. ),
  155. 'order_num' => array
  156. (
  157. 'type' => 'int-11',
  158. 'name' => '总订单',
  159. 'default' => '0',
  160. 'match' => '总订单数',
  161. 'match' => 'is_numeric',
  162. 'update' => 'text',
  163. //'list' => true,
  164. ),
  165. 'order_yes_num' => array
  166. (
  167. 'type' => 'int-11',
  168. 'name' => '支付订单',
  169. 'default' => '0',
  170. 'match' => '支付订单数',
  171. 'match' => 'is_numeric',
  172. 'update' => 'text',
  173. 'list' => true,
  174. ),
  175. 'order_no_num' => array
  176. (
  177. 'type' => 'int-11',
  178. 'name' => '未支付订单',
  179. 'default' => '0',
  180. 'match' => '未支付订单数',
  181. 'match' => 'is_numeric',
  182. 'update' => 'text',
  183. //'list' => true,
  184. ),
  185. 'buy_num' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '售出本数',
  189. 'default' => '0',
  190. 'match' => '售出本数',
  191. 'match' => 'is_numeric',
  192. 'update' => 'text',
  193. 'list' => true,
  194. ),
  195. 'buy_cash' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '售出金额',
  199. 'default' => '0',
  200. 'match' => '售出金额',
  201. 'match' => 'is_numeric',
  202. 'update' => 'text',
  203. 'list' => true,
  204. ),
  205. 'state' => array
  206. (
  207. 'type' => 'tinyint-1',
  208. 'name' => '状态',
  209. 'default' => '1',
  210. 'desc' => '请选择状态',
  211. 'match' => 'is_numeric',
  212. ),
  213. 'cdate' => array
  214. (
  215. 'type' => 'int-11',
  216. 'name' => '上次统计时间',
  217. 'match' => array('is_numeric', time()),
  218. 'desc' => '',
  219. # 只有insert时才生效
  220. 'insert' => true,
  221. //'search' => 'date',
  222. 'list' => 'date("Y-m-d H:i", {cdate})',
  223. ),
  224. ),
  225. //'top' => Dever::config('base')->top,
  226. 'top_option' => array
  227. (
  228. array
  229. (
  230. 'value' => $auth,
  231. 'col' => 'cate_id',
  232. ),
  233. array
  234. (
  235. 'value' => Dever::load('manage/auth.authData'),
  236. 'col' => 'id',
  237. ),
  238. ),
  239. 'manage' => array
  240. (
  241. 'insert' => false,
  242. 'edit' => false,
  243. 'delete' => false,
  244. 'num' => false,
  245. 'excel' => true,
  246. //'page_list' => 'journal',
  247. ),
  248. 'request' => array
  249. (
  250. 'list' => $list,
  251. 'getData' => array
  252. (
  253. # 匹配的正则或函数 选填项
  254. 'option' => array
  255. (
  256. 'start' => array('yes-day_int', '>='),
  257. 'end' => array('yes-day_int', '<='),
  258. 'state' => 1,
  259. ),
  260. 'type' => 'all',
  261. 'order' => array('day_int' => 'desc'),
  262. //'group' => 'day_int',
  263. 'col' => '*',
  264. ),
  265. 'getNumByJournal' => array
  266. (
  267. # 匹配的正则或函数 选填项
  268. 'option' => array
  269. (
  270. 'journal_id' => 'yes',
  271. 'state' => 1,
  272. ),
  273. 'type' => 'one',
  274. //'group' => 'day_int',
  275. 'col' => 'sum(buy_num) as buy_num',
  276. ),
  277. ),
  278. );