1
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
@@ -70,35 +69,27 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
|
||||
}
|
||||
case model.VendorIDTaoVegetable:
|
||||
api := api.TaoVegetableApi
|
||||
globals.SugarLogger.Debugf("api :======= %s,%s", utils.Format4Output(api.GetToken(), false), api.GetAppSecret())
|
||||
if beego.BConfig.RunMode == "dev" {
|
||||
api.SetToken("50002C00414zMSClqLiSDjBr2N19748391yiazjtFmsgTOdbBftik0XDfkUQywSmcjfC")
|
||||
} else if api == nil || api.GetToken() == "" {
|
||||
codes, _ := dao.GetVendorOrgCode(db, vendorID, appOrgCode, "platform")
|
||||
globals.SugarLogger.Debugf("api :======= %s", utils.Format4Output(codes, false))
|
||||
if len(codes) == 0 {
|
||||
return nil
|
||||
}
|
||||
code := codes[0]
|
||||
api = tao_vegetable.NewTaoVegetable(code.AppKey, code.AppSecret, beego.AppConfig.DefaultString("taoVegetableServerUrl", ""))
|
||||
if code.Token != "" {
|
||||
globals.SugarLogger.Debugf("code token :======= %s", utils.Format4Output(code.Token, false))
|
||||
var tokenInfo *tao_vegetable.StoreTokenInfo
|
||||
if err := json.Unmarshal([]byte(code.Token), &tokenInfo); err != nil {
|
||||
globals.SugarLogger.Debugf("get token err :======= %s", utils.Format4Output(err, false))
|
||||
return nil
|
||||
}
|
||||
globals.SugarLogger.Debugf("get token :======= %s", utils.Format4Output(tokenInfo, false))
|
||||
if tokenInfo.AccessToken != "" && tokenInfo.ExpireTime > time.Now().UnixNano()/1e6 {
|
||||
api.SetToken(tokenInfo.AccessToken)
|
||||
globals.SugarLogger.Debugf("get token :======= %s", utils.Format4Output(api.GetToken(), false))
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("msg================")
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "淘鲜达token过期", ",请重新授权")
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("api 2:======= %s", utils.Format4Output(api.GetToken(), false))
|
||||
|
||||
pfAPI = api
|
||||
case model.VendorIDEBAI:
|
||||
|
||||
Reference in New Issue
Block a user