Skip to content
qinmingyuan edited this page Aug 17, 2021 · 3 revisions

小程序

wx.login

POST /wechat/program_users

wx.request({
  url: 'https://test.one.work/wechat/program_users',
  data: {
    code: res.code,
    appid: 'wxcdcb0fa80cf4c2c9'
  },
  method: 'POST',
  success(res) {
    console.log(res)
    // 将 auth_token 存入 session
    wx.setStorageSync('auth_token', res.data.auth_token)
  }
})

wx.getPhoneNumber

wx.request({
  url: 'https://test.one.work/wechat/program_users/mobile',
  data: {
    iv: e.detail.iv,
    encryptedData: e.detail.encryptedData,
    auth_token: wx.getStorageSync('auth_token')
  },
  method: 'POST'
})

wx.getUserProfile

wx.request({
  url: 'https://test.one.work/wechat/program_users/info',
  data: {
    userInfo: res.userInfo,
    auth_token: wx.getStorageSync('auth_token')
  },
  method: 'POST'
})
Clone this wiki locally