Files
tougao/application/api/job/PromotionPrepare.php
2026-04-24 13:13:06 +08:00

35 lines
1.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\api\job;
use think\queue\Job;
use app\common\PromotionService;
/**
* 【已废弃 / 兼容保留】
*
* 旧版 task 级 prepare Job新逻辑请使用 PromotionPrepareTask + PromotionPrepareEmail。
*
* 本类仅为兼容队列中可能遗留的旧 payload接收到旧 job 时转发到新的调度器,
* 保证旧消息不会丢失。新代码不应再 push 此 Job。
*/
class PromotionPrepare
{
public function fire(Job $job, $data)
{
$taskId = intval(isset($data['task_id']) ? $data['task_id'] : 0);
$service = new PromotionService();
if ($taskId > 0) {
try {
$service->enqueuePrepareTask($taskId);
$service->log('[PromotionPrepare][deprecated] forwarded task=' . $taskId . ' -> PromotionPrepareTask');
} catch (\Exception $e) {
$service->log('[PromotionPrepare][deprecated] task=' . $taskId . ' forward_exception=' . $e->getMessage());
}
}
$job->delete();
}
}