fix: 修复店铺资金摘要接口username和phone字段为空的bug
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m17s

问题原因:GetPrimaryAccountsByShopIDs 在 Store 层重复应用了数据权限过滤,
导致当前用户无权限访问的店铺账号被错误过滤,accountMap 为 nil,
最终返回的 username 和 phone 为空字符串。

解决方案:移除 Store 层的 ApplyShopFilter 权限过滤,
因为调用方(Service 层)已经保证了 shopIDs 的合法性。
This commit is contained in:
2026-04-10 17:21:27 +08:00
parent a8b52f8ae1
commit 67f3286e09

View File

@@ -261,8 +261,9 @@ func (s *AccountStore) GetPrimaryAccountsByShopIDs(ctx context.Context, shopIDs
var accounts []*model.Account
query := s.db.WithContext(ctx).
Where("shop_id IN ? AND is_primary = ?", shopIDs, true)
// 应用数据权限过滤
query = middleware.ApplyShopFilter(ctx, query)
// 注意:此处不再应用数据权限过滤
// 因为调用方Service 层)已经保证了 shopIDs 的合法性
// 在 ListShopFundSummary 场景中,店铺列表已由 Service 层过滤
if err := query.Find(&accounts).Error; err != nil {
return nil, err
}