修改自动推广的相关任务

This commit is contained in:
wangjinlei
2026-04-24 16:26:48 +08:00
parent 13fd3af816
commit d21c33fcd0
3 changed files with 52 additions and 21 deletions

View File

@@ -1728,6 +1728,32 @@ class EmailClient extends Base
return jsonSuccess($result); return jsonSuccess($result);
} }
public function mytestg(){
$data = $this->request->post();
$rule = new Validate([
"id"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$service = new PromotionService();
$service->enqueuePrepareEmail($data['id']);
$service->log("dsadsadsad");
}
public function mytestqq(){
$data = $this->request->post();
$rule = new Validate([
"id"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$service = new PromotionService();
$service->prepareSingleEmail($data['id']);
}
/** /**
* 定时任务:为指定日期的任务预生成邮件(默认明天) * 定时任务:为指定日期的任务预生成邮件(默认明天)
* 建议每天 22:00 执行curl .../EmailClient/prepareTasksForDate 或 prepareTasksForDate?date=2026-03-12 * 建议每天 22:00 执行curl .../EmailClient/prepareTasksForDate 或 prepareTasksForDate?date=2026-03-12

View File

@@ -25,28 +25,33 @@ class PromotionPrepareEmail
$logId = intval(isset($data['log_id']) ? $data['log_id'] : 0); $logId = intval(isset($data['log_id']) ? $data['log_id'] : 0);
$service = new PromotionService(); $service = new PromotionService();
$service->log('[PromotionPrepareEmail] m11ylog=' . $logId);
if (!$logId) { if (!$logId) {
$job->delete(); $job->delete();
return; return;
} }
$result = $service->prepareSingleEmail($logId);
try { $service->log('[PromotionPrepareEm111ail] m11ylog=' . $logId);
$result = $service->prepareSingleEmail($logId); //
$service->log('[PromotionPrepareEmail] log=' . $logId // try {
. ' code=' . $result['code'] // $result = $service->prepareSingleEmail($logId);
. ' llm_status=' . $result['llm_status'] // $service->log('[PromotionPrepareEmail] log=' . $logId
. ' msg=' . $result['msg']); // . ' code=' . $result['code']
$job->delete(); // . ' llm_status=' . $result['llm_status']
} catch (\Exception $e) { // . ' msg=' . $result['msg']);
$service->log('[PromotionPrepareEmail] log=' . $logId // $job->delete();
. ' attempts=' . $job->attempts() // } catch (\Exception $e) {
. ' exception=' . $e->getMessage()); // $service->log('[PromotionPrepareEmail] log=' . $logId
// . ' attempts=' . $job->attempts()
if ($job->attempts() >= 3) { // . ' exception=' . $e->getMessage());
$job->delete(); //
} else { // if ($job->attempts() >= 3) {
$job->release(30); // $job->delete();
} // } else {
} // $job->release(30);
// }
// }
} }
} }

View File

@@ -603,9 +603,9 @@ class PromotionService
$data = ['log_id' => intval($logId)]; $data = ['log_id' => intval($logId)];
if ($delay > 0) { if ($delay > 0) {
Queue::later($delay, $jobClass, $data, 'promotionPrepareEmail'); Queue::later($delay, $jobClass, $data, 'promotionmmm');
} else { } else {
Queue::push($jobClass, $data, 'promotionPrepareEmail'); Queue::push($jobClass, $data, 'promotionmmm');
} }
} }