From 79fdbef9d3e4dd2a25e9aa3056eef3524f92f292 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 7 Sep 2023 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A7=94=E6=89=98=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=94=9F=E6=88=90=E8=AE=A2=E5=8D=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderCreateRepository.php | 2 +- .../store/order/StoreOrderRepository.php | 14 +++++++++++++- app/listener/OrderCreate.php | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 443f98b4..8d7d1976 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -247,7 +247,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository } $svip_discount = 0; $realPrice = $this->cartByPrice($cart); - if ($cart['product_type'] == 98) { + if ($cart['product_type'] == 98 || $cart['product_type'] == 99) { $cart['product']['price'] = $realPrice; $cart['productAttr']['price'] = $realPrice; $cart['productAttr']['stock'] = $cart['cart_num']; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index b2a69935..a9747710 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -539,6 +539,18 @@ class StoreOrderRepository extends BaseRepository } else { return $cart['productAttr']['price']; } + // 更新委托价格 + } else if ($cart['product_type'] == '99') { + if ($cart['source_id'] > 0) { + $price = Db::name('entrust')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price'); + if ($price) { + return $price; + } else { + throw new ValidateException('委托商品数据异常'); + } + } else { + return $cart['productAttr']['price']; + } } else { return $cart['productAttr']['price']; } @@ -588,7 +600,7 @@ class StoreOrderRepository extends BaseRepository //activity_type:0普通订单 98采购订单 99委托商品 //$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type); $isUser = 1; - if ($product_type == 98) { + if ($product_type == 98 || $product_type == 99) { $isUser = 0; } $noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); diff --git a/app/listener/OrderCreate.php b/app/listener/OrderCreate.php index 11eff96c..6377f29b 100644 --- a/app/listener/OrderCreate.php +++ b/app/listener/OrderCreate.php @@ -18,7 +18,7 @@ class OrderCreate { $groupOrder = $event['groupOrder']; $order = $groupOrder->orderList[0]; - if ($order['pay_type'] != StoreGroupOrder::PAY_TYPE_CREDIT_BUY || $order['activity_type'] != 98) { + if ($order['pay_type'] != StoreGroupOrder::PAY_TYPE_CREDIT_BUY || !in_array($order['activity_type'], [98, 99])) { return true; } /** @var StoreOrderInterestRepository $storeOrderInterestRepository */