You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wx/README.md

704 B

微信登录工具

公众号

package main

import (
    "git.oa00.com/go/wx"
)

func main() {
    // 初始化配置
    wx.InitWxopen("appid", "secret")

    // 获取accessToken和openId
    wx.Wxopen.GetAccessInfo("code")

    // 获取用户信息
    wx.Wxopen.GetUserInfo("accessToken", "openId")
}

小程序

package main

import (
    "git.oa00.com/go/wx"
)

func main() {
    // 初始化配置
    wx.InitWxapp("appid","secret")

    // 获取登录信息
    wx.Wxapp.GetLoginInfo("code")

    // 获取用户信息
    wx.Wxapp.GetUserInfo("sessionKey", "encryptedData", "iv")

    // 获取手机号
    wx.Wxapp.GetPhone("sessionKey", "encryptedData", "iv")
}