|
@@ -343,20 +343,20 @@ class OrderService
|
|
|
{
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
// 减库存,规格和总库存
|
|
|
- if (!isset($params['submit_goods_classify']) || ($params['submit_goods_classify'] != 'MEALS' && $params['submit_goods_classify'] != 'PACKAGE')) {
|
|
|
+ if (!isset($params['submit_goods_classify']) || !in_array($params['submit_goods_classify'], ['MEALS', 'PACKAGE'])) {
|
|
|
$goodsSku = GoodsSku::where('goods_sku_id', $goods['sku_id'])->first();
|
|
|
$skuStorageJson = json_decode($goodsSku->goods_sku_storage_json, true);
|
|
|
if (isset($skuStorageJson['storage']) && !empty($skuStorageJson['storage'])) {
|
|
|
$skuStorageJson['storage'] = $skuStorageJson['storage'] - $goods['nbr'];
|
|
|
}
|
|
|
if (!isset($skuStorageJson['storage']) || (!empty($skuStorageJson['storage']) && $skuStorageJson['storage'] < 0)) {
|
|
|
- throw new BusinessException('库存不足3');
|
|
|
+ throw new BusinessException('库存不足');
|
|
|
}
|
|
|
}
|
|
|
$goodsRunning = GoodsRunning::where('join_running_goods_id', $goods['goods_id'])->first();
|
|
|
$goodsRunning->goods_running_storage = $goodsRunning->goods_running_storage - $goods['nbr'];
|
|
|
if ($goodsRunning->goods_running_storage < 0) {
|
|
|
- throw new BusinessException('库存不足4');
|
|
|
+ throw new BusinessException('库存不足');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -453,7 +453,7 @@ class OrderService
|
|
|
'cut_balance' => 0,
|
|
|
];
|
|
|
foreach ($goods as $good) {
|
|
|
- $result = OrderService::useCoupon($type,$settlementNow, $memberId, $goods, $good, $coupon, $amountBalance);
|
|
|
+ $result = OrderService::useCoupon($type, $settlementNow, $memberId, $goods, $good, $coupon, $amountBalance);
|
|
|
$amountBalance = [
|
|
|
'pay_amount' => $result['pay_amount'],
|
|
|
'welfare_balance' => $result['welfare_balance'],
|
|
@@ -476,7 +476,7 @@ class OrderService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static function useCoupon($type,$settlementNow, $memberId, $goods, $good, $coupon, $amountBalance)
|
|
|
+ public static function useCoupon($type, $settlementNow, $memberId, $goods, $good, $coupon, $amountBalance)
|
|
|
{
|
|
|
try {
|
|
|
$cacheKey = "ORDER:USE:COUPON:" . $memberId;
|