const _my = require("../../__antmove/api/index.js")(my); const wx = _my; const util = require("../func/request"); const { throttle } = require("../throttle/throttle") //根据auth-code获取用户三要素 const getThree = throttle(function(callback = null) { my.getAuthCode({ scopes: 'auth_user', success: function(res) { const authCode = res.authCode wx.showLoading({ title: "加载中..." }) util.request_wxrlxf({ url: "https://ldb-permit.hz-hanghui.com:8088/hanghui/outapi/alipayApi/faceAuth/getAlipayUserInfo", data: {authCode: authCode}, method: "post", type: "application/json" }).then(res => { wx.hideLoading() const result = {} if(res.data) { result.code = 200 result.data = { username: res.data.userName, idNumber: res.data.certNo, phone: res.data.mobile, userId: res.data.userId, avatar: res.data.avatar || null, personPictures: res.data.personPictures || null, photoBase64: res.data.photoBase64 || null } result.msg = '授权成功!' } else { result.code = 500 result.data = null result.msg = res.errmsg || '授权失败!' } if(callback) { callback(result) } }) } }) }, 5000) module.exports = getThree