feat(process/Task.php): 移除了更新库存和销量的代码块

This commit is contained in:
mkm 2024-08-24 15:31:39 +08:00
parent 8939b40586
commit 80aedd5c13

View File

@ -30,25 +30,6 @@ class Task
StoreOrder::where('id', 'in', $oid)->update(['delete_time' => time()]);
StoreOrderCartInfo::where('oid','in',$oid)->update(['status'=>OrderEnum::REFUND_STATUS_FINISH]);
$arr = StoreOrderCartInfo::where('oid', 'in', $oid)->field('store_id,product_id,cart_num')->select();
$updateData = [];
$updateDataTwo = [];
foreach ($arr as $v) {
$id=StoreBranchProduct::where('product_id',$v['product_id'])->where('store_id',$v['store_id'])->value('id');
if($id){
$updateData[] = [
'id' => $id,
'sales' => ['dec', $v['cart_num']],
'stock' => ['inc', $v['cart_num']],
];
}
$updateDataTwo[] = [
'id' => $v['product_id'],
'sales' => ['dec', $v['cart_num']]
];
}
(new StoreBranchProduct())->saveAll($updateData);
(new StoreProduct())->saveAll($updateDataTwo);
}
// 获取当前时间