1
This commit is contained in:
@@ -2,7 +2,6 @@ package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
||||
@@ -10,11 +9,8 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"github.com/pkg/errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type StoreController struct {
|
||||
@@ -709,43 +705,8 @@ func (c *StoreController) DeletePrinterSeq() {
|
||||
// @router /GetStoreCategoryMap [get]
|
||||
func (c *StoreController) GetStoreCategoryMap() {
|
||||
c.callGetStoreCategoryMap(func(params *tStoreGetStoreCategoryMapParams) (retVal interface{}, errCode string, err error) {
|
||||
// 判断门店是不是b2b门店,如果是,用户必须为系统管理员(门店老板和运营人员)
|
||||
store, err := dao.GetStoreList(dao.GetDB(), []int{params.StoreID}, nil, nil, nil, nil, "")
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if len(store) != model.YES {
|
||||
return nil, "", errors.New("门店数据异常,门店id不唯一:" + string(params.StoreID))
|
||||
}
|
||||
// 获取门店分类
|
||||
categoryList, err := cms.GetStoreCategoryMap(params.Ctx, params.ParentID, params.Level, params.StoreID)
|
||||
// 门店为b2b
|
||||
if store[0].BrandID == model.B2BNumberId || params.StoreID == model.MatterStoreID {
|
||||
// 获取用户权限,如果是普通用户不展示b2b相关目录,如果是门店老板或者管理则展示全部
|
||||
userAuth, err := auth2.GetTokenInfo(params.Token)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
user, total, err := dao.GetUsers(dao.GetDB(), 1, "", []string{userAuth.UserID}, nil, nil, 0, 1)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if total != model.YES {
|
||||
return nil, "", errors.New("未注册用户")
|
||||
}
|
||||
if user[0].Type == model.YES { // 普通用户,无用户权限
|
||||
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