This commit is contained in:
邹宗楠
2022-08-31 11:11:45 +08:00
parent 6a1c183c28
commit b6c64a493f
2 changed files with 25 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package tiktok_api
import (
"encoding/json"
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
"git.rosy.net.cn/jx-callback/globals"
"time"
@@ -16,7 +17,17 @@ type Api struct {
expiresIn int64
}
func New(appKey, appSecret string) *Api {
func New(appKey, appSecret, accessToken string) *Api {
var access *doudian_sdk.AccessToken
if accessToken != "" {
if err := json.Unmarshal([]byte(accessToken), &access); err != nil {
globals.SugarLogger.Debug("accessToken init err :", err)
return nil
} else {
AccessToken = access
}
}
return &Api{
appKey: appKey,
appSecret: appSecret,