This commit is contained in:
邹宗楠
2022-03-30 11:17:04 +08:00
parent 907b265ba7
commit 0de43fb815
2 changed files with 5 additions and 1 deletions

View File

@@ -735,9 +735,12 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
} }
func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []string, isFocus, isHighPrice bool, priceType int, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) { func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []string, isFocus, isHighPrice bool, priceType int, keyword string, isBySku, isAct bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *dao.StoreSkuNamesInfo, err error) {
fmt.Println("用户入参storeIDs", storeIDs)
//权限 管理员/未登录人员不进入,商城不进入 //权限 管理员/未登录人员不进入,商城不进入
fmt.Println("用户权限", permission.IsRoled(ctx))
if permission.IsRoled(ctx) { if permission.IsRoled(ctx) {
if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil { if storeIDsMap, err := permission.GetUserStoresResultMap(ctx.GetUserID()); err == nil {
fmt.Println("用户权限门店", storeIDsMap)
var storeIDs2 []int var storeIDs2 []int
if len(storeIDs) > 0 { if len(storeIDs) > 0 {
for _, v := range storeIDs { for _, v := range storeIDs {
@@ -757,6 +760,7 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []string
storeIDs = storeIDs2 storeIDs = storeIDs2
} }
} }
fmt.Println("用户出参storeIDs", storeIDs)
return GetStoresSkusNew(ctx, storeIDs, skuIDs, upcs, isFocus, isHighPrice, priceType, keyword, isBySku, isAct, params, offset, pageSize) return GetStoresSkusNew(ctx, storeIDs, skuIDs, upcs, isFocus, isHighPrice, priceType, keyword, isBySku, isAct, params, offset, pageSize)
} }

View File

@@ -419,7 +419,7 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) {
func IsRoled(ctx *jxcontext.Context) bool { func IsRoled(ctx *jxcontext.Context) bool {
if ctx.GetUserName() != "jxadmin" { if ctx.GetUserName() != "jxadmin" {
if user, err := dao.GetUserByID(dao.GetDB(), "user_id", ctx.GetUserID()); err == nil { if user, err := dao.GetUserByID(dao.GetDB(), "user_id", ctx.GetUserID()); err == nil {
fmt.Println("user111111111111111", user.Type) fmt.Println("用户type", user.Type)
if user.Type&model.UserTypeRole != 0 { if user.Type&model.UserTypeRole != 0 {
return true return true
} }