use match

This commit is contained in:
xing 2024-06-03 21:38:34 +08:00
parent 469ebf813c
commit 10945ef56e

View File

@ -61,21 +61,12 @@ public function handle(): void
{ {
Log::info('===========================开始执行type' . $this->type . ' 的队列============================'); Log::info('===========================开始执行type' . $this->type . ' 的队列============================');
try { try {
switch ($this->type) { match ($this->type) {
case 1: 1 => $this->addGoods(),
$this->addGoods(); 2 => $this->updateGoods(),
break; 3 => $this->changeProductState(),
case 2: 4, 5 => $this->changePrice(),
$this->updateGoods(); };
break;
case 3:
$this->changeProductState();
break;
case 4:
case 5:
$this->changePrice();
break;
}
Log::info('===========================执行完成================================'); Log::info('===========================执行完成================================');
} catch (Throwable $throwable) { } catch (Throwable $throwable) {
$this->fail($throwable); $this->fail($throwable);