1
This commit is contained in:
@@ -117,6 +117,7 @@ func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
|
|||||||
}
|
}
|
||||||
} else if model.IsSyncStatusNew(catInfo.CatSyncStatus) { // 新增 2
|
} else if model.IsSyncStatusNew(catInfo.CatSyncStatus) { // 新增 2
|
||||||
err = handler.CreateStoreCategory(ctx, storeID, vendorStoreID, catInfo)
|
err = handler.CreateStoreCategory(ctx, storeID, vendorStoreID, catInfo)
|
||||||
|
globals.SugarLogger.Debugf("CreateStoreCategory err ========= %v", err)
|
||||||
if err != nil && handler.IsErrCategoryExist(err) {
|
if err != nil && handler.IsErrCategoryExist(err) {
|
||||||
if cat, err2 := handler.GetStoreCategory(ctx, storeID, vendorStoreID, catInfo.Name); err2 == nil {
|
if cat, err2 := handler.GetStoreCategory(ctx, storeID, vendorStoreID, catInfo.Name); err2 == nil {
|
||||||
catInfo.VendorCatID = cat.VendorCatID
|
catInfo.VendorCatID = cat.VendorCatID
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
"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"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"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:
|
case model.VendorIDTaoVegetable:
|
||||||
api := api.TaoVegetableApi
|
api := api.TaoVegetableApi
|
||||||
globals.SugarLogger.Debugf("api :======= %s,%s", utils.Format4Output(api.GetToken(), false), api.GetAppSecret())
|
|
||||||
if beego.BConfig.RunMode == "dev" {
|
if beego.BConfig.RunMode == "dev" {
|
||||||
api.SetToken("50002C00414zMSClqLiSDjBr2N19748391yiazjtFmsgTOdbBftik0XDfkUQywSmcjfC")
|
api.SetToken("50002C00414zMSClqLiSDjBr2N19748391yiazjtFmsgTOdbBftik0XDfkUQywSmcjfC")
|
||||||
} else if api == nil || api.GetToken() == "" {
|
} else if api == nil || api.GetToken() == "" {
|
||||||
codes, _ := dao.GetVendorOrgCode(db, vendorID, appOrgCode, "platform")
|
codes, _ := dao.GetVendorOrgCode(db, vendorID, appOrgCode, "platform")
|
||||||
globals.SugarLogger.Debugf("api :======= %s", utils.Format4Output(codes, false))
|
|
||||||
if len(codes) == 0 {
|
if len(codes) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
code := codes[0]
|
code := codes[0]
|
||||||
api = tao_vegetable.NewTaoVegetable(code.AppKey, code.AppSecret, beego.AppConfig.DefaultString("taoVegetableServerUrl", ""))
|
api = tao_vegetable.NewTaoVegetable(code.AppKey, code.AppSecret, beego.AppConfig.DefaultString("taoVegetableServerUrl", ""))
|
||||||
if code.Token != "" {
|
if code.Token != "" {
|
||||||
globals.SugarLogger.Debugf("code token :======= %s", utils.Format4Output(code.Token, false))
|
|
||||||
var tokenInfo *tao_vegetable.StoreTokenInfo
|
var tokenInfo *tao_vegetable.StoreTokenInfo
|
||||||
if err := json.Unmarshal([]byte(code.Token), &tokenInfo); err != nil {
|
if err := json.Unmarshal([]byte(code.Token), &tokenInfo); err != nil {
|
||||||
globals.SugarLogger.Debugf("get token err :======= %s", utils.Format4Output(err, false))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("get token :======= %s", utils.Format4Output(tokenInfo, false))
|
|
||||||
if tokenInfo.AccessToken != "" && tokenInfo.ExpireTime > time.Now().UnixNano()/1e6 {
|
if tokenInfo.AccessToken != "" && tokenInfo.ExpireTime > time.Now().UnixNano()/1e6 {
|
||||||
api.SetToken(tokenInfo.AccessToken)
|
api.SetToken(tokenInfo.AccessToken)
|
||||||
globals.SugarLogger.Debugf("get token :======= %s", utils.Format4Output(api.GetToken(), false))
|
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debugf("msg================")
|
|
||||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "淘鲜达token过期", ",请重新授权")
|
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "淘鲜达token过期", ",请重新授权")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("api 2:======= %s", utils.Format4Output(api.GetToken(), false))
|
|
||||||
|
|
||||||
pfAPI = api
|
pfAPI = api
|
||||||
case model.VendorIDEBAI:
|
case model.VendorIDEBAI:
|
||||||
|
|||||||
Reference in New Issue
Block a user