功能:新增业务接口与扫码组件

This commit is contained in:
焦龙言
2026-07-27 03:17:52 +08:00
parent c08b5a5d3d
commit 1f23d92ffb
20 changed files with 1095 additions and 0 deletions
@@ -0,0 +1,17 @@
export function normalizeScanValue(value) {
const normalizedValue = String(value ?? '').trim()
if (!normalizedValue) {
throw new Error('二维码不能为空')
}
return normalizedValue
}
export function isDuplicateScan(value, lastValue, scannedAt, lastScannedAt, duplicateWindowMs) {
const elapsed = scannedAt - lastScannedAt
return value === lastValue && elapsed >= 0 && elapsed <= duplicateWindowMs
}
export function createIdempotencyKey() {
return globalThis.crypto.randomUUID()
}