This commit is contained in:
suyl
2021-06-03 14:34:23 +08:00
parent 86eb5f6951
commit 71da34111c
5 changed files with 111 additions and 20 deletions

View File

@@ -1,17 +1,17 @@
package alipay
import (
"encoding/json"
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
"git.rosy.net.cn/jx-callback/business/auth2"
"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/api"
)
const (
AuthType = "alipaycode"
AuthKey = "GHp3ojlVYRRu2XID4FX2ew=="
)
type Auther struct {
@@ -33,24 +33,10 @@ func (a *Auther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx,
if err == nil {
//userInfo, err2 := api.AliPayAPI.UserInfoShare(tokenInfo.AccessToken)
//if err = err2; err == nil {
//if authBindEx, err = a.UnionFindAuthBind(AuthType, api.AliPayAPI.GetAppID(), nil, userInfo.UserID, "", userInfo); err == nil {
// authBindEx.UserHint = &auth2.UserBasic{
// Name: userInfo.NickName,
// 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)
if authBindEx, err = a.UnionFindAuthBind(AuthType, api.AliPayAPI.GetAppID(), nil, tokenInfo.UserID, tokenInfo.AlipayUserID, tokenInfo); err == nil {
authBindEx.AuthSecret = tokenInfo.AccessToken
authBindEx.AuthSecret2 = tokenInfo.RefreshToken
}
authBindEx.AuthSecret = tokenInfo.AccessToken
authBindEx.AuthSecret2 = tokenInfo.RefreshToken
}
return authBindEx, err
}