|
@@ -80,7 +80,7 @@ class Orders extends Api{
|
|
|
// 判断限购数量
|
|
|
$total = $buyNum[$buyInfo['product_id']] + $total;
|
|
|
// 如果超过数量
|
|
|
- if( $total > $productInfo['quota'] ) return json_send(['code'=>'error','msg'=>'已达限购次数-'.$productInfo['product_name'],'data'=>['error'=>'已超限=>'.($total - $productInfo['quota'])]]);
|
|
|
+ if( $total > $productInfo['quota'] ) return json_send(['code'=>'error','msg'=>'限购'.$productInfo['quota'].'套-'.$productInfo['product_name'],'data'=>['error'=>'已超限=>'.($total - $productInfo['quota'])]]);
|
|
|
}
|
|
|
}
|
|
|
// 如果存在SKU
|
|
@@ -94,10 +94,10 @@ class Orders extends Api{
|
|
|
// 需要扣除的库存
|
|
|
$skusList[$buyInfo['product_skuid']]['decr'] = empty($skusList[$buyInfo['product_skuid']]['decr']) ? $buyInfo['buy_num'] : $skusList[$buyInfo['product_skuid']]['decr'] + $buyInfo['buy_num'];
|
|
|
}
|
|
|
- // 判断库存
|
|
|
- if( $productInfo['stock'] < $buyInfo['buy_num'] ) return json_send(['code'=>'error','msg'=>'产品库存不足','data'=>['error'=>'产品库存不足=>'.$buyInfo['product_id']]]);
|
|
|
// 需要扣除的库存
|
|
|
$productList[$buyInfo['product_id']]['decr'] = empty($productList[$buyInfo['product_id']]['decr']) ? $buyInfo['buy_num'] : $productList[$buyInfo['product_id']]['decr'] + $buyInfo['buy_num'];
|
|
|
+ // 判断库存
|
|
|
+ if( $productInfo['stock'] < $productList[$buyInfo['product_id']]['decr'] ) return json_send(['code'=>'error','msg'=>$productInfo['product_name'].'-库存不足','data'=>['error'=>'产品库存不足=>'.$buyInfo['product_id']]]);
|
|
|
// 计算价值
|
|
|
$priceTotal = $buyInfo['buy_num'] * $productInfo['price'];
|
|
|
// 购买信息
|