+ IPurchasePlatformHandler.UpdateStoreCustomID

- 删除平台门店时,将平台门店的CUSTOMID设置为其平台ID本身
- 饿了么与微商城handler不注册了
This commit is contained in:
gazebo
2019-09-01 15:27:06 +08:00
parent 51727df4de
commit 0331e704e0
7 changed files with 36 additions and 12 deletions

View File

@@ -872,15 +872,18 @@ func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
if db == nil {
db = dao.GetDB()
}
storeMap := &model.StoreMap{}
if num, err = dao.DeleteEntityLogically(db, storeMap, map[string]interface{}{
model.FieldSyncStatus: model.SyncFlagDeletedMask,
model.FieldStatus: model.StoreStatusDisabled,
}, userName, map[string]interface{}{
model.FieldStoreID: storeID,
model.FieldVendorID: vendorID,
}); err == nil && num > 0 {
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
storeMap := &model.StoreMap{
StoreID: storeID,
VendorID: vendorID,
}
storeMap.DeletedAt = utils.DefaultTimeValue
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err == nil {
if handler := partner.GetPurchasePlatformFromVendorID(vendorID); handler != nil {
handler.UpdateStoreCustomID(ctx, storeMap.VendorStoreID, utils.Str2Int64WithDefault(storeMap.VendorStoreID, 0))
}
num, err = dao.DeleteEntityLogically(db, storeMap, map[string]interface{}{
model.FieldStatus: model.StoreStatusDisabled,
}, userName, nil)
}
return num, err
}

View File

@@ -142,6 +142,7 @@ type IPurchasePlatformHandler interface {
ReadStore(ctx *jxcontext.Context, vendorStoreID string) (store *dao.StoreDetail, err error)
UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error)
GetStoreStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeStatus int, err error)
UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error)
// EnableAutoAcceptOrder(vendorStoreID string, isEnabled bool) error
// OpenStore(vendorStoreID string, userName string) error
// CloseStore(vendorStoreID, closeNotice, userName string) error

View File

@@ -171,7 +171,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
}
if err == nil {
if shopID > 0 {
err = api.EbaiAPI.ShopIDBatchUpdate([]string{store.VendorStoreID}, []string{utils.Int2Str(shopID)})
err = p.UpdateStoreCustomID(jxcontext.AdminCtx, store.VendorStoreID, int64(shopID))
} else if shopID == 0 {
// todo remove out shop id
}
@@ -486,3 +486,10 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorSt
}
return vendorStoreIDs, err
}
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
if globals.EnableJdStoreWrite {
err = api.EbaiAPI.ShopIDBatchUpdate([]string{vendorStoreID}, []string{utils.Int64ToStr(storeID)})
}
return err
}

View File

@@ -23,7 +23,7 @@ type PurchaseHandler struct {
func init() {
if api.ElmAPI != nil {
curPurchaseHandler = new(PurchaseHandler)
partner.RegisterPurchasePlatform(curPurchaseHandler)
// partner.RegisterPurchasePlatform(curPurchaseHandler)
}
}

View File

@@ -462,3 +462,12 @@ func (c *PurchaseHandler) SyncQualify(ctx *jxcontext.Context, storeDetail *dao.S
}
return addStoreInfo2Err(err, storeDetail.ID)
}
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
if globals.EnableJdStoreWrite {
err = getAPI("").UpdateStoreInfo4Open(vendorStoreID, ctx.GetUserName(), map[string]interface{}{
jdapi.KeyOutSystemId: utils.Int64ToStr(storeID),
})
}
return err
}

View File

@@ -255,3 +255,7 @@ func (c *PurchaseHandler) GetAllStoresVendorID(ctx *jxcontext.Context) (vendorSt
vendorStoreIDs, err = api.MtwmAPI.PoiGetIDs()
return vendorStoreIDs, err
}
func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorStoreID string, storeID int64) (err error) {
return err
}

View File

@@ -26,7 +26,7 @@ type PurchaseHandler struct {
func init() {
if api.WeimobAPI != nil {
curPurchaseHandler = new(PurchaseHandler)
partner.RegisterPurchasePlatform(curPurchaseHandler)
// partner.RegisterPurchasePlatform(curPurchaseHandler)
}
}