GetUserInfoByJsCode
This commit is contained in:
parent
f31c8b04e2
commit
a157189aef
|
@ -39,6 +39,9 @@ func (o *MpSdk) GetUserInfoByJsCode(code string) (*UserInfo, error) {
|
||||||
userInfo := new(UserInfo)
|
userInfo := new(UserInfo)
|
||||||
|
|
||||||
g := gjson.ParseBytes(body)
|
g := gjson.ParseBytes(body)
|
||||||
|
if g.Get("errcode").Int() != 0 {
|
||||||
|
return nil, errors.New(string(body))
|
||||||
|
}
|
||||||
userInfo.Openid = g.Get("openid").String()
|
userInfo.Openid = g.Get("openid").String()
|
||||||
userInfo.Unionid = g.Get("unionid").String()
|
userInfo.Unionid = g.Get("unionid").String()
|
||||||
return userInfo, nil
|
return userInfo, nil
|
||||||
|
|
Loading…
Reference in New Issue