增加打手登录设备管理与三台设备限制

This commit is contained in:
yml2213
2026-08-17 15:26:40 +08:00
parent 8d18daa0fe
commit f938ab0cba
13 changed files with 722 additions and 20 deletions
+13
View File
@@ -3,11 +3,24 @@ const WORKER_EXPIRES_AT_KEY = 'order-site-worker-token-expires-at'
const WORKER_ID_KEY = 'order-site-worker-id'
const WORKER_USERNAME_KEY = 'order-site-worker-username'
const WORKER_STATUS_KEY = 'order-site-worker-status'
const WORKER_DEVICE_ID_KEY = 'order-site-worker-device-id'
export function getWorkerToken() {
return localStorage.getItem(WORKER_TOKEN_KEY) || ''
}
export function getWorkerDeviceId() {
let deviceId = localStorage.getItem(WORKER_DEVICE_ID_KEY) || ''
if (!deviceId) {
deviceId =
typeof crypto.randomUUID === 'function'
? crypto.randomUUID()
: `${Date.now()}-${Math.random().toString(36).slice(2)}`
localStorage.setItem(WORKER_DEVICE_ID_KEY, deviceId)
}
return deviceId
}
export function getWorkerTokenExpiresAt() {
return localStorage.getItem(WORKER_EXPIRES_AT_KEY) || ''
}