4***@qq.com
4***@qq.com
  • 发布:2022-09-27 09:59
  • 更新:2022-09-27 13:41
  • 阅读:258

支付宝小程序获取会员手机号返回数据格式有误!可以有偿解决

分类:uni-app

// 预期结果
{
"errMsg": "getPhoneNumber:ok",
"encryptedData": "9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==",
"sign": "XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="
}

// 授权返回结果如下
{errMsg: "getPhoneNumber:fail Error: {"response":"9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==","sign":"XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="}"}

2022-09-27 09:59 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

 <button style="margin-top:100rpx" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhoneNumber" error="getPhoneError">手机号码授权</button>
getPhoneNumber() {  
    uni.getPhoneNumber({  
     success: (res) => {  
      let encryptedData = res.response;  
      console.log(encryptedData)  
      uni.showToast({  
       title: "获得手机号码加密数据成功"  
      });  
      uni.request({  
       url: '开发者的后端服务端',  
       data: encryptedData,  
      });  
     },  
     fail: (res) => {  
      uni.showToast({  
       title: "授权手机号码失败"  
      });  
     },  
    });  
   },

该问题目前已经被锁定, 无法添加新回复