- 修改门店状态同步逻辑,只有在京西本地修改过门店状态相关的信息后才同步
This commit is contained in:
@@ -530,7 +530,19 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
|||||||
if err = dao.GetEntity(db, store); err != nil {
|
if err = dao.GetEntity(db, store); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
valid := dao.StrictMakeMapByStructObject(payload, store, userName)
|
||||||
|
if payload["lng"] != nil || payload["lat"] != nil {
|
||||||
|
intLng := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["lng"], 0.0))
|
||||||
|
intLat := jxutils.StandardCoordinate2Int(utils.Interface2Float64WithDefault(payload["lat"], 0.0))
|
||||||
|
if intLng != 0 && intLng != store.Lng {
|
||||||
|
valid["lng"] = intLng
|
||||||
|
}
|
||||||
|
if intLat != 0 && intLat != store.Lng {
|
||||||
|
valid["lat"] = intLat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if valid["originalName"] != nil {
|
if valid["originalName"] != nil {
|
||||||
delete(valid, "originalName")
|
delete(valid, "originalName")
|
||||||
}
|
}
|
||||||
@@ -589,18 +601,15 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
|||||||
"address",
|
"address",
|
||||||
"deliveryRange",
|
"deliveryRange",
|
||||||
} {
|
} {
|
||||||
if payload[v] != nil {
|
if valid[v] != nil {
|
||||||
syncStatus |= model.SyncFlagStoreAddress
|
syncStatus |= model.SyncFlagStoreAddress
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var lng, lat float64
|
if valid["status"] != nil {
|
||||||
if payload["lng"] != nil || payload["lat"] != nil {
|
syncStatus |= model.SyncFlagStoreStatus
|
||||||
lng = utils.Interface2Float64WithDefault(payload["lng"], 0.0)
|
|
||||||
lat = utils.Interface2Float64WithDefault(payload["lat"], 0.0)
|
|
||||||
valid["lng"] = jxutils.StandardCoordinate2Int(lng)
|
|
||||||
valid["lat"] = jxutils.StandardCoordinate2Int(lat)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if valid["deliveryRange"] != nil {
|
if valid["deliveryRange"] != nil {
|
||||||
valid["deliveryRange"] = strings.Trim(valid["deliveryRange"].(string), ";")
|
valid["deliveryRange"] = strings.Trim(valid["deliveryRange"].(string), ";")
|
||||||
}
|
}
|
||||||
@@ -830,7 +839,11 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
|
if err = dao.GetEntity(db, storeMap, model.FieldStoreID, model.FieldVendorID, model.FieldDeletedAt); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
syncStatus := model.SyncFlagModifiedMask
|
||||||
valid := dao.StrictMakeMapByStructObject(payload, storeMap, userName)
|
valid := dao.StrictMakeMapByStructObject(payload, storeMap, userName)
|
||||||
|
if valid["status"] != nil {
|
||||||
|
syncStatus |= model.SyncFlagStoreStatus
|
||||||
|
}
|
||||||
if valid["pricePercentagePack"] != nil {
|
if valid["pricePercentagePack"] != nil {
|
||||||
if pricePercentagePack := utils.Interface2String(valid["pricePercentagePack"]); pricePercentagePack != "" {
|
if pricePercentagePack := utils.Interface2String(valid["pricePercentagePack"]); pricePercentagePack != "" {
|
||||||
_, err2 := dao.QueryConfigs(db, pricePercentagePack, model.ConfigTypePricePack, "")
|
_, err2 := dao.QueryConfigs(db, pricePercentagePack, model.ConfigTypePricePack, "")
|
||||||
@@ -857,7 +870,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
|
|||||||
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
|
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
|
||||||
model.FieldStoreID: storeID,
|
model.FieldStoreID: storeID,
|
||||||
model.FieldVendorID: vendorID,
|
model.FieldVendorID: vendorID,
|
||||||
}, model.FieldSyncStatus, model.SyncFlagModifiedMask)
|
}, model.FieldSyncStatus, syncStatus)
|
||||||
} else {
|
} else {
|
||||||
num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{
|
num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{
|
||||||
model.FieldStoreID: storeID,
|
model.FieldStoreID: storeID,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ const (
|
|||||||
|
|
||||||
SyncFlagStoreName = 8
|
SyncFlagStoreName = 8
|
||||||
SyncFlagStoreAddress = 16
|
SyncFlagStoreAddress = 16
|
||||||
|
SyncFlagStoreStatus = 32
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsSyncStatusNew(syncStatus int8) bool {
|
func IsSyncStatusNew(syncStatus int8) bool {
|
||||||
|
|||||||
@@ -177,10 +177,12 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
mergeStatus := jxutils.MergeStoreStatus(store.Status, store.EbaiStoreStatus)
|
||||||
if err = p.updateStoreStatus(userName, storeID, store.VendorStoreID, mergeStatus, store2.Status); err != nil {
|
if err = p.updateStoreStatus(userName, storeID, store.VendorStoreID, mergeStatus, store2.Status); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
params := genStoreMapFromStore(store)
|
params := genStoreMapFromStore(store)
|
||||||
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
if err = api.EbaiAPI.ShopUpdate(params); err == nil {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
params["deliveryRangeRadius"] = utils.Str2Int64WithDefault(store.DeliveryRange, 0)
|
params["deliveryRangeRadius"] = utils.Str2Int64WithDefault(store.DeliveryRange, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
_, params["closeStatus"] = JxStoreStatus2JdStatus(jxutils.MergeStoreStatus(store.Status, store.JdStoreStatus))
|
_, params["closeStatus"] = JxStoreStatus2JdStatus(jxutils.MergeStoreStatus(store.Status, store.JdStoreStatus))
|
||||||
|
}
|
||||||
globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
globals.SugarLogger.Debug(utils.Format4Output(params, false))
|
||||||
if globals.EnableJdStoreWrite {
|
if globals.EnableJdStoreWrite {
|
||||||
if err = api.JdAPI.UpdateStoreInfo4Open(store.VendorStoreID, store.RealLastOperator, params); err != nil {
|
if err = api.JdAPI.UpdateStoreInfo4Open(store.VendorStoreID, store.RealLastOperator, params); err != nil {
|
||||||
|
|||||||
@@ -129,7 +129,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
// if globals.EnableMtwmStoreWrite {
|
// if globals.EnableMtwmStoreWrite {
|
||||||
// err = api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params)
|
// err = api.MtwmAPI.PoiSave(storeDetail.VendorStoreID, params)
|
||||||
// }
|
// }
|
||||||
|
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {
|
||||||
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
|
errList.AddErr(p.UpdateStoreStatus(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, jxutils.MergeStoreStatus(storeDetail.Status, storeDetail.VendorStatus)))
|
||||||
|
}
|
||||||
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
errList.AddErr(p.UpdateStoreOpTime(jxcontext.AdminCtx, storeID, storeDetail.VendorStoreID, storeDetail.GetOpTimeList()))
|
||||||
return errList.GetErrListAsOne()
|
return errList.GetErrListAsOne()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user