You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
canteen/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/index.obj.js

30 lines
629 B

const uniStat = require('uni-stat')
const uniID = require('uni-id-common')
module.exports = {
report: async function (params = {}) {
//客户端信息
const clientInfo = this.getClientInfo()
//云服务信息
const cloudInfo = this.getCloudInfo()
//token信息
const token = this.getUniIdToken()
//当前登录用户id
let uid
if(token) {
const tokenRes = await uniID.createInstance({
clientInfo
}).checkToken(token)
if(tokenRes.uid) {
uid = tokenRes.uid
}
}
//数据上报
return await uniStat.initReceiver().report(params, {
...clientInfo,
...cloudInfo,
uid
})
}
}