tt
This commit is contained in:
@@ -38,15 +38,17 @@ type OauthAccessTokenRes struct {
|
|||||||
|
|
||||||
// 抖音登录返回值
|
// 抖音登录返回值
|
||||||
type TiktokOauthResone struct {
|
type TiktokOauthResone struct {
|
||||||
ErrNo int64 `json:"err_no"`
|
ErrNo int64 `json:"err_no"`
|
||||||
ErrTips string `json:"err_tips"`
|
ErrTips string `json:"err_tips"`
|
||||||
Data *struct {
|
Data *TiktokData `json:"data"`
|
||||||
SessionKey string `json:"session_key"`
|
}
|
||||||
OpenId string `json:"openid"` // 授权用户唯一标识
|
|
||||||
AnonymousOpenid string `json:"anonymous_openid"`
|
type TiktokData struct {
|
||||||
Unionid string `json:"unionid"`
|
SessionKey string `json:"session_key"`
|
||||||
Dopenid string `json:"dopenid"`
|
OpenId string `json:"openid"` // 授权用户唯一标识
|
||||||
}
|
AnonymousOpenid string `json:"anonymous_openid"`
|
||||||
|
Unionid string `json:"unionid"`
|
||||||
|
Dopenid string `json:"dopenid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 预下单
|
// 预下单
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func TestCode2(t *testing.T) {
|
|||||||
|
|
||||||
func TestCode343(t *testing.T) {
|
func TestCode343(t *testing.T) {
|
||||||
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
||||||
data, err := a.GetTiktokOauth("e8_JIyo4H2IKJrfcuAP3q2WSBp00B_vQmTtf5YKcFFRqDEzubRleNWhxvqujCLFqxp8CrOpR0aIXKAt66fGy0uhypCTt8w-JIyItQAspqyy2qpa9FkbYlgmFZV8")
|
data, err := a.GetTiktokOauth("L7ItxFupOS4loNPC5fBq9JtnphlXJtKwrmvDqvMoK5dbqZ03uf8Cyoc_1bnoc_SzEARSi5FEhzZHROyv37b6dzEAUkzhm1RcQYYJtPfFV2FKWiDH5kYX1xIAFLY")
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package tiktok
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 获取抖音登录授权2
|
// 获取抖音登录授权2
|
||||||
@@ -13,12 +12,11 @@ func (a *API) GetTiktokOauth(code string) (*TiktokOauthResone, error) {
|
|||||||
tokenReq["code"] = code
|
tokenReq["code"] = code
|
||||||
tokenReq["secret"] = a.GetSecret()
|
tokenReq["secret"] = a.GetSecret()
|
||||||
tokenReq["anonymous_code"] = ""
|
tokenReq["anonymous_code"] = ""
|
||||||
globals.SugarLogger.Debug("打印appid,secret", tokenReq["appid"], tokenReq["secret"])
|
|
||||||
result, err := a.AccessAPI2(GetTiktokOauth, tokenReq)
|
result, err := a.AccessAPI2(GetTiktokOauth, tokenReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debug("从抖音获取的result==========================", result)
|
|
||||||
oauthAccessToken := &TiktokOauthResone{}
|
oauthAccessToken := &TiktokOauthResone{}
|
||||||
if err := utils.Map2StructByJson(result, oauthAccessToken, false); err != nil {
|
if err := utils.Map2StructByJson(result, oauthAccessToken, false); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user