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 1/2] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=AF=AD=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); From 66096cc393e133a8c7986053b240fcb595ae4499 Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Mon, 17 Aug 2020 10:20:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CouponSettingController.php | 80 +++++++++++++++++++ app/Admin/Repositories/CouponSetting.php | 16 ++++ app/Models/CouponSetting.php | 16 ++++ resources/lang/zh-CN/coupon-setting.php | 16 ++++ 4 files changed, 128 insertions(+) create mode 100644 app/Admin/Controllers/CouponSettingController.php create mode 100644 app/Admin/Repositories/CouponSetting.php create mode 100644 app/Models/CouponSetting.php create mode 100644 resources/lang/zh-CN/coupon-setting.php diff --git a/app/Admin/Controllers/CouponSettingController.php b/app/Admin/Controllers/CouponSettingController.php new file mode 100644 index 0000000..6e03881 --- /dev/null +++ b/app/Admin/Controllers/CouponSettingController.php @@ -0,0 +1,80 @@ +id->sortable(); + $grid->name; + $grid->category; + $grid->value; + $grid->desc; + $grid->sort; + $grid->status; + $grid->created_at; + $grid->updated_at->sortable(); + + $grid->filter(function (Grid\Filter $filter) { + $filter->equal('id'); + + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new CouponSetting(), function (Show $show) { + $show->id; + $show->name; + $show->category; + $show->value; + $show->desc; + $show->sort; + $show->status; + $show->created_at; + $show->updated_at; + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new CouponSetting(), function (Form $form) { + $form->display('id'); + $form->text('name'); + $form->text('category'); + $form->text('value'); + $form->text('desc'); + $form->text('sort'); + $form->text('status'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Repositories/CouponSetting.php b/app/Admin/Repositories/CouponSetting.php new file mode 100644 index 0000000..2270a10 --- /dev/null +++ b/app/Admin/Repositories/CouponSetting.php @@ -0,0 +1,16 @@ + [ + 'CouponSetting' => 'CouponSetting', + ], + 'fields' => [ + 'name' => '名称', + 'category' => '分类', + 'value' => '值', + 'desc' => '描述', + 'sort' => '排序', + 'status' => '状态', + ], + 'options' => [ + ], +];