增加了手机操作端
This commit is contained in:
31
server-api/app/queue/redis/MaterialBatchPackageConsumer.php
Normal file
31
server-api/app/queue/redis/MaterialBatchPackageConsumer.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\queue\redis;
|
||||
|
||||
use app\support\MaterialBatchPackageService;
|
||||
use support\Log;
|
||||
use Webman\RedisQueue\Consumer;
|
||||
|
||||
class MaterialBatchPackageConsumer implements Consumer
|
||||
{
|
||||
public string $queue = MaterialBatchPackageService::QUEUE_NAME;
|
||||
public string $connection = 'default';
|
||||
|
||||
public function consume($data): void
|
||||
{
|
||||
$batchId = (int)($data['batch_id'] ?? 0);
|
||||
if ($batchId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
(new MaterialBatchPackageService())->generateForBatchId($batchId);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('material batch package generation failed', [
|
||||
'batch_id' => $batchId,
|
||||
'message' => $e->getMessage(),
|
||||
]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user