From 04bacb44d59b06877622001af64f6e1f6845d868 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Wed, 21 Oct 2026 00:48:02 +0800 Subject: [PATCH] =?UTF-8?q?chore(workspace):=20=E8=AE=B0=E5=BD=95=E5=B8=B8?= =?UTF-8?q?=E7=94=A8=E7=BB=88=E7=AB=AF=E5=91=BD=E4=BB=A4=E7=9A=84=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=B9=E5=87=86=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- packService.code-workspace | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packService.code-workspace b/packService.code-workspace index 876a149..c049f55 100644 --- a/packService.code-workspace +++ b/packService.code-workspace @@ -4,5 +4,16 @@ "path": "." } ], - "settings": {} + "settings": { + "chat.tools.terminal.autoApprove": { + "/^@'\nconst mysql = require\\('mysql2/promise'\\);\nconst cfg = require\\('\\./scripts/db-config'\\)\\(\\);\n\\(async \\(\\) => \\{\n const c = await mysql\\.createConnection\\(cfg\\);\n const \\[r\\] = await c\\.query\\(\"SELECT id,scanner_id,channel_id,barcode,scan_time,reported_at,subject_id,workstation_id,created_at FROM scan_records WHERE barcode='SF1164748936737'\"\\);\n console\\.log\\('SAME BARCODE:', JSON\\.stringify\\(r, null, 1\\)\\);\n const \\[recent\\] = await c\\.query\\(\"SELECT id,scanner_id,channel_id,barcode,scan_time,reported_at,workstation_id FROM scan_records ORDER BY id DESC LIMIT 5\"\\);\n console\\.log\\('RECENT:', JSON\\.stringify\\(recent, null, 1\\)\\);\n const \\[snap\\] = await c\\.query\\(\"SELECT id, workstation_snapshot FROM scan_records WHERE workstation_snapshot IS NOT NULL ORDER BY id DESC LIMIT 1\"\\);\n console\\.log\\('SNAPSHOT SAMPLE:', JSON\\.stringify\\(snap, null, 1\\)\\);\n await c\\.end\\(\\);\n\\}\\)\\(\\)\\.catch\\(e => \\{ console\\.error\\(e\\.message\\); process\\.exit\\(1\\); \\}\\);\n'@ \\| Set-Content -Path d:\\\\packService\\\\backend\\\\_probe2\\.cjs -Encoding UTF8; node d:\\\\packService\\\\backend\\\\_probe2\\.cjs$/": { + "approve": true, + "matchCommandLine": true + }, + "/^@'\nconst mysql = require\\('mysql2/promise'\\);\nconst cfg = require\\('\\./scripts/db-config'\\)\\(\\);\nconst \\{ buildSnapshot \\} = require\\('\\./app/lib/workstation-snapshot'\\);\n\n\\(async \\(\\) => \\{\n const c = await mysql\\.createConnection\\(cfg\\);\n\n const \\[\\[ws\\]\\] = await c\\.query\\('SELECT \\* FROM workstations WHERE id=1 AND deleted_at IS NULL'\\);\n if \\(!ws\\) throw new Error\\('工作台 1 不存在'\\);\n\n const \\[cams\\] = await c\\.query\\(`\n SELECT wc\\.stream_type, wc\\.x, wc\\.y, wc\\.width, wc\\.height, wc\\.z_index, wc\\.sort_no,\n cam\\.id AS camera_id, cam\\.name AS camera_name, cam\\.channel_no, cam\\.channel_name, cam\\.nvr_id,\n n\\.id AS nvr_id2, n\\.name AS nvr_name, n\\.host AS nvr_host, n\\.port AS nvr_port, n\\.username AS nvr_username\n FROM workstation_cameras wc\n JOIN cameras cam ON cam\\.id = wc\\.camera_id\n LEFT JOIN nvrs n ON n\\.id = cam\\.nvr_id\n WHERE wc\\.workstation_id = 1\n ORDER BY wc\\.sort_no ASC, cam\\.id ASC`\\);\n\n const workstation = \\{\n id: ws\\.id, code: ws\\.code, name: ws\\.name, wsType: ws\\.ws_type,\n recordBeforeSec: ws\\.record_before_sec, recordAfterSec: ws\\.record_after_sec,\n recordMaxSec: ws\\.record_max_sec, canvasWidth: ws\\.canvas_width, canvasHeight: ws\\.canvas_height,\n cameraLinks: cams\\.map\\(r => \\(\\{\n streamType: r\\.stream_type,\n x: r\\.x, y: r\\.y, width: r\\.width, height: r\\.height, zIndex: r\\.z_index, sortNo: r\\.sort_no,\n camera: \\{\n id: r\\.camera_id, name: r\\.camera_name, channelName: r\\.channel_name,\n channelNo: r\\.channel_no, nvrId: r\\.nvr_id,\n nvr: \\{ name: r\\.nvr_name, host: r\\.nvr_host, port: r\\.nvr_port, username: r\\.nvr_username \\},\n \\},\n \\}\\)\\),\n \\};\n\n const link = \\{ channelId: '1', channelName: '112' \\};\n const snapshot = buildSnapshot\\(workstation, link\\);\n console\\.log\\('SNAPSHOT:', JSON\\.stringify\\(snapshot, null, 1\\)\\);\n\n const \\[dup\\] = await c\\.query\\(\n \"SELECT id FROM scan_records WHERE scanner_id=22 AND channel_id='1' AND barcode=\\? AND scan_time=\\?\",\n \\['SF1164748936737', '2026-10-20 02:10:20'\\]\n \\);\n if \\(dup\\.length\\) \\{ console\\.log\\('已存在记录 id=' \\+ dup\\[0\\]\\.id \\+ ',跳过'\\); await c\\.end\\(\\); return; \\}\n\n const \\[res\\] = await c\\.execute\\(\n `INSERT INTO scan_records\n \\(scanner_id, channel_id, barcode, scan_time, reported_at, subject_id, workstation_id, workstation_snapshot\\)\n VALUES \\(\\?, \\?, \\?, \\?, NOW\\(\\), \\?, \\?, \\?\\)`,\n \\[22, '1', 'SF1164748936737', '2026-10-20 02:10:20', 1, 1, JSON\\.stringify\\(snapshot\\)\\]\n \\);\n console\\.log\\('INSERTED id=' \\+ res\\.insertId\\);\n\n const \\[rows\\] = await c\\.query\\(\n \"SELECT id,scanner_id,channel_id,barcode,scan_time,reported_at,subject_id,workstation_id FROM scan_records WHERE id=\\?\",\n \\[res\\.insertId\\]\n \\);\n console\\.log\\('VERIFY:', JSON\\.stringify\\(rows, null, 1\\)\\);\n await c\\.end\\(\\);\n\\}\\)\\(\\)\\.catch\\(e => \\{ console\\.error\\(e\\); process\\.exit\\(1\\); \\}\\);\n'@ \\| Set-Content -Path d:\\\\packService\\\\backend\\\\_insert-scan\\.cjs -Encoding UTF8; node d:\\\\packService\\\\backend\\\\_insert-scan\\.cjs$/": { + "approve": true, + "matchCommandLine": true + } + } + } } \ No newline at end of file