修复超管无法回收资产的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m0s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m0s
This commit is contained in:
@@ -7,9 +7,11 @@ import (
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/logger"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/middleware"
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -215,6 +217,11 @@ func (s *ShopStore) GetByIDs(ctx context.Context, ids []uint) ([]*model.Shop, er
|
||||
var shops []*model.Shop
|
||||
query := s.db.WithContext(ctx).Where("id IN ?", ids)
|
||||
// 应用数据权限过滤:代理用户只能看到自己店铺及下级店铺
|
||||
subordinateShopIDs := middleware.GetSubordinateShopIDs(ctx)
|
||||
logger.GetAppLogger().Debug("GetByIDs 数据权限过滤",
|
||||
zap.Uints("requested_ids", ids),
|
||||
zap.Any("subordinate_shop_ids", subordinateShopIDs),
|
||||
zap.Int("user_type", middleware.GetUserTypeFromContext(ctx)))
|
||||
query = middleware.ApplyShopIDFilter(ctx, query)
|
||||
if err := query.Find(&shops).Error; err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user