提交 a23f5f56 编写于 作者: Q qiang

fix: uuid -> deviceId

上级 ddf13ee4
......@@ -37,8 +37,7 @@
"base64-arraybuffer": "^0.2.0",
"intersection-observer": "^0.7.0",
"pako": "^1.0.11",
"safe-area-insets": "^1.4.1",
"uuid": "3.4.0"
"safe-area-insets": "^1.4.1"
},
"private": true,
"devDependencies": {
......
let uuid
let deviceId
export default function () {
uuid = uuid || plus.runtime.getDCloudId()
return uuid
deviceId = deviceId || plus.runtime.getDCloudId()
return deviceId
}
......@@ -11,7 +11,7 @@ import tabBar from '../../framework/tab-bar'
import { getStatusbarHeight } from 'uni-platform/helpers/status-bar'
import uuid from 'uni-platform/helpers/uuid'
import deviceId from 'uni-platform/helpers/uuid'
export function getSystemInfoSync () {
return callApiSync(getSystemInfo, Object.create(null), 'getSystemInfo', 'getSystemInfoSync')
......@@ -100,6 +100,6 @@ export function getSystemInfo () {
bottom: safeAreaInsets.bottom,
left: safeAreaInsets.left
},
uuid: uuid()
deviceId: deviceId()
}
}
import { v4 as uuidv4 } from 'uuid'
const UUID_KEY = '__DC_UUID'
const UUID_KEY = '__DC_STAT_UUID'
const storage = window.localStorage || window.sessionStorage || {}
let uuid
let deviceId
export default function () {
uuid = uuid || storage[UUID_KEY]
if (!uuid) {
uuid = uuidv4()
deviceId = deviceId || storage[UUID_KEY]
if (!deviceId) {
deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7)
try {
storage[UUID_KEY] = uuid
storage[UUID_KEY] = deviceId
} catch (error) {
}
}
return uuid
return deviceId
}
import getWindowOffset from 'uni-platform/helpers/get-window-offset'
import uuid from 'uni-platform/helpers/uuid'
import deviceId from 'uni-platform/helpers/uuid'
import safeAreaInsets from 'safe-area-insets'
const ua = navigator.userAgent
......@@ -113,7 +113,7 @@ export function getSystemInfoSync () {
bottom: safeAreaInsets.bottom,
left: safeAreaInsets.left
},
uuid: uuid()
deviceId: deviceId()
}
}
/**
......
import { v4 as uuidv4 } from 'uuid'
import { getStorageSync } from './storage'
const UUID_KEY = '__DC_UUID'
let uuid
const UUID_KEY = '__DC_STAT_UUID'
let deviceId
function addUuid (result) {
uuid = uuid || getStorageSync(UUID_KEY)
if (!uuid) {
uuid = uuidv4()
deviceId = deviceId || getStorageSync(UUID_KEY)
if (!deviceId) {
deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7)
__GLOBAL__.setStorage({
key: UUID_KEY,
data: uuid
data: deviceId
})
}
result.uuid = uuid
result.deviceId = deviceId
}
function addSafeAreaInsets (result) {
......
import { v4 as uuidv4 } from 'uuid'
const UUID_KEY = '__DC_UUID'
let uuid
const UUID_KEY = '__DC_STAT_UUID'
let deviceId
function addUuid (result) {
uuid = uuid || __GLOBAL__.getStorageSync(UUID_KEY)
if (!uuid) {
uuid = uuidv4()
deviceId = deviceId || __GLOBAL__.getStorageSync(UUID_KEY)
if (!deviceId) {
deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7)
__GLOBAL__.setStorage({
key: UUID_KEY,
data: uuid
data: deviceId
})
}
result.uuid = uuid
result.deviceId = deviceId
}
function addSafeAreaInsets (result) {
......
......@@ -8965,7 +8965,7 @@ utils-merge@1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
uuid@3.4.0, uuid@^3.0.1, uuid@^3.3.2:
uuid@^3.0.1, uuid@^3.3.2:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册