WIN-2308041133\Administrator 5 months ago
parent
commit
309f0ed95f

+ 3 - 5
app/common/repositories/store/order/StoreOrderCreateRepository.php

@@ -124,9 +124,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
 
             foreach ($merchantCart['list'] as $k => $cart) {
 //                判断是否同时存在普通商品,节能油商品和礼包商品
-                if ($merchantCart['list'][$k]['product']['type']==5){
+                if ($merchantCart['list'][$k]['product']['is_oil']==1){
                     $jny=true;
-                }elseif ($merchantCart['list'][$k]['product']['type']==6){
+                }elseif ($merchantCart['list'][$k]['product']['is_gift']==1){
                     $lb=true;
                 }else{
                     $pt=true;
@@ -1517,9 +1517,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
             if (!$mer_form_id) $mer_form_id = $cart['product']['mer_form_id'];
             if (!$order_model) $order_model = $cart['product']['type'];
             if ($mer_form_id && $k) throw new ValidateException('存在表单信息商品,请单独购买');
-            if ($order_model==1 && $k) throw new ValidateException('虚拟商品必须单独购买');
-            if ($order_model == 5 && $k) throw new ValidateException('节能油商品必须单独购买');
-            if ($order_model == 6 && $k) throw new ValidateException('礼包商品必须单独购买');
+            if ($order_model && $k) throw new ValidateException('虚拟商品必须单独购买');
             if ($order_model == 4 && !$this->validateReservation($cart))
                 throw new ValidateException('当前时间已经预约满了~');
             if ($order_type == 0 ) {

+ 8 - 1
app/common/repositories/store/order/StoreOrderRepository.php

@@ -1089,7 +1089,14 @@ class StoreOrderRepository extends BaseRepository
         $cartIdArray = explode(',', $order['cart_id']); // 使用逗号分割字符串
         $product_id = StoreCart::where('cart_id', $cartIdArray[0])->value('product_id');
         $storeProduct = app()->make(Product::class);
-        $type =$storeProduct->where('product_id', $product_id)->value('type');
+        $is_oil =$storeProduct->where('product_id', $product_id)->value('is_oil');
+        $is_gift =$storeProduct->where('product_id', $product_id)->value('is_gift');
+        $type=0;
+        if ($is_oil == 1){
+            $type = 5;
+        }elseif ($is_gift == 1){
+            $type = 6;
+        }
         // 创建用户账单仓库实例
         $make = app()->make(UserBillRepository::class);
         $user = User::where('uid', $order['uid'])->find();

+ 3 - 5
app/common/repositories/store/product/ProductRepository.php

@@ -143,10 +143,6 @@ class ProductRepository extends BaseRepository
     const DEFINE_TYPE_CARD = 3;
     //预约商品
     const DEFINE_TYPE_RESERVATION = 4;
-    //节能油商品
-    const DEFINE_TYPE_Energy_Saving_Oil = 5;
-    //礼包商品
-    const DEFINE_TYPE_Gift_Pack = 6;
 
     // 普通商品
     const PRODUCT_TYPE_NORMAL = 0;
@@ -653,7 +649,9 @@ class ProductRepository extends BaseRepository
             'active_id' => $data['active_id'] ?? 0,
             'bar_code_number' => $data['bar_code_number'] ?? '',
             'auto_off_time' => isset($data['auto_off_time']) ? strtotime($data['auto_off_time']) : 0,
-            'labels' => $data['mer_labels'] ? json_encode($data['mer_labels']) : ''
+            'labels' => $data['mer_labels'] ? json_encode($data['mer_labels']) : '',
+            'is_gift' => $data['is_gift'] ?? 0,
+            'is_oil' => $data['is_oil'] ?? 0
         ];
         if (isset($data['extend']))
             $result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : '';