作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

接口

@@ -70,7 +70,7 @@ class GoodsController extends RestBaseController @@ -70,7 +70,7 @@ class GoodsController extends RestBaseController
70 if ($user_score<$param['price']){ 70 if ($user_score<$param['price']){
71 $this->error(['code'=>40001,'msg'=>'用户积分不足']); 71 $this->error(['code'=>40001,'msg'=>'用户积分不足']);
72 } 72 }
73 - if (Db::name('goods_order')->where('id',$param['id'])->find()['stock']<$param['count']){ 73 + if (Db::name('goods')->where('id',$param['goods_id'])->find()['stock']<$param['count']){
74 $this->error(['code'=>40002,'msg'=>'商品库存不足']); 74 $this->error(['code'=>40002,'msg'=>'商品库存不足']);
75 } 75 }
76 $re=Db::name('goods_order')->insert([ 76 $re=Db::name('goods_order')->insert([