From 16d9635ea5131f3a84307f1c23d57b598c05ace9 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Sat, 23 Feb 2019 10:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=BB=9F=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/StatisticalService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/service/StatisticalService.php b/application/service/StatisticalService.php index ff793fdf4..954bcf20c 100644 --- a/application/service/StatisticalService.php +++ b/application/service/StatisticalService.php @@ -415,10 +415,11 @@ class StatisticalService // 获取热销商品 $where = [ - ['add_time', '>=', self::$seven_time_start], - ['add_time', '<=', self::$seven_time_end], + ['o.status', '<=', 4], + ['o.add_time', '>=', self::$seven_time_start], + ['o.add_time', '<=', self::$seven_time_end], ]; - $data = Db::name('OrderDetail')->where($where)->field('title AS name,sum(buy_number) AS value')->order('value desc')->limit(10)->group('goods_id')->select(); + $data = Db::name('Order')->alias('o')->join(['__ORDER_DETAIL__'=>'od'], 'o.id=od.order_id')->where($where)->field('od.title AS name,sum(od.buy_number) AS value')->order('value desc')->limit(10)->group('od.goods_id')->select(); if(!empty($data)) { foreach($data as &$v)