修改逻辑
This commit is contained in:
parent
953210ea9f
commit
74cbfef69e
@ -2699,8 +2699,8 @@ class StoreOrderRepository extends BaseRepository
|
||||
$list = $this->findNearestPriceProduct($products, $money, $minNum);
|
||||
}
|
||||
$count = count($list);//计算数量的
|
||||
if(empty($list) && $baseList){
|
||||
$list = $this->findProductByPrice($money,$baseList);
|
||||
if(empty($count)){
|
||||
$list = [$this->findProductByPrice($money,$baseList)];
|
||||
$count = count($list);//计算数量的
|
||||
}
|
||||
|
||||
@ -2712,6 +2712,13 @@ class StoreOrderRepository extends BaseRepository
|
||||
'merInfo' => $merInfo,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function findProductByPrice($inputPrice, $products) {
|
||||
$totalNum = 0;
|
||||
$matchedProduct = null;
|
||||
@ -2839,9 +2846,12 @@ class StoreOrderRepository extends BaseRepository
|
||||
$product['num'] = (int)ceil($targetPrice / $product['price']);
|
||||
} else {
|
||||
$product['num'] = 1;
|
||||
}
|
||||
} //dump($product);
|
||||
$targetPrice -= $product['price'];
|
||||
$nearestProduct[] = $product;
|
||||
if ($product['num'] >0) {
|
||||
$nearestProduct[] = $product;
|
||||
}
|
||||
|
||||
$currentNum++;
|
||||
}
|
||||
return $nearestProduct;
|
||||
|
Loading…
x
Reference in New Issue
Block a user