This commit is contained in:
邹宗楠
2022-06-02 10:13:26 +08:00
parent dad0d7bb19
commit 7de52d4ab3
6 changed files with 85 additions and 80 deletions

View File

@@ -4,43 +4,6 @@ import (
"git.rosy.net.cn/baseapi/utils"
)
// OauthAccessTokenResData access_token
type OauthAccessTokenResData struct {
ErrorCode int64 `json:"error_code"` // 错误码
ExpiresIn uint64 `json:"expires_in"` // access_token接口调用凭证超时时间单位
OpenId string `json:"open_id"` // 授权用户唯一标识
RefreshExpiresIn int64 `json:"refresh_expires_in"` // refresh_token凭证超时时间单位秒)
RefreshToken string `json:"refresh_token"` // 用户刷新access_token
Scope string `json:"scope"` // 用户授权的作用域(Scope),使用逗号(,分隔开放平台几乎几乎每个接口都需要特定的Scope。
AccessToken string `json:"access_token"` // 接口调用凭证
Description string `json:"description"` // 错误码描述
}
// DYError 错误结构体
type DYError struct {
ErrorCode int64 `json:"error_code,omitempty"` // 错误码
Description string `json:"description,omitempty"` // 错误码描述
}
// OauthAccessTokenRes access_token
type OauthAccessTokenRes struct {
Data *OauthAccessTokenResData
Message string `json:"message"`
}
// 抖音登录返回值
type TiktokOauthResone struct {
ErrNo int64 `json:"err_no"`
ErrTips string `json:"err_tips"`
Data *struct {
SessionKey string `json:"session_key"`
OpenId string `json:"openid"` // 授权用户唯一标识
AnonymousOpenid string `json:"anonymous_openid"`
Unionid string `json:"unionid"`
Dopenid string `json:"dopenid"`
}
}
// 获取抖音登录授权2
func (a *API) GetTiktokOauth(code string) (*TiktokOauthResone, error) {
tokenReq := make(map[string]interface{}, 3)