From fa19bc3127b004bd492a00bb20a87139191e5c05 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Mon, 17 Aug 2020 10:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/couponReport.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/couponReport.php b/app/Console/Commands/couponReport.php index f5e29f1..3159203 100644 --- a/app/Console/Commands/couponReport.php +++ b/app/Console/Commands/couponReport.php @@ -72,11 +72,12 @@ class couponReport extends Command ,discounts as 优惠金额 ,inventory AS 发放数量 ,inventory_use as 已领取数量 - ,IFNULL((SELECT SUM(IFNULL(number,0)) FROM ims_system_coupon_user_use WHERE system_coupon_id = coupon.id AND TO_DAYS(receive.created_at) = TO_DAYS(NOW())),0) AS 使用数量 + ,IFNULL((SELECT SUM(IFNULL(number,0)) FROM ims_system_coupon_user_use WHERE system_coupon_id = coupon.id AND TO_DAYS(use_time) = TO_DAYS(NOW())),0) AS 使用数量 FROM ims_system_coupon_user coupon LEFT JOIN ims_system_coupon_user_receive receive ON coupon.id = receive.system_coupon_user_id - WHERE receive.created_at BETWEEN ? AND ?", + WHERE receive.created_at BETWEEN ? AND ? + GROUP BY coupon.id", $where ); // 查询优惠券订单用户数据 @@ -113,7 +114,7 @@ class couponReport extends Command // $listArray[] = (array)$value; // } if($return){ - return json_encode(compact($orderTotal,$receiveCoupon,$orderList)); + // return json_encode(compact($orderTotal,$receiveCoupon,$orderList)); }else{ $this->table(['优惠券标题','使用优惠券消费总额(实付总金额)','订单总额(不包含配送费,含包装费)','配送费','优惠总金额','总订单数量'],$orderArray); $this->table(['ID','优惠券标题','满足金额','优惠金额','发放数量','已领取数量','使用数量'],$receiveArray);