...
|
...
|
@@ -68,10 +68,10 @@ class GoodsController extends RestBaseController |
|
|
$param=$this->request->param();
|
|
|
$user_score=Db::name('user')->where('id',$this->getUserId())->find()['score'];
|
|
|
if ($user_score<$param['price']){
|
|
|
$this->error('用户积分不足',2);
|
|
|
$this->error(['code'=>40001,'msg'=>'用户积分不足']);
|
|
|
}
|
|
|
if (Db::name('goods_order')->where('id',$param['id'])->find()['stock']<$param['count']){
|
|
|
$this->error('商品库存不足',3);
|
|
|
$this->error(['code'=>40002,'msg'=>'商品库存不足']);
|
|
|
}
|
|
|
$re=Db::name('goods_order')->insert([
|
|
|
'user_id'=>$this->getUserId(),
|
...
|
...
|
|