不能重复绑定平台门店

This commit is contained in:
苏尹岚
2020-08-20 08:56:55 +08:00
parent 1372895cec
commit b9c5369fb3

View File

@@ -1186,6 +1186,10 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
} }
} }
} }
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(db, storeMap.VendorStoreID, storeMap.VendorID)
if storeDetail != nil {
return nil, fmt.Errorf("此平台门店ID已在京西有绑定请先解除绑定平台门店ID :[%v]", storeMap.VendorStoreID)
}
storeMapList, err := dao.GetStoresMapList2(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", true) storeMapList, err := dao.GetStoresMapList2(db, []int{vendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", true)
if len(storeMapList) > 0 { if len(storeMapList) > 0 {
_, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName) _, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName)