diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 04b1799d..5dae26d0 100755 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -135,7 +135,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $order_extend = json_decode($cart['product']['extend'], true); } if ($address) { - if ($cart['source'] == 0 || $cart['source'] == 103) { + if (($cart['source'] == 0 || $cart['source'] == 103) && $cart['product']['type'] != 1) { $userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0); $getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode; $curl = new Curl(); @@ -168,6 +168,13 @@ class StoreOrderCreateRepository extends StoreOrderRepository } $order_total_postage = 0; $platformCoupon = []; + //判断是否是平台购物卡,购物卡不允许使用任何优惠券 + $merchantCate = $merchantCartList[0]['list'][0]->product->merCateId; + $isPlatformCard = false; + if (!empty($merchantCate) && in_array(env('PLATFORM_CARD_CATE_ID'), array_column($merchantCate->toArray(), 'mer_cate_id'))) { + $enabledPlatformCoupon = false; + $isPlatformCard = true; + } //套餐订单 @@ -247,7 +254,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $enabledCoupon = !($order_type && $order_type != 2); //只有预售和普通商品可以用优惠券 - if (!$enabledCoupon) { + if (!$enabledCoupon || $isPlatformCard) { $merchantCart['coupon'] = []; } $svip_coupon_merge = merchantConfig($merchantCart['mer_id'], 'svip_coupon_merge'); diff --git a/app/event.php b/app/event.php index 039bcf71..6cfad2d5 100755 --- a/app/event.php +++ b/app/event.php @@ -77,6 +77,7 @@ return [ 'refund.deliver'=>[\app\listener\DeliverRefund::class], 'order.create'=>[\app\listener\OrderCreate::class], 'order.take'=>[\app\listener\OrderTake::class], + 'order.delivery' => [\crmeb\listens\OrderDeliveryListen::class], // 发货事件 ], 'subscribe' => [], diff --git a/crmeb/listens/OrderDeliveryListen.php b/crmeb/listens/OrderDeliveryListen.php new file mode 100644 index 00000000..f9352fde --- /dev/null +++ b/crmeb/listens/OrderDeliveryListen.php @@ -0,0 +1,33 @@ +orderProduct as $orderProduct) { + $merchantCate = $orderProduct->product->merCateId; + if (empty($merchantCate) || $merchantCate[0]['mer_cate_id'] != env('PLATFORM_CARD_CATE_ID')) { + continue; + } + $consumption = StoreConsumption::where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)->find(); + /** @var StoreConsumptionUserDao $repo */ + $repo = app()->make(StoreConsumptionUserDao::class); + $repo->send($consumption, 100, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_UNUSED); + } + } + +}