shish 1 год назад
Родитель
Сommit
404e2be727
1 измененных файлов с 26 добавлено и 8 удалено
  1. 26 8
      app-hd/controllers/PurchaseController.php

+ 26 - 8
app-hd/controllers/PurchaseController.php

@@ -334,10 +334,18 @@ class PurchaseController extends BaseController
                 if($ghsShopInfo->mainId == 41121){
                     $bigSet = [1903693,1903712,1903789,1903796,1903816];
                     $smallSet = [1903841,1903855,1903859,1903860,1903864];
+                    $mer = array_merge($bigSet,$smallSet);
                     $getIds = array_column($productList, 'productId');
                     $bigIntersection = array_intersect($getIds, $bigSet);
                     $smallIntersection = array_intersect($getIds, $smallSet);
-                    if(count($getIds)==5){
+                    $hasYl = false;
+                    foreach($productList as $ylVal){
+                        $ylProductId = $ylVal['productId'];
+                        if(in_array($ylProductId, $mer)){
+                            $hasYl = true;
+                        }
+                    }
+                    if($hasYl){
                         $myInfoList = ProductClass::getAllByCondition(['id'=>['in',$getIds]],null,'*','id');
                         if(count($bigIntersection)==5){
                             $mul = 0;
@@ -370,8 +378,7 @@ class PurchaseController extends BaseController
                                     util::fail($myName.' 数量要'.$mustBeNum.'捆');
                                 }
                             }
-                        }
-                        if(count($smallIntersection)==5){
+                        }elseif(count($smallIntersection)==5){
                             $mul = 0;
                             $currentMap = [1903841=>80,1903855=>55,1903859=>40,1903860=>25,1903864=>20];
                             foreach($productList as $ylKey => $ylValue){
@@ -402,17 +409,27 @@ class PurchaseController extends BaseController
                                     util::fail($myName.' 数量要'.$mustBeNum.'捆');
                                 }
                             }
+                        }else{
+                            util::fail('套餐要选齐');
                         }
                     }
                 }
             }else{
                 if($ghsShopInfo->mainId == 644){
-                    $bigSet = [85378,85956];
-                    $smallSet = [86036,86062];
+                    $bigSet = [85378,85956,86036,86062,86039];
+                    $smallSet = [86042,86211,86743,25846,34238];
+                    $mer = array_merge($bigSet,$smallSet);
                     $getIds = array_column($productList, 'productId');
                     $bigIntersection = array_intersect($getIds, $bigSet);
                     $smallIntersection = array_intersect($getIds, $smallSet);
-                    if(count($getIds)==5){
+                    $hasYl = false;
+                    foreach($productList as $ylVal){
+                        $ylProductId = $ylVal['productId'];
+                        if(in_array($ylProductId, $mer)){
+                            $hasYl = true;
+                        }
+                    }
+                    if($hasYl){
                         $myInfoList = ProductClass::getAllByCondition(['id'=>['in',$getIds]],null,'*','id');
                         if(count($bigIntersection)==5){
                             $mul = 0;
@@ -445,8 +462,7 @@ class PurchaseController extends BaseController
                                     util::fail($myName.' 数量要'.$mustBeNum.'捆');
                                 }
                             }
-                        }
-                        if(count($smallIntersection)==5){
+                        }elseif(count($smallIntersection)==5){
                             $mul = 0;
                             $currentMap = [86036=>5,86062=>6];
                             foreach($productList as $ylKey => $ylValue){
@@ -477,6 +493,8 @@ class PurchaseController extends BaseController
                                     util::fail($myName.' 数量要'.$mustBeNum.'捆');
                                 }
                             }
+                        }else{
+                            util::fail('套餐要选齐');
                         }
                     }
                 }