|
|
@@ -18,6 +18,7 @@ use app\services\agent\AgentLevelServices;
|
|
|
use app\services\activity\coupon\StoreCouponUserServices;
|
|
|
use app\services\agent\DivisionServices;
|
|
|
use app\services\product\product\StoreCategoryServices;
|
|
|
+use app\services\product\product\StoreProductGiftGroupService;
|
|
|
use app\services\shipping\ShippingTemplatesFreeServices;
|
|
|
use app\services\shipping\ShippingTemplatesRegionServices;
|
|
|
use app\services\shipping\ShippingTemplatesServices;
|
|
|
@@ -293,7 +294,23 @@ class StoreOrderCreateServices extends BaseServices
|
|
|
'lb_spread_uid' => $lb_spread_uid,
|
|
|
'is_lb' => $is_lb
|
|
|
];
|
|
|
+ if ($is_lb == 1){
|
|
|
+ if ($lb_spread_uid == 0){
|
|
|
+ throw new ApiException('没有推荐关系或者推荐人的用户无法购买,请重新扫描推荐二维码');
|
|
|
+ }
|
|
|
+ /** @var StoreProductGiftGroupService $storeProductGiftGroupService */
|
|
|
+ $storeProductGiftGroupService = app()->make(StoreProductGiftGroupService::class);
|
|
|
+
|
|
|
+ // 检查用户是否已在礼包关系表中存在(作为uid或pid)
|
|
|
+ $existsAsUid = $storeProductGiftGroupService->getOne(['uid' => $uid]);
|
|
|
+ $existsAsPid = $storeProductGiftGroupService->getOne(['pid' => $uid]);
|
|
|
|
|
|
+ // 如果两者都不存在,说明用户还没参与礼包推荐关系,无法购买
|
|
|
+ if (!$existsAsUid && !$existsAsPid) {
|
|
|
+ throw new ApiException('您还未参与礼包推荐关系,无法购买');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if ($shippingType == 2) {
|
|
|
$orderInfo['verify_code'] = $this->getStoreCode();
|
|
|
/** @var SystemStoreServices $storeServices */
|