seller.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. $seller = function()
  34. {
  35. $array = array();
  36. $info = Dever::db('code/seller')->state();
  37. if($info)
  38. {
  39. $array += $info;
  40. }
  41. return $array;
  42. };
  43. $zhou = Dever::input('search_zhou');
  44. if ($zhou) {
  45. $group = 'seller_id,cate_id';
  46. } else {
  47. $group = 'day_int,seller_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. 'seller_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,sum(code_num) as code_num,sum(code_yes_num) as code_yes_num,sum(code_no_num) as code_no_num,sum(code_drop_num) as code_drop_num,cdate,journal_id,seller_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,code_num,code_yes_num,code_no_num,code_drop_num,cdate,journal_id,seller_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' => 'seller',
  84. # 显示给用户看的名称
  85. 'lang' => '销售商订单',
  86. 'order' => '8',
  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. 'seller_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' => $seller,
  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. 'code_num' => array
  168. (
  169. 'type' => 'int-11',
  170. 'name' => '兑换码总数量',
  171. 'default' => '0',
  172. 'match' => '兑换码总数量',
  173. 'match' => 'is_numeric',
  174. 'update' => 'text',
  175. //'list' => true,
  176. ),
  177. 'code_yes_num' => array
  178. (
  179. 'type' => 'int-11',
  180. 'name' => '兑换码已用数',
  181. 'default' => '0',
  182. 'match' => '兑换码已用数',
  183. 'match' => 'is_numeric',
  184. 'update' => 'text',
  185. 'list' => true,
  186. ),
  187. 'code_no_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. 'code_drop_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. 'state' => array
  208. (
  209. 'type' => 'tinyint-1',
  210. 'name' => '状态',
  211. 'default' => '1',
  212. 'desc' => '请选择状态',
  213. 'match' => 'is_numeric',
  214. ),
  215. 'cdate' => array
  216. (
  217. 'type' => 'int-11',
  218. 'name' => '上次统计时间',
  219. 'match' => array('is_numeric', time()),
  220. 'desc' => '',
  221. # 只有insert时才生效
  222. 'insert' => true,
  223. //'search' => 'date',
  224. 'list' => 'date("Y-m-d H:i", {cdate})',
  225. ),
  226. ),
  227. 'top' => Dever::config('base')->top,
  228. 'manage' => array
  229. (
  230. 'insert' => false,
  231. 'edit' => false,
  232. 'delete' => false,
  233. 'num' => false,
  234. 'excel' => true,
  235. //'page_list' => 'journal',
  236. ),
  237. 'request' => array
  238. (
  239. 'list' => $list,
  240. 'getData' => array
  241. (
  242. # 匹配的正则或函数 选填项
  243. 'option' => array
  244. (
  245. 'start' => array('yes-day_int', '>='),
  246. 'end' => array('yes-day_int', '<='),
  247. 'state' => 1,
  248. ),
  249. 'type' => 'all',
  250. 'order' => array('day_int' => 'desc'),
  251. //'group' => 'day_int',
  252. 'col' => '*',
  253. ),
  254. ),
  255. );
  256. if ($search && $search > 0) {
  257. }
  258. return $config;