Statindustry.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. use think\facade\Db;
  6. /**
  7. * ============================================================================
  8. *
  9. * ============================================================================
  10. *
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Statindustry extends AdminControl
  17. {
  18. public function initialize()
  19. {
  20. parent::initialize(); // TODO: Change the autogenerated stub
  21. include_once root_path() . 'extend/mall/statistics.php';
  22. include_once root_path() . 'extend/mall/datehelper.php';
  23. Lang::load(base_path() . 'admin/lang/' . config('lang.default_lang') . '/stat.lang.php');
  24. $stat_model = model('stat');
  25. //存储参数
  26. $this->search_arr = input('param.');
  27. //处理搜索时间
  28. if (in_array(request()->action(), array('scale', 'rank', 'price'))) {
  29. $this->search_arr = $stat_model->dealwithSearchTime($this->search_arr);
  30. //获得系统年份
  31. $year_arr = getSystemYearArr();
  32. //获得系统月份
  33. $month_arr = getSystemMonthArr();
  34. //获得本月的周时间段
  35. $week_arr = getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
  36. View::assign('year_arr', $year_arr);
  37. View::assign('month_arr', $month_arr);
  38. View::assign('week_arr', $week_arr);
  39. }
  40. View::assign('search_arr', $this->search_arr);
  41. /**
  42. * 处理商品分类
  43. */
  44. $show_depth = 3; //select需要展示的深度
  45. if (in_array(request()->action(), array('scale', 'general'))) { //仅显示前两级分类
  46. $show_depth = 2;
  47. }
  48. $gcid = input('param.choose_gcid');
  49. $this->choose_gcid = $gcid > 0 ? $gcid : 0;
  50. $gccache_arr = model('goodsclass')->getGoodsclassCache($this->choose_gcid, $show_depth);
  51. $this->gc_arr = $gccache_arr['showclass'];
  52. View::assign('gc_json', json_encode($gccache_arr['showclass']));
  53. View::assign('gc_choose_json', json_encode($gccache_arr['choose_gcid']));
  54. }
  55. /**
  56. * 行业规模
  57. */
  58. public function scale()
  59. {
  60. if (!isset($this->search_arr['search_type'])) {
  61. $this->search_arr['search_type'] = 'day';
  62. }
  63. $stat_model = model('stat');
  64. //获得搜索的开始时间和结束时间
  65. $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
  66. View::assign('searchtime', implode('|', $searchtime_arr));
  67. $this->setAdminCurItem('scale');
  68. return View::fetch();
  69. }
  70. /**
  71. * 行业规模列表
  72. */
  73. public function scale_list()
  74. {
  75. //获得子分类ID
  76. $gc_childid = $gc_childarr = array();
  77. if (input('param.choose_gcid') > 0) { //如果进行了分类搜索,则统计该分类下的子分类
  78. $gc_childdepth = $this->gc_arr[input('param.choose_gcid')]['depth'] + 1;
  79. $gc_childid = explode(',', $this->gc_arr[input('param.choose_gcid')]['child']);
  80. if ($gc_childid) {
  81. foreach ((array)$this->gc_arr as $k => $v) {
  82. if (in_array($v['gc_id'], $gc_childid)) {
  83. $gc_childarr[$v['gc_id']] = $v;
  84. }
  85. }
  86. }
  87. } else { //如果没有搜索分类,则默认统计一级分类
  88. $gc_childdepth = 1;
  89. foreach ((array)$this->gc_arr as $k => $v) {
  90. if ($v['depth'] == 1) {
  91. $gc_childarr[$v['gc_id']] = $v;
  92. }
  93. }
  94. }
  95. if ($gc_childarr) {
  96. $stat_model = model('stat');
  97. $stat_list = array();
  98. //构造横轴数据
  99. foreach ($gc_childarr as $k => $v) {
  100. $stat_list[$k]['gc_name'] = $v['gc_name'];
  101. $stat_list[$k]['y'] = 0;
  102. }
  103. $where = array();
  104. $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
  105. $searchtime_arr_tmp = explode('|', input('param.t'));
  106. foreach ((array)$searchtime_arr_tmp as $k => $v) {
  107. $searchtime_arr[] = intval($v);
  108. }
  109. $where[] = array('order_add_time', 'between', $searchtime_arr);
  110. if ($this->choose_gcid > 0) {
  111. $where[] = array('gc_parentid_' . ($gc_childdepth - 1), '=', $this->choose_gcid);
  112. }
  113. $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id';
  114. $stattype = input('param.stattype');
  115. switch ($stattype) {
  116. case 'ordernum':
  117. $caption = lang('statstore_ordernum');
  118. $field .= ',COUNT(DISTINCT order_id) as ordernum';
  119. $orderby = 'ordernum desc';
  120. break;
  121. case 'goodsnum':
  122. $caption = lang('goodsnum');
  123. $field .= ',SUM(goods_num) as goodsnum';
  124. $orderby = 'goodsnum desc';
  125. break;
  126. default:
  127. $stattype = 'orderamount';
  128. $caption = lang('statstore_orderamount');
  129. $field .= ',SUM(goods_pay_price) as orderamount';
  130. $orderby = 'orderamount desc';
  131. break;
  132. }
  133. $orderby .= ',statgc_id asc';
  134. $goods_list = $stat_model->statByStatordergoods($where, $field, 0, 0, $orderby, 'statgc_id');
  135. foreach ((array)$goods_list as $k => $v) {
  136. $statgc_id = intval($v['statgc_id']);
  137. if (in_array($statgc_id, array_keys($gc_childarr))) {
  138. $stat_list[$statgc_id]['gc_name'] = strval($gc_childarr[$v['statgc_id']]['gc_name']);
  139. } else {
  140. $stat_list[$statgc_id]['gc_name'] = lang('other');
  141. }
  142. switch ($stattype) {
  143. case 'orderamount':
  144. $stat_list[$statgc_id]['y'] = floatval($v[$stattype]);
  145. break;
  146. default:
  147. $stat_list[$statgc_id]['y'] = intval($v[$stattype]);
  148. break;
  149. }
  150. }
  151. //构造横轴数据
  152. foreach ($stat_list as $k => $v) {
  153. //数据
  154. $stat_arr['series'][0]['data'][] = array('name' => strval($v['gc_name']), 'y' => $v['y']);
  155. //横轴
  156. $stat_arr['xAxis']['categories'][] = strval($v['gc_name']);
  157. }
  158. //得到统计图数据
  159. $stat_arr['series'][0]['name'] = $caption;
  160. $stat_arr['title'] = sprintf(lang('industry_statis'), $caption);
  161. $stat_arr['legend']['enabled'] = false;
  162. $stat_arr['yAxis']['title']['text'] = $caption;
  163. $stat_arr['yAxis']['title']['align'] = 'high';
  164. $statjson = getStatData_Basicbar($stat_arr);
  165. View::assign('stat_json', $statjson);
  166. View::assign('stattype', $stattype);
  167. echo View::fetch('stat_linelabels');
  168. }
  169. }
  170. /**
  171. * 行业排行
  172. */
  173. public function rank()
  174. {
  175. if (!isset($this->search_arr['search_type'])) {
  176. $this->search_arr['search_type'] = 'day';
  177. }
  178. $stat_model = model('stat');
  179. //获得搜索的开始时间和结束时间
  180. $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
  181. $where = array();
  182. $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
  183. $where[] = array('order_add_time', 'between', $searchtime_arr);
  184. if ($this->choose_gcid > 0) {
  185. $gc_id_depth = $this->gc_arr[$this->choose_gcid]['depth'];
  186. $where[] = array('gc_parentid_' . $gc_id_depth, '=', $this->choose_gcid);
  187. }
  188. /**
  189. * 商品排行
  190. */
  191. $goods_stat_arr = array();
  192. //构造横轴数据
  193. for ($i = 1; $i <= 50; $i++) {
  194. //数据
  195. $goods_stat_arr['series'][0]['data'][] = array('name' => '', 'y' => 0);
  196. //横轴
  197. $goods_stat_arr['xAxis']['categories'][] = "$i";
  198. }
  199. $field = 'goods_id,goods_name,SUM(goods_num) as goodsnum';
  200. $goods_list = $stat_model->statByStatordergoods($where, $field, 0, 50, 'goodsnum desc,goods_id asc', 'goods_id');
  201. foreach ((array)$goods_list as $k => $v) {
  202. $goods_stat_arr['series'][0]['data'][$k] = array('name' => strval($v['goods_name']), 'y' => floatval($v['goodsnum']));
  203. }
  204. //得到统计图数据
  205. $goods_stat_arr['series'][0]['name'] = lang('goodsnum');
  206. $goods_stat_arr['title'] = lang('statindustry_top_50');
  207. $goods_stat_arr['legend']['enabled'] = false;
  208. $goods_stat_arr['yAxis'] = lang('goodsnum');
  209. $goods_statjson = getStatData_Column2D($goods_stat_arr);
  210. /**
  211. * 店铺排行
  212. */
  213. $store_stat_arr = array();
  214. //构造横轴数据
  215. for ($i = 1; $i <= 30; $i++) {
  216. //数据
  217. $store_stat_arr['series'][0]['data'][] = array('name' => '', 'y' => 0);
  218. //横轴
  219. $store_stat_arr['xAxis']['categories'][] = "$i";
  220. }
  221. $field = 'store_id,store_name,COUNT(DISTINCT order_id) as ordernum';
  222. $store_list = $stat_model->statByStatordergoods($where, $field, 0, 30, 'ordernum desc,store_id asc', 'store_id');
  223. foreach ((array)$store_list as $k => $v) {
  224. $store_stat_arr['series'][0]['data'][$k] = array('name' => strval($v['store_name']), 'y' => floatval($v['ordernum']));
  225. }
  226. //得到统计图数据
  227. $store_stat_arr['series'][0]['name'] = lang('statstore_ordernum');
  228. $store_stat_arr['title'] = lang('statindustry_top_30');
  229. $store_stat_arr['legend']['enabled'] = false;
  230. $store_stat_arr['yAxis'] = lang('statstore_ordernum');
  231. $store_statjson = getStatData_Column2D($store_stat_arr);
  232. View::assign('goods_statjson', $goods_statjson);
  233. View::assign('goods_list', $goods_list);
  234. View::assign('store_statjson', $store_statjson);
  235. View::assign('store_list', $store_list);
  236. $this->setAdminCurItem('rank');
  237. return View::fetch();
  238. }
  239. /**
  240. * 价格分布
  241. */
  242. public function price()
  243. {
  244. if (!isset($this->search_arr['search_type'])) {
  245. $this->search_arr['search_type'] = 'day';
  246. }
  247. $stat_model = model('stat');
  248. //获得搜索的开始时间和结束时间
  249. $searchtime_arr = $stat_model->getStarttimeAndEndtime($this->search_arr);
  250. $where = array();
  251. $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
  252. $where[] = array('order_add_time', 'between', $searchtime_arr);
  253. if ($this->choose_gcid > 0) {
  254. $gc_id_depth = $this->gc_arr[$this->choose_gcid]['depth'];
  255. $where[] = array('gc_parentid_' . $gc_id_depth, '=', $this->choose_gcid);
  256. }
  257. $field = '1';
  258. $pricerange_arr = ($t = trim(config('ds_config.stat_orderpricerange'))) ? unserialize($t) : '';
  259. if ($pricerange_arr) {
  260. $goodsnum_stat_arr['series'][0]['name'] = lang('goodsnum');
  261. $orderamount_stat_arr['series'][0]['name'] = lang('statstore_orderamount');
  262. //设置价格区间最后一项,最后一项只有开始值没有结束值
  263. $pricerange_count = count($pricerange_arr);
  264. if ($pricerange_arr[$pricerange_count - 1]['e']) {
  265. $pricerange_arr[$pricerange_count]['s'] = $pricerange_arr[$pricerange_count - 1]['e'] + 1;
  266. $pricerange_arr[$pricerange_count]['e'] = '';
  267. }
  268. foreach ((array)$pricerange_arr as $k => $v) {
  269. $v['s'] = intval($v['s']);
  270. $v['e'] = intval($v['e']);
  271. //构造查询字段
  272. if ($v['e']) {
  273. $field .= ",SUM(IF(goods_pay_price/goods_num > {$v['s']} and goods_pay_price/goods_num <= {$v['e']},goods_num,0)) as goodsnum_{$k}";
  274. $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']} and goods_pay_price/goods_num <= {$v['e']},goods_pay_price,0)) as orderamount_{$k}";
  275. } else { //由于最后一个区间没有结束值,所以需要单独构造sql
  276. $field .= ",SUM(IF(goods_pay_price/goods_num > {$v['s']},goods_num,0)) as goodsnum_{$k}";
  277. $field .= " ,SUM(IF(goods_pay_price/goods_num > {$v['s']},goods_pay_price,0)) as orderamount_{$k}";
  278. }
  279. }
  280. $ordergooods_list = Db::query('SELECT ' . $field . ' FROM ' . config('database.connections.mysql.prefix') . 'statordergoods WHERE order_isvalid=1 AND order_add_time BETWEEN ' . $searchtime_arr[0] . ' AND ' . $searchtime_arr[1] . ($this->choose_gcid > 0 ? (' AND gc_parentid_' . $gc_id_depth . '=' . $this->choose_gcid) : ''));
  281. if ($ordergooods_list) {
  282. $ordergooods_list = current($ordergooods_list);
  283. foreach ((array)$pricerange_arr as $k => $v) {
  284. //横轴
  285. if ($v['e']) {
  286. $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'] . '-' . $v['e'];
  287. $orderamount_stat_arr['xAxis']['categories'][] = $v['s'] . '-' . $v['e'];
  288. } else {
  289. $goodsnum_stat_arr['xAxis']['categories'][] = $v['s'] . lang('above');
  290. $orderamount_stat_arr['xAxis']['categories'][] = $v['s'] . lang('above');
  291. }
  292. //统计图数据
  293. $goodsnum_stat_arr['series'][0]['data'][$k] = 0;
  294. $orderamount_stat_arr['series'][0]['data'][$k] = 0;
  295. if (isset($ordergooods_list['goodsnum_' . $k])) {
  296. $goodsnum_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['goodsnum_' . $k]);
  297. }
  298. if (isset($ordergooods_list['orderamount_' . $k])) {
  299. $orderamount_stat_arr['series'][0]['data'][$k] = intval($ordergooods_list['orderamount_' . $k]);
  300. }
  301. }
  302. }
  303. //得到统计图数据
  304. $goodsnum_stat_arr['legend']['enabled'] = false;
  305. $goodsnum_stat_arr['title'] = lang('industry_goods_number');
  306. $goodsnum_stat_arr['yAxis'] = '';
  307. $orderamount_stat_arr['legend']['enabled'] = false;
  308. $orderamount_stat_arr['title'] = lang('industry_order_amount');
  309. $orderamount_stat_arr['yAxis'] = '';
  310. $goodsnum_stat_json = getStatData_LineLabels($goodsnum_stat_arr);
  311. $orderamount_stat_json = getStatData_LineLabels($orderamount_stat_arr);
  312. } else {
  313. $goodsnum_stat_json = '';
  314. $orderamount_stat_json = '';
  315. }
  316. View::assign('goodsnum_stat_json', $goodsnum_stat_json);
  317. View::assign('orderamount_stat_json', $orderamount_stat_json);
  318. $this->setAdminCurItem('price');
  319. return View::fetch();
  320. }
  321. /**
  322. * 销售统计
  323. */
  324. public function general()
  325. {
  326. $this->setAdminCurItem('general');
  327. return View::fetch();
  328. }
  329. /**
  330. * 概况总览
  331. */
  332. public function general_list()
  333. {
  334. $ordergoods_list = array();
  335. //获得子分类ID
  336. $gc_childid = $gc_childarr = array();
  337. if ($this->choose_gcid > 0) {
  338. $gc_childdepth = $this->gc_arr[$this->choose_gcid]['depth'] + 1;
  339. $gc_childid = explode(',', $this->gc_arr[$this->choose_gcid]['child']);
  340. if ($gc_childid) {
  341. foreach ((array)$this->gc_arr as $k => $v) {
  342. if (in_array($v['gc_id'], $gc_childid)) {
  343. $gc_childarr[$v['gc_id']] = $v;
  344. }
  345. }
  346. }
  347. } else { //如果没有搜索分类,则默认统计一级分类
  348. $gc_childdepth = 1;
  349. foreach ((array)$this->gc_arr as $k => $v) {
  350. if ($v['depth'] == 1) {
  351. $gc_childarr[$v['gc_id']] = $v;
  352. }
  353. }
  354. }
  355. $statlist = array();
  356. if ($gc_childarr) {
  357. $stat_model = model('stat');
  358. //查询订单商品信息
  359. $where = array();
  360. $where[] = array('order_isvalid', '=', 1); //计入统计的有效订单
  361. //计算开始时间和结束时间
  362. $searchtime_arr[1] = strtotime(date('Y-m-d', TIMESTAMP)) - 1; //昨天23:59点
  363. $searchtime_arr[0] = $searchtime_arr[1] - (86400 * 30) + 1; //从昨天开始30天前
  364. $where[] = array('order_add_time', 'between', $searchtime_arr);
  365. //halt($this->choose_gcid);
  366. if ($this->choose_gcid > 0) {
  367. $where[] = array('gc_parentid_' . ($gc_childdepth - 1), '=', $this->choose_gcid);
  368. }
  369. $field = 'gc_parentid_' . $gc_childdepth . ' as statgc_id,COUNT(DISTINCT goods_id) as ordergcount,SUM(goods_num) as ordergnum,SUM(goods_pay_price) as orderamount';
  370. $ordergoods_list_tmp = $stat_model->statByStatordergoods($where, $field, 0, 0, '', 'gc_parentid_' . $gc_childdepth);
  371. foreach ((array)$ordergoods_list_tmp as $k => $v) {
  372. $ordergoods_list[$v['statgc_id']] = $v;
  373. }
  374. //查询商品信息
  375. $field = 'gc_id_' . $gc_childdepth . ' as statgc_id,COUNT(*) as goodscount,AVG(goods_price) as priceavg';
  376. $goods_list_tmp = $stat_model->statByGoods(array('is_virtual' => 0), $field, 0, 0, '', 'gc_id_' . $gc_childdepth);
  377. foreach ((array)$goods_list_tmp as $k => $v) {
  378. $goods_list[$v['statgc_id']] = $v;
  379. }
  380. //将订单和商品数组合并
  381. $statlist_tmp = array();
  382. foreach ($gc_childarr as $k => $v) {
  383. $tmp = array();
  384. $tmp['statgc_id'] = $v['gc_id'];
  385. $tmp['gc_name'] = $v['gc_name'];
  386. $tmp['ordergcount'] = isset($ordergoods_list[$v['gc_id']]['ordergcount']) ? $ordergoods_list[$v['gc_id']]['ordergcount'] : 0;
  387. $tmp['ordergnum'] = isset($ordergoods_list[$v['gc_id']]['ordergnum']) ? $ordergoods_list[$v['gc_id']]['ordergnum'] : 0;
  388. $tmp['orderamount'] = isset($ordergoods_list[$v['gc_id']]['orderamount']) ? $ordergoods_list[$v['gc_id']]['orderamount'] : 0;
  389. $tmp['goodscount'] = isset($goods_list[$v['gc_id']]['goodscount']) ? $goods_list[$v['gc_id']]['goodscount'] : 0;
  390. $tmp['priceavg'] = ds_price_format(isset($goods_list[$v['gc_id']]['priceavg']) ? $goods_list[$v['gc_id']]['priceavg'] : 0);
  391. $tmp['unordergcount'] = intval($tmp['goodscount']) - intval($tmp['ordergcount']); //计算无销量商品数
  392. $statlist_tmp[] = $tmp;
  393. }
  394. $statlist = array();
  395. //整理排序
  396. $orderby = isset($this->search_arr['orderby']) ? trim($this->search_arr['orderby']) : '';
  397. if (!$orderby) {
  398. $orderby = 'orderamount desc';
  399. }
  400. $orderkeys = explode(' ', $orderby);
  401. $keysvalue = $new_array = array();
  402. foreach ($statlist_tmp as $k => $v) {
  403. $keysvalue[$k] = $v[$orderkeys[0]];
  404. }
  405. if ($orderkeys[1] == 'asc') {
  406. asort($keysvalue);
  407. } else {
  408. arsort($keysvalue);
  409. }
  410. reset($keysvalue);
  411. foreach ($keysvalue as $k => $v) {
  412. $statlist[$k] = $statlist_tmp[$k];
  413. }
  414. //导出Excel
  415. if (isset($this->search_arr['exporttype']) && $this->search_arr['exporttype'] == 'excel') {
  416. //列表header
  417. $statheader = array();
  418. $statheader[] = array('text' => lang('ds_goodsclass'), 'key' => 'gc_name');
  419. $statheader[] = array('text' => lang('average_price') . '(' . lang('ds_yuan') . ')', 'key' => 'priceavg', 'isorder' => 1);
  420. $statheader[] = array('text' => lang('have_sale_goods_number'), 'key' => 'ordergcount', 'isorder' => 1);
  421. $statheader[] = array('text' => lang('ds_order_sn'), 'key' => 'ordergnum', 'isorder' => 1);
  422. $statheader[] = array('text' => lang('stattrade_order_amount') . '(' . lang('ds_yuan') . ')', 'key' => 'orderamount', 'isorder' => 1);
  423. $statheader[] = array('text' => lang('industry_goods_total'), 'key' => 'goodscount', 'isorder' => 1);
  424. $statheader[] = array('text' => lang('no_sale_goods_number'), 'key' => 'unordergcount', 'isorder' => 1);
  425. //导出Excel
  426. $excel_obj = new \excel\Excel();
  427. $excel_data = array();
  428. //设置样式
  429. $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
  430. //header
  431. foreach ($statheader as $k => $v) {
  432. $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
  433. }
  434. //data
  435. foreach ($statlist as $k => $v) {
  436. foreach ($statheader as $h_k => $h_v) {
  437. $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
  438. }
  439. }
  440. $excel_data = $excel_obj->charset($excel_data, CHARSET);
  441. $excel_obj->addArray($excel_data);
  442. $excel_obj->addWorksheet($excel_obj->charset(lang('industry_state_view'), CHARSET));
  443. $excel_obj->generateXML($excel_obj->charset(lang('industry_state_view'), CHARSET) . date('Y-m-d-H', TIMESTAMP));
  444. exit();
  445. }
  446. }
  447. //列表header
  448. $statheader = array();
  449. $statheader[] = array('text' => lang('ds_goodsclass'), 'key' => 'gc_name');
  450. $statheader[] = array('text' => '<span title="' . lang('goods_class_average_goods_price') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('average_price') . '(' . lang('ds_yuan') . ')', 'key' => 'priceavg', 'isorder' => 1);
  451. $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_number_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('have_sale_goods_number'), 'key' => 'ordergcount', 'isorder' => 1);
  452. $statheader[] = array('text' => '<span title="' . lang('industry_goods_total_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('ds_order_sn'), 'key' => 'ordergnum', 'isorder' => 1);
  453. $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_amount_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('stattrade_order_amount') . '(' . lang('ds_yuan') . ')', 'key' => 'orderamount', 'isorder' => 1);
  454. $statheader[] = array('text' => '<span title="' . lang('goods_class_goods_number') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('industry_goods_total'), 'key' => 'goodscount', 'isorder' => 1);
  455. $statheader[] = array('text' => '<span title="' . lang('have_sale_goods_number_recent') . '" class="tip iconfont">&#xe71c;</span>&nbsp;' . lang('no_sale_goods_number'), 'key' => 'unordergcount', 'isorder' => 1);
  456. View::assign('statheader', $statheader);
  457. View::assign('statlist', $statlist);
  458. View::assign('orderby', $orderby);
  459. View::assign('actionurl', (string)url('Statindustry' . '/' . request()->action(), ['choose_gcid' => $this->choose_gcid]));
  460. echo View::fetch('listandorder');
  461. exit;
  462. }
  463. protected function getAdminItemList()
  464. {
  465. $menu_array = array(
  466. array(
  467. 'name' => 'scale', 'text' => lang('stat_industryscale'), 'url' => (string)url('Statindustry/scale')
  468. ), array(
  469. 'name' => 'rank', 'text' => lang('stat_industryrank'), 'url' => (string)url('Statindustry/rank')
  470. ), array(
  471. 'name' => 'price', 'text' => lang('stat_industryprice'), 'url' => (string)url('Statindustry/price')
  472. ), array(
  473. 'name' => 'general', 'text' => lang('stat_industrygeneral'), 'url' => (string)url('Statindustry/general')
  474. )
  475. );
  476. return $menu_array;
  477. }
  478. }