作者 王智

222

... ... @@ -185,8 +185,8 @@ class Order extends Api
}
foreach ($arr as $k => $v) {
$stock = Db::name('product')->where(['id' => $v['product_id']])->value('stock');
$num = $stock - $v['num'];
Db::name('product')->where(['id' => $v['product_id']])->update(['stock' => $num]);
$num[$k] = $stock - $v['num'];
Db::name('product')->where(['id' => $v['product_id']])->update(['stock' => $num[$K]]);
}
if (!$insert_orderCon) {
$this->error('订单详情生成失败', 0);
... ...