请问一下,小程序获取手机号这个api有请求频率的限制吗??解密用户信息一直是成功的!!
getPhoneNumber: function (e) {
let that = this;
console.log(e.detail.errMsg);
if (e.detail.errMsg == ‘getPhoneNumber:user deny’ || e.detail.errMsg == ‘getPhoneNumber:fail user deny’) { //未授权手机号
that.opacity2 = 1;
that.phoneContent = ‘您未授权获取手机号,无法进一步操作!’
} else { //同意授权手机号
// wx.setStorageSync(‘phone’, e.detail.encryptedData);
that.Phoneiv = e.detail.iv;
that.PhoneencryptedData = e.detail.encryptedData;
that.showCover = false;
//获取uid
let params = {
encryptedData: that.PhoneencryptedData,
iv: that.Phoneiv,
signature: that.signature,
rawData: that.rawData
};
let requestData = getPublicParam(params)
GetUid(requestData).then(res => {
if (res.code == 200000) {
that.loadMyData();
log(‘GetUid获取成功:’, res);
that.isShowPhoneMask = true;
that.opacity2 = 0;
that.$apply();
//缓存手机号、uid
wx.setStorageSync(‘phoneNum’, res.data.phoneNumber);
wx.setStorageSync(‘uid’, res.data.uid);
//设置 缓存自动清除(重新授权) 时长
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000 + (60 * 60 * 24 * 28); //授权流程成功走完开始计时 28天后重新授权
wx.setStorageSync(‘timeOut’, timestamp)
} else {
that.isShowPhoneMask = false;
that.opacity2 = 1;
log(‘GetUid获取失败:’, res);
}
}).catch(err => {
that.isShowPhoneMask = false;
that.opacity2 = 1;
log(‘GetUid获取异常:’, err);
});
}
},
问题已经修复,是errMsg返回判断的问题,已为贡献者献上星巴克,谢谢仙同学