This commit is contained in:
苏尹岚
2021-02-18 11:55:47 +08:00
parent 0ca51ca7fc
commit 66194c55f9
5 changed files with 54 additions and 33 deletions

View File

@@ -1266,6 +1266,17 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
if _, err = SetStoreSkuSyncStatus2(db, []int{storeID}, []int{model.VendorIDJDShop}, findSkusBetweenJdsMainStore(db, storeID), model.SyncFlagSaleMask); err == nil {
// CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, nil, []int{storeID}, nil, false, true, true)
}
} else if vendorID == model.VendorIDMTWM {
//如果是绑的美团超市要去更新token
if outStoreMap.VendorOrgCode == globals.Mtwm2Code {
// mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, outStoreMap.VendorOrgCode).(*mtwmapi.API)
// if result, err := mtapi.GetOAuthCode(outStoreMap.VendorStoreID); result != nil && err == nil {
// if token, err := mtapi.GetAccessToken(result.(string)); err == nil && token != nil {
// outStoreMap.MtwmToken = token.(string)
// dao.UpdateEntity(db, outStoreMap, "MtwmToken")
// }
// }
}
}
if globals.IsAddEvent {
err = AddEventDetail(db, ctx, model.OperateAdd, vendorID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`)
@@ -3950,3 +3961,15 @@ func GetBrandStore(ctx *jxcontext.Context, name string) (brands []*model.BrandSt
err = dao.GetRows(db, &brands, sql, sqlParams)
return brands, err
}
func RefreshMTWMToken(ctx *jxcontext.Context) (err error) {
// var (
// db = dao.GetDB()
// )
// if time.Now().Weekday() != time.Sunday {
// return
// }
// //token是1个月过期每周刷一次吧
// dao.GetStoresMapList(db, []int{model.VendorIDMTWM}, nil, nil, status, isSync, "", "", globals.Mtwm2Code)
return err
}