This commit is contained in:
gazebo
2018-09-15 09:15:40 +08:00
parent da6c411c74
commit b2d365e36f
8 changed files with 72 additions and 48 deletions

View File

@@ -306,11 +306,3 @@ func UpdateStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, payload map[stri
}
return num, err
}
// 合并得到最终的门店状态
func mergeStoreStatus(status int, vendorStatus int) int {
if status < vendorStatus {
return status
}
return vendorStatus
}

View File

@@ -52,11 +52,9 @@ func (v *VendorSync) SyncStore(db *dao.DaoDB, vendorID int, store *model.Store,
}
storeMapList, err := v.GetStoreMapInfo(db, store.ID)
if err == nil {
copiedStore := *store
for _, storeMap := range storeMapList {
if (vendorID == -1 || vendorID == storeMap.VendorID) && (isForce || storeMap.SyncStatus != 0) { // 对于门店,当前只有修改标记
copiedStore.Status = mergeStoreStatus(store.Status, storeMap.Status)
if err = GetPurchaseHandler(storeMap.VendorID).UpdateStore(storeMap.VendorStoreID, &copiedStore, userName); err == nil {
if err = GetPurchaseHandler(storeMap.VendorID).UpdateStore(store.ID); err == nil {
storeMap.SyncStatus = 0
dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
}