...
|
...
|
@@ -56,16 +56,20 @@ class Cart extends Api |
|
|
$spec_sku = new Litestoregoodsspec();
|
|
|
$spec_info = $spec_sku->where('goods_spec_id', $sku_id)->find();
|
|
|
if ($cart) {
|
|
|
if ( $number > $spec_info['stock_num']) {
|
|
|
if ($number > $spec_info['stock_num']) {
|
|
|
$this->error('库存不足');
|
|
|
} else {
|
|
|
$model->where($where)->update(['number'=>$number]);
|
|
|
}
|
|
|
$cart->setInc('number', $number);
|
|
|
|
|
|
} else {
|
|
|
if ($spec_info['stock_num'] > $number) {
|
|
|
$this->error('库存不足');
|
|
|
} else {
|
|
|
$data['number'] = $number;
|
|
|
$model->isUpdate(false)->save($data);
|
|
|
}
|
|
|
$data['number'] = $number;
|
|
|
$model->isUpdate(false)->save($data);
|
|
|
|
|
|
}
|
|
|
$this->success('SUCCESS');
|
|
|
}
|
...
|
...
|
|