初次用golang在公众号中获取信息,记录一下
看了下文档,粗略的写了个demo,如下:
func HttpGet(c*gin.Context) {
var param GetType
if er:=c.Bind(¶m);er!=nil{
c.JSON(200,gin.H{
"satus":200,
"msg":0,
})
}
resp, err := http.Get("https://api.weixin.qq.com/sns/oauth2/access_token?appid="+param.Appid+"&secret="+param.Secret+"&code="+param.Code+"&grant_type=authorization_code")
if err != nil {
c.JSON(200,gin.H{
"satus":200,
"msg":1,
})
}
/*resp, err := http.Get("https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxf0e81c3bee622d60&secret=maxyo829&code=081Dq0kI0AzB3i2PiZhI0iQFjI0Dq0k-&grant_type=author