From a7ea8301b11f09d279616dcc4643c6b086b41a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 22 Jan 2021 10:43:44 +0800 Subject: [PATCH] aa --- business/jxstore/cms/permission.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/business/jxstore/cms/permission.go b/business/jxstore/cms/permission.go index 36c12c9e2..ffac9d537 100644 --- a/business/jxstore/cms/permission.go +++ b/business/jxstore/cms/permission.go @@ -339,23 +339,28 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) { } } for k, _ := range brandIDMap { - if k != 0 { - brandIDs = append(brandIDs, k) - } + brandIDs = append(brandIDs, k) } for k, _ := range cityCodeMap { cityCodes = append(cityCodes, k) } for k, _ := range storeIDMap { - if k != 0 { - storeIDs = append(storeIDs, k) + storeIDs = append(storeIDs, k) + } + if brandIDMap[0] != 0 { + if cityCodeMap[0] != 0 { + stores, err = dao.GetStoreList(db, nil, nil, nil, nil, nil, "") + } else { + stores, err = dao.GetStoreList(db, storeIDs, cityCodes, nil, nil, nil, "") + } + } else { + if cityCodeMap[0] != 0 { + stores, err = dao.GetStoreList(db, nil, nil, nil, brandIDs, nil, "") + } else { + stores, err = dao.GetStoreList(db, storeIDs, cityCodes, nil, brandIDs, nil, "") } } - if cityCodeMap[0] != 0 { - stores, err = dao.GetStoreList(db, nil, nil, nil, brandIDs, nil, "") - } else { - stores, err = dao.GetStoreList(db, storeIDs, cityCodes, nil, brandIDs, nil, "") - } + for _, v := range stores { if _, ok := resultMap[v.ID]; !ok { resultMap[v.ID] = v.ID