From 406eb26cc2ccc2d95ec49f70f8c6de1cbeaece57 Mon Sep 17 00:00:00 2001 From: devil Date: Tue, 8 Sep 2020 23:36:30 +0800 Subject: [PATCH] cj --- application/admin/controller/Index.php | 12 ++--- .../admin/view/default/index/init.html | 24 ++++----- application/service/GoodsService.php | 22 ++++---- application/service/StatisticalService.php | 7 +-- extend/base/Excel.php | 53 ++++++++----------- .../static/admin/default/css/index.init.css | 2 +- 6 files changed, 55 insertions(+), 65 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index a41523185..10205e24b 100755 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -86,19 +86,19 @@ class Index extends Common $order_complete_money = StatisticalService::OrderCompleteMoneyYesterdayTodayTotal(); $this->assign('order_complete_money', $order_complete_money['data']); - // 近30日成交金额走势 + // 近30日订单成交金额走势 $order_profit_chart = StatisticalService::OrderProfitSevenTodayTotal(); $this->assign('order_profit_chart', $order_profit_chart['data']); - // 近15日订单交易走势 + // 近30日订单交易走势 $order_trading_trend = StatisticalService::OrderTradingTrendSevenTodayTotal(); $this->assign('order_trading_trend', $order_trading_trend['data']); - // 近15日订单支付方式 - $order_type_number = StatisticalService::OrderPayTypeSevenTodayTotal(); - $this->assign('order_type_number', $order_type_number['data']); + // 近30日支付方式 + $pay_type_number = StatisticalService::PayTypeSevenTodayTotal(); + $this->assign('pay_type_number', $pay_type_number['data']); - // 近15日热销商品 + // 近30日热销商品 $goods_hot_sale = StatisticalService::GoodsHotSaleSevenTodayTotal(); $this->assign('goods_hot_sale', $goods_hot_sale['data']); diff --git a/application/admin/view/default/index/init.html b/application/admin/view/default/index/init.html index 22afdae47..d0658b691 100755 --- a/application/admin/view/default/index/init.html +++ b/application/admin/view/default/index/init.html @@ -73,11 +73,11 @@ - +
- 近30日成交金额走势 + 近30日订单成交金额走势
@@ -103,12 +103,12 @@
  • - +
    - 近30日订单支付方式 + 近30日支付方式
    -
    +
  • @@ -167,7 +167,7 @@ '; - echo ''; - die; + return DataReturn('文件为空', -1); } + $file = empty($file) ? $_FILES['file']['tmp_name'] : $file; // 取得文件基础数据 - $reader = \PHPExcel_IOFactory::createReader('Excel5'); + $reader = \PHPExcel_IOFactory::createReader($this->writer_type); $excel = $reader->load($file); // 取得总行数 @@ -250,42 +247,34 @@ class Excel $highest_column_index = \PHPExcel_Cell::columnIndexFromString($highest_column); // 定义变量 - $result = []; - $field = []; + $data = []; + $title = []; // 读取数据 for($row=1; $row<=$highest_row; $row++) { - // 临时数据 - $info = []; - // 注意 highest_column_index 的列数索引从0开始 + $info = []; for($col = 0; $col < $highest_column_index; $col++) { - $value = $worksheet->getCellByColumnAndRow($col, $row)->getFormattedValue(); + $value = trim($worksheet->getCellByColumnAndRow($col, $row)->getFormattedValue()); if($row == 1) { - foreach($this->title as $tk=>$tv) - { - if($value == $tv['name']) - { - $tv['field'] = $tk; - $field[$col] = $tv; - } - } + $title[] = $value; } else { - if(!empty($field)) - { - $info[$field[$col]['field']] = ($field[$col]['type'] == 'int') ? trim(ScienceNumToString($value)) : trim($value); - } + $info[] = $value; } } if($row > 1) { - $result[] = $info; + $data[] = $info; } } - return $result; + $result = [ + 'title' => $title, + 'data' => $data, + ]; + return DataReturn('处理成功', 0, $result); } } ?> \ No newline at end of file diff --git a/public/static/admin/default/css/index.init.css b/public/static/admin/default/css/index.init.css index c1c10351e..0ff7cc201 100755 --- a/public/static/admin/default/css/index.init.css +++ b/public/static/admin/default/css/index.init.css @@ -136,7 +136,7 @@ html, body { /** * 支付方式 */ -#echarts-order-pay-type { +#echarts-pay-type { margin-top: 10px; height: 400px; }