From 9e32210670c0f6ead71e42397800e7b9b3169f11 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 11 Nov 2024 15:19:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(order):=20=E4=BF=AE=E5=A4=8D=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复到店时间为空时的处理逻辑 - 修改订单附件字段名称 - 增加订单商品数量和金额的验证 - 更新测试数据的商店 ID - 修正订单统计的日期字段 --- .../logic/beforehand_order/BeforehandOrderLogic.php | 11 ++++++++--- app/api/controller/IndexController.php | 2 +- app/common/logic/store_order/StoreOrderLogic.php | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 31de88987..9865fa696 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -311,10 +311,12 @@ class BeforehandOrderLogic extends BaseLogic try { $find=BeforehandOrder::where('id', $params['id'])->find(); $other_data=$find['other_data']; - $other_data['arrival_time']=strtotime($params['arrival_time']); - $find->update([ + if(!empty($params['other_data']['arrival_time'])){ + $other_data->arrival_time=$params['other_data']['arrival_time']; + } + $find->save([ 'other_data'=>json_encode($other_data, true), - 'image' => $params['image'], + 'file' => $params['file'], 'mark' => $params['mark'] ]); Db::commit(); @@ -607,6 +609,9 @@ class BeforehandOrderLogic extends BaseLogic $order = BeforehandOrder::where('id', $params['id'])->find(); $order['admin_name'] = Admin::where('id', $order['admin_id'])->value('name'); $data = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->each(function ($item) { + if($item['total_price']==0 || $item['cart_num']==0){ + throw new BusinessException('数量或金额不能为0'); + } $find = StoreProduct::where('id', $item['product_id'])->field('top_cate_id,store_name,unit')->find(); $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); $item['store_name'] = $find['store_name']; diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 905cbc2dd..ee26fd9eb 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -55,7 +55,7 @@ class IndexController extends BaseApiController { d(1); - $arr=StoreOrder::where('store_id',3)->where('paid',1)->field('id,pay_price,deduction_price,refund_price')->select()->toArray(); + $arr=StoreOrder::where('store_id',8)->where('paid',1)->field('id,pay_price,deduction_price,refund_price')->select()->toArray(); $data=[]; foreach ($arr as $k => $v) { $total_price=StoreOrderCartInfo::where('oid', $v['id'])->sum('total_price'); diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 81f4be9cf..a67acfad3 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -357,7 +357,7 @@ class StoreOrderLogic extends BaseLogic */ public function storeOrderSumByDate($start, $end, $extra = [], $field = 'pay_price') { - return StoreOrder::where($extra)->whereBetweenTime('create_time', $start, $end)->sum($field); + return StoreOrder::where($extra)->whereBetweenTime('pay_time', $start, $end)->sum($field); } /**