作者 李忠强

更新

@@ -128,7 +128,7 @@ class Buy extends Api @@ -128,7 +128,7 @@ class Buy extends Api
128 128
129 $model = new \app\api\model\UserBuylist(); 129 $model = new \app\api\model\UserBuylist();
130 $order = $model->with('sku')->where('id',$id)->find(); 130 $order = $model->with('sku')->where('id',$id)->find();
131 - if ($number+$order['number'] > $order['stock_num']) $this->error('已达到最大库存,请勿重复提交'); 131 + if ($number+$order['number'] > $order['sku']['stock_num']) $this->error('已达到最大库存,请勿重复提交');
132 $model->where('id',$id)->setInc('number',$number); 132 $model->where('id',$id)->setInc('number',$number);
133 $this->success('SUCCESS'); 133 $this->success('SUCCESS');
134 } 134 }
@@ -97,7 +97,7 @@ class Cart extends Api @@ -97,7 +97,7 @@ class Cart extends Api
97 97
98 $model = new \app\api\model\Cart(); 98 $model = new \app\api\model\Cart();
99 $order = $model->with('sku')->where('id',$id)->find(); 99 $order = $model->with('sku')->where('id',$id)->find();
100 - if ($number+$order['number'] > $order['stock_num']) $this->error('已达到最大库存,请勿重复提交'); 100 + if ($number+$order['number'] > $order['sku']['stock_num']) $this->error('已达到最大库存,请勿重复提交');
101 $model->where('id',$id)->setInc('number',$number); 101 $model->where('id',$id)->setInc('number',$number);
102 $this->success('SUCCESS'); 102 $this->success('SUCCESS');
103 } 103 }