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