作者 sgj
1 个管道 的构建 失败 耗费 0 秒

商品下单修改

... ... @@ -904,6 +904,9 @@ class SecondController extends RestBaseController
if (empty($good)||$good['is_online']!=1){
$this->error('商品错误');
}
if ($good['num']<$param['num']){
$this->error('商品库存不足');
}
/*检查是否有足够工时*/
$Volunter=new VolunteerModel();
$user=$Volunter->where('user_id',$userId)->find();
... ... @@ -912,6 +915,11 @@ class SecondController extends RestBaseController
if ($user_time<$good_time){
$this->error('用户工时不足');
}
/*扣除库存和添加销量*/
$goodModel->where('id',$param['good_id'])->setInc('seal_num',$param['num']);
$goodModel->where('id',$param['good_id'])->setDec('num',$param['num']);
/*开始扣除*/
$Volunter->where('user_id',$userId)->setInc('use_time',$good_time);
$Log= new UserWorkLog();
... ...