From 225b15d750e4e4841c6a48a991702e1d54ec7345 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Fri, 28 Jan 2022 23:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/StatisticalService.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/service/StatisticalService.php b/app/service/StatisticalService.php index ae55c7c85..d44a35d3b 100755 --- a/app/service/StatisticalService.php +++ b/app/service/StatisticalService.php @@ -249,7 +249,6 @@ class StatisticalService // 上月 $where = [ - ['status', '<=', 4], ['add_time', '>=', self::$last_month_time_start], ['add_time', '<=', self::$last_month_time_end], ]; @@ -257,7 +256,6 @@ class StatisticalService // 当月 $where = [ - ['status', '<=', 4], ['add_time', '>=', self::$this_month_time_start], ['add_time', '<=', self::$this_month_time_end], ]; @@ -718,10 +716,10 @@ class StatisticalService if(!empty($data)) { + $names = Db::name('OrderDetail')->where('goods_id', 'in', array_column($data, 'goods_id'))->group('goods_id')->column('title', 'goods_id'); foreach($data as &$v) { - // 获取商品名称(这里不一次性读取、为了兼容 mysql 5.7+版本) - $v['name'] = Db::name('OrderDetail')->where('goods_id', $v['goods_id'])->value('title'); + $v['name'] = $names[$v['goods_id']]; if(mb_strlen($v['name'], 'utf-8') > 12) { $v['name'] = mb_substr($v['name'], 0, 12, 'utf-8').'...';