journal.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. $list = array
  34. (
  35. # 匹配的正则或函数 选填项
  36. 'option' => array
  37. (
  38. 'start_day_int' => array('yes-day_int', '>='),
  39. 'end_day_int' => array('yes-day_int', '<='),
  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,cate_id',
  47. 'page' => array(20, 'list'),
  48. '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',
  49. );
  50. //$search = Dever::input('search_option_journal_id');
  51. $search = Dever::input('search_linkage_cate_journal');
  52. if ($search && isset($search[1]) && $search[1] > 0) {
  53. Dever::setInput('search_option_journal_id', $search[1]);
  54. unset($list['group']);
  55. $list['col'] = '*';
  56. }
  57. if ($auth) {
  58. $list['option']['cate_id'] = array($auth, 'in');
  59. }
  60. return array
  61. (
  62. # 表名
  63. 'name' => 'journal',
  64. # 显示给用户看的名称
  65. 'lang' => '小刊订单',
  66. 'order' => '10',
  67. # 数据结构
  68. 'struct' => array
  69. (
  70. 'id' => array
  71. (
  72. 'type' => 'int-11',
  73. 'name' => 'ID',
  74. 'default' => '',
  75. 'desc' => '',
  76. 'match' => 'is_numeric',
  77. //'list' => true,
  78. ),
  79. 'day_string' => array
  80. (
  81. 'type' => 'varchar-60',
  82. 'name' => '统计日期',
  83. 'default' => '',
  84. 'desc' => '统计日期',
  85. 'match' => 'is_string',
  86. 'update' => 'text',
  87. //'search' => 'fulltext',
  88. 'list' => true,
  89. ),
  90. 'day_int' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '统计日期',
  94. 'default' => '',
  95. 'desc' => '统计日期',
  96. 'match' => 'is_numeric',
  97. 'update' => 'text',
  98. 'search' => 'time',
  99. 'order' => 'desc',
  100. //'list' => true,
  101. ),
  102. 'cate_journal' => array
  103. (
  104. 'name' => '小刊',
  105. 'default' => '',
  106. 'desc' => '小刊',
  107. 'search' => 'linkage',
  108. 'search_col' => 'cate_id,product_id',
  109. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  110. ),
  111. 'cate_id' => array
  112. (
  113. 'type' => 'int-11',
  114. 'name' => '小刊分类',
  115. 'default' => '1',
  116. 'desc' => '小刊分类',
  117. 'match' => 'is_numeric',
  118. 'update' => 'select',
  119. 'option' => $cate,
  120. //'search' => 'select',
  121. 'list' => true,
  122. ),
  123. 'journal_id' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '小刊',
  127. 'default' => '',
  128. 'desc' => '小刊',
  129. 'match' => 'is_numeric',
  130. 'update' => 'select',
  131. //'search' => 'select',
  132. 'option' => $journal,
  133. 'list' => 'Dever::load("stat/lib/manage.info", {journal_id})',
  134. ),
  135. 'order_num' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '总订单',
  139. 'default' => '0',
  140. 'match' => '总订单数',
  141. 'match' => 'is_numeric',
  142. 'update' => 'text',
  143. 'list' => true,
  144. ),
  145. 'order_yes_num' => array
  146. (
  147. 'type' => 'int-11',
  148. 'name' => '支付订单',
  149. 'default' => '0',
  150. 'match' => '支付订单数',
  151. 'match' => 'is_numeric',
  152. 'update' => 'text',
  153. 'list' => true,
  154. ),
  155. 'order_no_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. 'buy_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. 'buy_cash' => 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. 'state' => array
  186. (
  187. 'type' => 'tinyint-1',
  188. 'name' => '状态',
  189. 'default' => '1',
  190. 'desc' => '请选择状态',
  191. 'match' => 'is_numeric',
  192. ),
  193. 'cdate' => array
  194. (
  195. 'type' => 'int-11',
  196. 'name' => '上次统计时间',
  197. 'match' => array('is_numeric', time()),
  198. 'desc' => '',
  199. # 只有insert时才生效
  200. 'insert' => true,
  201. //'search' => 'date',
  202. 'list' => 'date("Y-m-d H:i", {cdate})',
  203. ),
  204. ),
  205. 'top' => Dever::config('base')->top,
  206. 'manage' => array
  207. (
  208. 'insert' => false,
  209. 'edit' => false,
  210. 'delete' => false,
  211. 'num' => false,
  212. 'excel' => true,
  213. //'page_list' => 'journal',
  214. ),
  215. 'request' => array
  216. (
  217. 'list' => $list,
  218. 'getData' => array
  219. (
  220. # 匹配的正则或函数 选填项
  221. 'option' => array
  222. (
  223. 'start' => array('yes-day_int', '>='),
  224. 'end' => array('yes-day_int', '<='),
  225. 'state' => 1,
  226. ),
  227. 'type' => 'all',
  228. 'order' => array('day_int' => 'desc'),
  229. //'group' => 'day_int',
  230. 'col' => '*',
  231. ),
  232. ),
  233. );