feat: 修改订单逻辑,增加生鲜产品订单金额大于200元的校验

This commit is contained in:
mkm 2024-07-12 13:52:12 +08:00
parent 42a9130a7a
commit f3e83cda79

View File

@ -130,7 +130,7 @@ class OrderLogic extends BaseLogic
}
//计算生鲜
if ($createOrder == 1 && $find['top_cate_id'] == 15201) {
$fresh_price=bcadd($fresh_price,$cart_select[$k]['pay_price']);
$fresh_price = bcadd($fresh_price, $cart_select[$k]['pay_price']);
}
$cart_select[$k]['product_id'] = $find['product_id'];
$cart_select[$k]['old_cart_id'] = $v['id'];
@ -172,14 +172,15 @@ class OrderLogic extends BaseLogic
// $pay_price = self::$pay_price;
// } else {
$pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
//判断生鲜是否大于200
if($createOrder==1 && $fresh_price>0){
if($fresh_price<200){
self::setError('订单里的生鲜必须大于金额200元');
if ($createOrder == 1 && $fresh_price > 0) {
if ($pay_price < 200) {
self::setError('订单包含生鲜产品订单金额必须大于200元才能下单');
return false;
}
}
$pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
// }
//成本价 收益
$order = [
@ -263,7 +264,7 @@ class OrderLogic extends BaseLogic
$params['order_id'] = $order_id;
$params['verify_code'] = $verify_code;
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params, 1);
if($orderInfo==false){
if ($orderInfo == false) {
self::setError(self::getError());
return false;
}