1
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"github.com/pkg/errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type StoreController struct {
|
||||
@@ -720,7 +721,7 @@ func (c *StoreController) GetStoreCategoryMap() {
|
||||
// 获取门店分类
|
||||
categoryList, err := cms.GetStoreCategoryMap(params.Ctx, params.ParentID, params.Level, params.StoreID)
|
||||
// 门店为b2b
|
||||
if store[0].BrandID == model.B2BNumberId || params.StoreID == model.MatterStoreID{
|
||||
if store[0].BrandID == model.B2BNumberId || params.StoreID == model.MatterStoreID {
|
||||
// 获取用户权限,如果是普通用户不展示b2b相关目录,如果是门店老板或者管理则展示全部
|
||||
userAuth, err := auth2.GetTokenInfo(params.Token)
|
||||
if err != nil {
|
||||
@@ -732,14 +733,16 @@ func (c *StoreController) GetStoreCategoryMap() {
|
||||
return nil, "", err
|
||||
}
|
||||
if len(userRole) == 0 { // 普通用户,无用户权限
|
||||
//result := make([]*model.StoreCategoryMap, 0, 0)
|
||||
//for _, v := range categoryList {
|
||||
// if !strings.Contains(v.StoreCategoryName, model.B2BTag) {
|
||||
// result = append(result, v)
|
||||
// }
|
||||
//}
|
||||
return nil, "", errors.New("用户为普通用户,无法查看B2B门店信息")
|
||||
}
|
||||
} else {
|
||||
result := make([]*model.StoreCategoryMap, 0, 0)
|
||||
for _, v := range categoryList {
|
||||
if !strings.Contains(v.StoreCategoryName, model.B2BTag) {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
return result, "", err
|
||||
}
|
||||
return categoryList, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user