fix: fetchTasks 拉取时即创建录像记录 status=created
This commit is contained in:
parent
7c1e449e35
commit
65124242f6
@ -78,6 +78,21 @@ class HikvisionService extends BaseService {
|
|||||||
const matchedServer = servers.find(s => s.id === matchedCamera.server_id) || servers[0];
|
const matchedServer = servers.find(s => s.id === matchedCamera.server_id) || servers[0];
|
||||||
if (!matchedServer) continue;
|
if (!matchedServer) continue;
|
||||||
|
|
||||||
|
// 先创建录像记录(状态=created),防止重复拉取
|
||||||
|
const existingVideo = await app.mysql.get('wms').get('wms_pack_task_video', {
|
||||||
|
pack_task_id: task.id,
|
||||||
|
deleted_at: null,
|
||||||
|
});
|
||||||
|
if (!existingVideo) {
|
||||||
|
await app.mysql.get('wms').insert('wms_pack_task_video', {
|
||||||
|
pack_task_id: task.id,
|
||||||
|
camera_id: matchedCamera.id,
|
||||||
|
video_url: '',
|
||||||
|
status: 'created',
|
||||||
|
});
|
||||||
|
console.log(`[Hikvision] 创建录像记录: pack_task=${task.id}, camera=${matchedCamera.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
pack_task_id: task.id,
|
pack_task_id: task.id,
|
||||||
device_id: deviceId,
|
device_id: deviceId,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user