From 96c278756c678cc1e5dc017396ff4af0f2afe212 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Thu, 11 Aug 2022 11:34:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/view/default/index/init.html | 2 +- app/api/controller/Goods.php | 2 +- app/service/StatisticalService.php | 62 ++++++++++++-------------- app/service/ThemeService.php | 2 +- 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/app/admin/view/default/index/init.html b/app/admin/view/default/index/init.html index bf9d04f08..f330a50e7 100755 --- a/app/admin/view/default/index/init.html +++ b/app/admin/view/default/index/init.html @@ -208,7 +208,7 @@ {{if isset($is_income) and $is_income eq true}}
  • -

    收入总计

    +

    订单总计

    0.00

    上月 diff --git a/app/api/controller/Goods.php b/app/api/controller/Goods.php index 3513702c2..61db7c983 100755 --- a/app/api/controller/Goods.php +++ b/app/api/controller/Goods.php @@ -30,7 +30,7 @@ use app\service\AppService; class Goods extends Common { /** - * [__construct 构造方法] + * 构造方法 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/service/StatisticalService.php b/app/service/StatisticalService.php index 22612bb8d..7742cf2d3 100755 --- a/app/service/StatisticalService.php +++ b/app/service/StatisticalService.php @@ -575,25 +575,22 @@ class StatisticalService $data = []; $value_arr = []; $name_arr = []; - if(!empty($status_arr)) + $date = self::DayCreate($params['start'], $params['end']); + foreach($date as $day) { - $date = self::DayCreate($params['start'], $params['end']); - foreach($date as $day) - { - // 当前日期名称 - $name_arr[] = date('Y-m-d', $day['start']); + // 当前日期名称 + $name_arr[] = date('Y-m-d', $day['start']); - // 根据状态获取数量 - foreach($status_arr as $status) - { - // 获取订单 - $where = [ - ['status', '=', $status], - ['add_time', '>=', $day['start']], - ['add_time', '<=', $day['end']], - ]; - $value_arr[$status][] = Db::name('Order')->where($where)->count(); - } + // 根据状态获取数量 + foreach($status_arr as $status) + { + // 获取订单 + $where = [ + ['status', '=', $status], + ['add_time', '>=', $day['start']], + ['add_time', '<=', $day['end']], + ]; + $value_arr[$status][] = Db::name('Order')->where($where)->count(); } } @@ -639,25 +636,22 @@ class StatisticalService // 订单收入总计、是否有收入统计权限 if(AdminIsPower('index', 'income')) { - if(!empty($status_arr)) + $date = self::DayCreate($params['start'], $params['end']); + foreach($date as $day) { - $date = self::DayCreate($params['start'], $params['end']); - foreach($date as $day) - { - // 当前日期名称 - $name_arr[] = date('Y-m-d', $day['start']); + // 当前日期名称 + $name_arr[] = date('Y-m-d', $day['start']); - // 根据状态获取数量 - foreach($status_arr as $status) - { - // 获取订单 - $where = [ - ['status', '=', $status], - ['add_time', '>=', $day['start']], - ['add_time', '<=', $day['end']], - ]; - $value_arr[$status][] = Db::name('Order')->where($where)->sum('pay_price'); - } + // 根据状态获取数量 + foreach($status_arr as $status) + { + // 获取订单 + $where = [ + ['status', '=', $status], + ['add_time', '>=', $day['start']], + ['add_time', '<=', $day['end']], + ]; + $value_arr[$status][] = Db::name('Order')->where($where)->sum('pay_price'); } } diff --git a/app/service/ThemeService.php b/app/service/ThemeService.php index 11596c866..83e456426 100755 --- a/app/service/ThemeService.php +++ b/app/service/ThemeService.php @@ -62,7 +62,7 @@ class ThemeService $default_preview = __MY_PUBLIC_URL__.'static'.DS.'common'.DS.'images'.DS.'default-preview.jpg'; while(($temp_file = readdir($dh)) !== false) { - if(substr($temp_file, 0, 1) == '.' || in_array($temp_file, ['index.html'])) + if(substr($temp_file, 0, 1) == '.' || in_array($temp_file, ['index.html']) || is_dir($temp_file)) { continue; }