aa
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
package alipay
|
package alipay
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
|
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider"
|
"git.rosy.net.cn/jx-callback/business/auth2/authprovider"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
)
|
)
|
||||||
@@ -29,15 +31,26 @@ func (a *Auther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx,
|
|||||||
globals.SugarLogger.Debugf("VerifySecret dummy:%s, code:%s", dummy, code)
|
globals.SugarLogger.Debugf("VerifySecret dummy:%s, code:%s", dummy, code)
|
||||||
tokenInfo, err := api.AliPayAPI.SystemAuthToken(alipayapi.GrantTypeCode, code, "")
|
tokenInfo, err := api.AliPayAPI.SystemAuthToken(alipayapi.GrantTypeCode, code, "")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
userInfo, err2 := api.AliPayAPI.UserInfoShare(tokenInfo.AccessToken)
|
//userInfo, err2 := api.AliPayAPI.UserInfoShare(tokenInfo.AccessToken)
|
||||||
if err = err2; err == nil {
|
//if err = err2; err == nil {
|
||||||
if authBindEx, err = a.UnionFindAuthBind(AuthType, api.AliPayAPI.GetAppID(), nil, userInfo.UserID, "", userInfo); err == nil {
|
//if authBindEx, err = a.UnionFindAuthBind(AuthType, api.AliPayAPI.GetAppID(), nil, userInfo.UserID, "", userInfo); err == nil {
|
||||||
authBindEx.UserHint = &auth2.UserBasic{
|
// authBindEx.UserHint = &auth2.UserBasic{
|
||||||
Name: userInfo.NickName,
|
// Name: userInfo.NickName,
|
||||||
Avatar: userInfo.Avatar,
|
// Avatar: userInfo.Avatar,
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//}
|
||||||
|
authBindEx = &auth2.AuthBindEx{}
|
||||||
|
authBindEx.Type = AuthType
|
||||||
|
authBindEx.TypeID = globals.AliKey
|
||||||
|
authBindEx.AuthID = tokenInfo.UserID
|
||||||
|
authBindEx.AuthID2 = tokenInfo.AlipayUserID
|
||||||
|
authBindEx.Status = model.YES
|
||||||
|
if data, err2 := json.Marshal(tokenInfo); err2 == nil {
|
||||||
|
authBindEx.DetailData = string(data)
|
||||||
}
|
}
|
||||||
|
authBindEx.AuthSecret = tokenInfo.AccessToken
|
||||||
|
authBindEx.AuthSecret2 = tokenInfo.RefreshToken
|
||||||
}
|
}
|
||||||
return authBindEx, err
|
return authBindEx, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user