'a'
mh-two-thousand-and-two
2024-04-12 44d2c92345cd156a59fc327b3060292a282d2893
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { getStorageSync } from './storage'
import { addSafeAreaInsets, populateParameters } from '../../mp-weixin/helpers/enhance-system-info'
 
const UUID_KEY = '__DC_STAT_UUID'
let deviceId
function addUuid (result) {
  deviceId = deviceId || getStorageSync(UUID_KEY)
  if (!deviceId) {
    deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7)
    __GLOBAL__.setStorage({
      key: UUID_KEY,
      data: deviceId
    })
  }
  result.deviceId = deviceId
}
 
function normalizePlatform (result) {
  let platform = result.platform ? result.platform.toLowerCase() : 'devtools'
  if (!~['android', 'ios'].indexOf(platform)) {
    platform = 'devtools'
  }
  result.platform = platform
}
 
export default {
  returnValue: function (result) {
    addUuid(result)
    addSafeAreaInsets(result)
    normalizePlatform(result)
    populateParameters(result)
  }
}