This commit is contained in:
xing 2024-05-27 20:27:49 +08:00
parent 3da00000d6
commit 469ebf813c

View File

@ -196,11 +196,10 @@ public function changeProductState(): void
$idss[] = $item['notice_id']; $idss[] = $item['notice_id'];
$ids[$item['result']['state']][] = $item['result']['itemId']; $ids[$item['result']['state']][] = $item['result']['itemId'];
} }
$now = date('Y-m-d H:i:s');
try { try {
DB::transaction(function () use ($ids, $idss, $now) { DB::transaction(function () use ($ids, $idss) {
foreach ($ids as $state => $item) { foreach ($ids as $state => $item) {
Good::query()->whereIn('itemid', $item)->update(['state' => $state, 'updated_at' => $now]); Good::query()->whereIn('itemid', $item)->update(['state' => $state]);
} }
\App\Models\Notice::query()->whereIn('notice_id', $idss) \App\Models\Notice::query()->whereIn('notice_id', $idss)
->update(['state' => 3]); ->update(['state' => 3]);