let openid = ''
const getOpenId = async () => {
const uid = uniCloud.getCurrentUserInfo().uid
const appId = '__UNI_EEB4FF7'
const wxPlatform = 'mp'
const getUserRes = await db.collection('uni-id-users').doc(uid).get()
const userRecord = getUserRes.data[0]
if (!userRecord) {
throw new Error('未匹配到此用户')
}
const wxOpenid = userRecord.wxopenid || {}
openid = wxOpenid[wxPlatform + '' + appId] || wxOpenid[wxPlatform]
}
getOpenId()
console.log(openid)