From 0d1e33f2452e364de9e4c6ca8648a686ef1fa5f9 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 7 Sep 2023 15:04:19 +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=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 | 5 +++-- .../repositories/store/order/StoreOrderRepository.php | 8 ++++++++ .../repositories/store/product/ProductRepository.php | 6 ++++-- app/common/repositories/store/product/SpuRepository.php | 7 ++++--- app/common/service/JgPush.php | 1 + app/controller/api/store/order/StoreCart.php | 3 ++- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 8d7d1976..5d690a2a 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -101,6 +101,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository throw new ValidateException('采购商品不支持跨店购买'); } $community = []; + // 99 委托商品是否设置收货方式 if ($order_type == 98) { $sourceIdArray = []; foreach($merchantCart['list'] as $prod){ @@ -138,7 +139,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository } $orderDeliveryStatus = true; $order_svip_discount = 0; - // 循环计算每个店铺的订单数据 + // 循环计算每个店铺的订单数据 99 委托商品是否设置收货方式 foreach ($merchantCartList as &$merchantCart) { if ($order_type == 98 && !empty($deliverMethodArray)) { $merchantCart['delivery_way'] = $deliverMethodArray; @@ -172,7 +173,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $product_cart = []; foreach ($merchantCart['list'] as $k => $cart) { - //处理转售送货方式 + //处理转售送货方式 99 委托商品是否设置收货方式 if ($order_type == 98) { $merchantCart['list'][$k]['product']['delivery_way'] = $cart['product']['delivery_way'] = $deliverMethod ?? ''; } diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index a9747710..01861c4a 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -574,6 +574,14 @@ class StoreOrderRepository extends BaseRepository } else { return $cart['productAttr']['price']; } + // 更新委托价格 + } else if ($cart['product_type'] == '99') { + $price = Db::name('entrust')->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price'); + if ($price) { + return $price; + } else { + return $cart['productAttr']['price']; + } } else { return $cart['productAttr']['price']; } diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 8dc950aa..f11f5d0f 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -799,7 +799,7 @@ class ProductRepository extends BaseRepository break; } if ($productType == 0) { - $where[] = empty($merId) ? ['product_type', 'in', [0, 98]] : ['product_type', 'in', [0]]; + $where[] = empty($merId) ? ['product_type', 'in', [0, 98, 99]] : ['product_type', 'in', [0]]; if (!$merId) $where['is_gift_bag'] = 0; } if ($productType == 1) { @@ -1170,6 +1170,7 @@ class ProductRepository extends BaseRepository switch ($res['product_type']) { case 0: case 98: + case 99: $append[] = 'max_integral'; $append[] = 'show_svip_info'; break; @@ -2171,6 +2172,7 @@ class ProductRepository extends BaseRepository { case 0: case 98: + case 99: return $this->apiProductDetail(['product_id' => $data['id']], $data['product_type'], 0); break; case 1: @@ -2374,7 +2376,7 @@ class ProductRepository extends BaseRepository } $find = Db::name('store_product')->where('product_id', $product_id)->find(); if ($find) { - if (!in_array($find['product_type'], [0, 98])) { + if (!in_array($find['product_type'], [0, 98, 99])) { throw new ValidateException('该商品不是普通商品'); } $exist = Db::name('store_product')->where('source_product_id', $product_id)->where('mer_id', $mer_id)->find(); diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index edb7d260..4f4ce30e 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -281,6 +281,7 @@ class SpuRepository extends BaseRepository switch ($productType) { case 0: case 98: + case 99: $where = [ 'activity_id' => 0, 'product_id' => $id, @@ -379,14 +380,14 @@ class SpuRepository extends BaseRepository } $ret = $make->getWhere(['product_id' => $where['product_id']]); if (!$ret || $ret['status'] !== 1 || $ret['mer_status'] !== 1 || $ret['is_del']) $status = 0; - if (in_array($productType, [0, 1,98]) && ($ret['is_show'] !== 1 || $ret['is_used'] !== 1)) $status = 0; + if (in_array($productType, [0, 1,98, 99]) && ($ret['is_show'] !== 1 || $ret['is_used'] !== 1)) $status = 0; $result = $this->dao->getSearch($where)->find(); if (!$result && $ret) $result = $this->create($ret->toArray(), $where['product_id'], $where['activity_id'], $productType); if ($result) $this->dao->update($result['spu_id'], ['status' => $status]); - if ($status == 1 && in_array($productType, [0, 98])) { + if ($status == 1 && in_array($productType, [0, 98, 99])) { Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]); } - if (in_array($productType, [0, 98])) Queue::push(SyncProductTopJob::class,[]); + if (in_array($productType, [0, 98, 99])) Queue::push(SyncProductTopJob::class,[]); return true; } catch (\Exception $exception) { Log::info($exception->getMessage()); diff --git a/app/common/service/JgPush.php b/app/common/service/JgPush.php index 43cd3840..839d81f6 100644 --- a/app/common/service/JgPush.php +++ b/app/common/service/JgPush.php @@ -64,6 +64,7 @@ class JgPush } break; case 'MERCHANT_CREDIT_BUY_NOTICE': + // 委托商品是否需要提醒信息 $route = "/pages/order_details/stay?order_id={$data['orderId']}&product_type=98"; $merUserId = Merchant::where('mer_id', $data['id'])->value('uid'); $jgRegisterId = User::where('uid', $merUserId)->value('jg_register_id'); diff --git a/app/controller/api/store/order/StoreCart.php b/app/controller/api/store/order/StoreCart.php index 4b9fe031..4613787a 100644 --- a/app/controller/api/store/order/StoreCart.php +++ b/app/controller/api/store/order/StoreCart.php @@ -82,7 +82,7 @@ class StoreCart extends BaseController } } $entryMerId = $decryptArray[0] ?? ''; - if(!in_array($data['product_type'],[0,1,2,3,4,98])) return app('json')->fail('商品类型错误'); + if(!in_array($data['product_type'],[0,1,2,3,4,98,99])) return app('json')->fail('商品类型错误'); if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误'); $user = $this->request->userInfo(); event('user.cart.before',compact('user','data')); @@ -90,6 +90,7 @@ class StoreCart extends BaseController { case 0: //普通商品 case 98: //供应链商品 + case 99: //委托商品 $result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo()); [$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', '']; $data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;