统一甲屿云命名体系

This commit is contained in:
2026-06-29 23:26:43 +08:00
parent 48c47fe3ff
commit bc8a7d8d4c
1268 changed files with 3477 additions and 3511 deletions
+36
View File
@@ -0,0 +1,36 @@
const DEVICE_ID_KEY = 'jayu_salon_device_id'
function createDeviceId() {
const randomText = Math.random().toString(36).slice(2, 10)
return `manager-mini-device-${Date.now()}-${randomText}`
}
function assertStorageApi() {
if (typeof wx === 'undefined' || typeof wx.getStorageSync !== 'function' || typeof wx.setStorageSync !== 'function') {
throw new Error('wx storage API is required to build request signature device id')
}
}
function readDeviceId() {
assertStorageApi()
return wx.getStorageSync(DEVICE_ID_KEY) || ''
}
function writeDeviceId(value) {
assertStorageApi()
wx.setStorageSync(DEVICE_ID_KEY, value)
}
function getDeviceId() {
const current = readDeviceId()
if (current) {
return current
}
const next = createDeviceId()
writeDeviceId(next)
return next
}
module.exports = {
getDeviceId
}