在本地测试运作完美无缺的代码,部署到production就给个undefined?!
local debug: 前端:userInfo: wx.cloud.CloudID(e.detail.cloudID) 后端:event.userInfo.data 是 带有nickname等数值的JSON 部署后: 前端:userInfo: wx.cloud.CloudID(e.detail.cloudID) 后端:event.userInfo.data 是 undefined
详细代码-
云函数(get-user-info-and-save):
exports.main = async (event, context) => {
console.log(event)
const {nickName, openId, gender, city, province, language, country, avatarUrl,unionId} = event.userInfo.data
....
}
前端:
onGetUserInfo (e) {
console.log(e.detail)
if(!_.isUndefined(e.detail.rawData)){
this.setState({
isWaiting: true
})
wx.cloud.callFunction({
data: {
userInfo: wx.cloud.CloudID(e.detail.cloudID)
},
name: 'get-user-info-and-save',
success: this.setUserProfileInfo.bind(this),
fail: (e)=>{
this.setState({
networkHazProblem0: true,
isWaiting: false,
})
}
})
}
}
试一下把参数名换下 userinfo 改为比如 userinfo1
在production中有些用户获取得了,有些获取不了,尽管用户都授权了