diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 23c4f645..323ff3e6 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -100,6 +100,18 @@ class StoreOrderCreateRepository extends StoreOrderRepository if ($order_type == 98 && count($merchantCartList) > 1) { throw new ValidateException('采购商品不支持跨店购买'); } + $community = []; + if ($order_type == 98) { + $attrUniqueArray = []; + foreach($merchantCart['list'] as $prod){ + $attrUniqueArray[] = $prod['product_attr_unique']; + } + $attrInfo = Db::name('Resale')->alias('r')->leftJoin('Community c','r.community_id = c.community_id')->whereIn('r.product_attr_unique', $attrUniqueArray)->distinct(true)->field('c.community_id, c.title, c.image')->fetchSql(false)->select(); + if (count($attrInfo) > 1) { + throw new ValidateException('转售商品数据异常'); + } + $community = $attrInfo[0] ?? []; + } unset($merchantCart, $cart); $order_price = 0; @@ -885,6 +897,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'order_total_postage', 'order_price', 'total_price', + 'community', 'platformCoupon', 'enabledPlatformCoupon', 'usePlatformCouponId',