|
|
@@ -181,7 +181,9 @@ class InsertDataJob
|
|
|
{
|
|
|
// 1. 基础参数校验
|
|
|
if (!is_array($data) || empty($data['task_id']) || empty($data['date'])) {
|
|
|
- Log::error('队列任务参数错误', ['data' => $data]);
|
|
|
+ Log::error('队列任务参数错误', [
|
|
|
+ 'data' => json_encode($data, JSON_UNESCAPED_UNICODE) // 序列化复杂数组
|
|
|
+ ]);
|
|
|
$job->delete(); // 参数错误直接删除任务
|
|
|
return;
|
|
|
}
|
|
|
@@ -208,7 +210,10 @@ class InsertDataJob
|
|
|
'result' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
|
|
'update_time' => date('Y-m-d H:i:s')
|
|
|
]);
|
|
|
- Log::info('工资计算队列任务执行成功', ['task_id' => $taskId, 'date' => $data['date']]);
|
|
|
+ Log::info('工资计算队列任务执行成功', [
|
|
|
+ 'task_id' => (int)$taskId,
|
|
|
+ 'date' => (string)($data['date'] ?? '')
|
|
|
+ ]);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -217,10 +222,10 @@ class InsertDataJob
|
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
Log::error('工资计算队列任务执行失败', [
|
|
|
- 'task_id' => $taskId,
|
|
|
- 'error' => $e->getMessage(),
|
|
|
- 'trace' => $e->getTraceAsString(),
|
|
|
- 'attempts' => $job->attempts()
|
|
|
+ 'task_id' => (int)$taskId,
|
|
|
+ 'error' => (string)$e->getMessage(),
|
|
|
+ 'trace' => substr((string)$e->getTraceAsString(), 0, 2000), // 截断超长trace
|
|
|
+ 'attempts' => (int)$job->attempts()
|
|
|
]);
|
|
|
|
|
|
// 6. 达到最大重试次数则标记失败,否则重试
|