fk
This commit is contained in:
@@ -783,9 +783,11 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if linkStoreID != 0 {
|
||||
if err = checkStoreHaveLinkedStore(storeID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
valid["linkStoreID"] = linkStoreID
|
||||
// globals.SugarLogger.Debug(linkStoreID)
|
||||
}
|
||||
@@ -1011,7 +1013,6 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
}
|
||||
|
||||
func checkStoreHaveLinkedStore(storeID int) (err error) {
|
||||
if storeID != 0 {
|
||||
storeList, err := dao.GetStoreLinkStores(dao.GetDB(), storeID)
|
||||
if err == nil {
|
||||
if len(storeList) > 0 {
|
||||
@@ -1022,7 +1023,6 @@ func checkStoreHaveLinkedStore(storeID int) (err error) {
|
||||
err = fmt.Errorf("门店%d已经被其它门店(%s)关联,不能再关联至其它门店", storeID, strings.Join(storeInfo, ","))
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1045,9 +1045,11 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if realLinkStoreID != 0 {
|
||||
if err = checkStoreHaveLinkedStore(storeExt.ID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
storeExt.LinkStoreID = realLinkStoreID
|
||||
|
||||
existingID := store.ID
|
||||
|
||||
Reference in New Issue
Block a user