正在显示
1 个修改的文件
包含
13 行增加
和
0 行删除
@@ -322,6 +322,19 @@ class Cart extends Api | @@ -322,6 +322,19 @@ class Cart extends Api | ||
322 | $order->pay_time = time(); // 更新支付时间为当前时间 | 322 | $order->pay_time = time(); // 更新支付时间为当前时间 |
323 | $order->pay_status = '1'; | 323 | $order->pay_status = '1'; |
324 | $order->save(); | 324 | $order->save(); |
325 | + // 非定制商品减库存 | ||
326 | + $deductStockData = []; | ||
327 | + foreach($order['goods'] as $v){ | ||
328 | + $goods = \app\common\model\Goods::get($v['goods_id'],['spec_rel.spec']); | ||
329 | + if($goods['ismake'] == '0'){ | ||
330 | + $goods_sku = $goods->getGoodsSku($v['spec_sku_id']); | ||
331 | + $deductStockData[] = [ | ||
332 | + 'id' => $goods_sku['id'], | ||
333 | + 'stock_num' => ['dec', $v['goods_num']] | ||
334 | + ]; | ||
335 | + } | ||
336 | + } | ||
337 | + !empty($deductStockData) && (new \app\common\model\GoodsSpec)->isUpdate()->saveAll($deductStockData); | ||
325 | return true; | 338 | return true; |
326 | } | 339 | } |
327 | } | 340 | } |
-
请 注册 或 登录 后发表评论