Files
tougao/application/api/job/PromotionSend.php
2026-03-23 09:57:45 +08:00

36 lines
1.0 KiB
PHP

<?php
namespace app\api\job;
use think\queue\Job;
use app\common\PromotionService;
class PromotionSend
{
public function fire(Job $job, $data)
{
$taskId = intval(isset($data['task_id']) ? $data['task_id'] : 0);
$service = new PromotionService();
if (!$taskId) {
// $service->log('[PromotionSend] missing task_id, job deleted');
$job->delete();
return;
}
// try {
$result = $service->processNextEmail($taskId);
// $service->log('[PromotionSend] task=' . $taskId . ' result=' . json_encode($result));
// if (!empty($result['done'])) {
// $reason = isset($result['reason']) ? $result['reason'] : '';
// $service->log('[PromotionSend] task=' . $taskId . ' finished, reason=' . $reason);
// }
// } catch (\Exception $e) {
// $service->log('[PromotionSend] task=' . $taskId . ' exception=' . $e->getMessage());
// }
$job->delete();
}
}