tt
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi"
|
"git.rosy.net.cn/baseapi/platformapi"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -34,6 +35,7 @@ func (a *API) AccessAPI2(url string, params map[string]interface{}) (retVal map[
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debug("进入AccessAPI2,DATA=================", data)
|
||||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
func() *http.Request {
|
func() *http.Request {
|
||||||
request, _ := http.NewRequest(http.MethodPost, url, strings.NewReader(string(data)))
|
request, _ := http.NewRequest(http.MethodPost, url, strings.NewReader(string(data)))
|
||||||
@@ -48,5 +50,6 @@ func (a *API) AccessAPI2(url string, params map[string]interface{}) (retVal map[
|
|||||||
retVal = jsonResult1
|
retVal = jsonResult1
|
||||||
return platformapi.ErrLevelSuccess, nil
|
return platformapi.ErrLevelSuccess, nil
|
||||||
})
|
})
|
||||||
|
globals.SugarLogger.Debug("我也不知道哪里出错,返回一下retVal", retVal)
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ const (
|
|||||||
GetTiktokOauth = "https://developer.toutiao.com/api/apps/v2/jscode2session" // 获取抖音授权
|
GetTiktokOauth = "https://developer.toutiao.com/api/apps/v2/jscode2session" // 获取抖音授权
|
||||||
GetTiktokQrCode = "https://developer.toutiao.com/api/apps/qrcode" // 获取小程序二维码
|
GetTiktokQrCode = "https://developer.toutiao.com/api/apps/qrcode" // 获取小程序二维码
|
||||||
|
|
||||||
TiktokAppId = "tta6a1d01c399f264201"
|
TiktokAppId = "tta6a1d01c399f264201"
|
||||||
TiktokSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
|
TiktokSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
|
||||||
|
TiktokJXDJAppID = "ttaceeda5333d7a7ab01"
|
||||||
|
tiktokJXDJSecret = "5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OauthAccessTokenResData access_token
|
// OauthAccessTokenResData access_token
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ func TestCode(t *testing.T) {
|
|||||||
|
|
||||||
func TestCode2(t *testing.T) {
|
func TestCode2(t *testing.T) {
|
||||||
a := New("5c08a0465cf0f996af254a03b6c2548defef87ad ", "tta6a1d01c399f264201")
|
a := New("5c08a0465cf0f996af254a03b6c2548defef87ad ", "tta6a1d01c399f264201")
|
||||||
data, err := a.GetTiktokOauth("CCRHRLfkl8kSHXuuZTDWQayoqHVXF2Vl4qrt173jxfWhg6Q1pZCbjRO0TzTGNPZd5vTW8UcjRupxfmEIdM06WSmAjwhvr-Ak_Pg9gJfHfrq2KvLH5eYL4C68BXM")
|
data, err := a.GetTiktokOauth("tYIYf03MgvPekdeWj91W3RhdzQMCovGG_QugelFswhWiZLdIwMFlMtC7PHZbl-JjrkwaonexoEahd1GDCS6K5jK4W7oegChlysU3kCw72cL965P0MWMyXdO_qeA")
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCode343(t *testing.T) {
|
func TestCode343(t *testing.T) {
|
||||||
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
||||||
data, err := a.GetTiktokOauth("ghUxJ6g1xQbW6_rfnoTRlHUnWZ2THaPXJuxekaQ0-kz_5gw-94onRi982egQshVtaS3Nl5tLj929_1BVBmO3hm0JHJqdj9MDUloLSBBXSn-j0sX0DA6JPOyCaFM&ttaceeda5333d7a7ab01")
|
data, err := a.GetTiktokOauth("eDpIjQ2VdK4MC8wE9ORO63adZECE8no_yNLXQYPaILyLUXF24K02PNcs84lQeeJn68EQJPIiV6DO5z3vHoqLom4dr4Fy4KMcZK7O4a3yAHK0Vgs9Vc-2u9vLwAg")
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ 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("输出tokenReq", tokenReq)
|
||||||
result, err := a.AccessAPI2(GetTiktokOauth, tokenReq)
|
result, err := a.AccessAPI2(GetTiktokOauth, tokenReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -28,6 +28,7 @@ func (a *API) GetTiktokOauth(code string) (*TiktokOauthResone, error) {
|
|||||||
if oauthAccessToken.ErrNo != 0 {
|
if oauthAccessToken.ErrNo != 0 {
|
||||||
return nil, errors.New(oauthAccessToken.ErrTips)
|
return nil, errors.New(oauthAccessToken.ErrTips)
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debug("再来输出一下oauthAccessToken", oauthAccessToken)
|
||||||
return oauthAccessToken, nil
|
return oauthAccessToken, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user