优化
This commit is contained in:
parent
3da00000d6
commit
469ebf813c
@ -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]);
|
||||||
|
Loading…
Reference in New Issue
Block a user