|
|
@@ -94,9 +94,10 @@ class StoreCartController
|
|
|
$storeServices = app()->make(StoreProductServices::class);
|
|
|
$is_gift = $storeServices->value(['id'=>$where['productId']],'is_gift');
|
|
|
// 礼包商品只能购买一次检查
|
|
|
+ /** @var StoreOrderServices $orderServices */
|
|
|
+ $orderServices = app()->make(StoreOrderServices::class);
|
|
|
if ($is_gift == 1) {
|
|
|
- /** @var StoreOrderServices $orderServices */
|
|
|
- $orderServices = app()->make(StoreOrderServices::class);
|
|
|
+
|
|
|
// 检查用户是否有已支付的礼包订单(order_type=1)
|
|
|
$uid = $request->uid();
|
|
|
@file_put_contents("quanju.txt", "礼包检查: uid=$uid, is_gift=$is_gift\r\n", 8);
|
|
|
@@ -114,17 +115,7 @@ class StoreCartController
|
|
|
} else {
|
|
|
// 非礼包商品,检查用户是否购买过礼包商品
|
|
|
$uid = $request->uid();
|
|
|
- /** @var StoreOrderServices $orderServices */
|
|
|
- $orderServices = app()->make(StoreOrderServices::class);
|
|
|
- $hasGiftOrder = $orderServices->count([
|
|
|
- ['uid' => $uid],
|
|
|
- ['order_type' => 1],
|
|
|
- ['paid' => 1],
|
|
|
- ['is_del' => 0],
|
|
|
- ]);
|
|
|
- @file_put_contents("quanju.txt", $hasGiftOrder."非礼包检查: uid=$uid, is_gift=$is_gift\r\n", 8);
|
|
|
-
|
|
|
- if ($hasGiftOrder == 0) {
|
|
|
+ if ($orderServices->checkGift($uid)) {
|
|
|
return app('json')->fail('必须先买礼包商品');
|
|
|
}
|
|
|
}
|