修复(#128): 修复家庭成员邀请流水可见性
Build docker and publish / build (20.15.1) (push) Failing after 18m41s
Build docker and publish / build (20.15.1) (pull_request) Failing after 19m16s

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-05-30 03:27:04 -07:00
parent c2d1b5a0d8
commit 0659a930f8
2 changed files with 38 additions and 6 deletions
@@ -113,12 +113,17 @@ func (l *GetInviteRecordsLogic) GetInviteRecords(req *types.GetInviteRecordsRequ
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "query orders failed: %v", err.Error())
}
visibleUserIdSet := make(map[int64]struct{}, len(visibleUserIds))
for _, userId := range visibleUserIds {
visibleUserIdSet[userId] = struct{}{}
}
allRecords := make([]types.InviteRecord, 0, len(parsedLogs))
for _, parsed := range parsedLogs {
content := parsed.content
logItem := parsed.log
orderInfo, hasOrder := orders[content.OrderNo]
if !l.canViewInviteRecord(u.Id, logItem.ObjectId, hasOrder, orderInfo) {
if !l.canViewInviteRecord(u.Id, logItem.ObjectId, visibleUserIdSet, hasOrder, orderInfo) {
continue
}
@@ -177,17 +182,17 @@ func (l *GetInviteRecordsLogic) resolveInviteRecordVisibleUserIds(currentUserId
return nil, err
}
func (l *GetInviteRecordsLogic) canViewInviteRecord(currentUserId, logObjectId int64, hasOrder bool, orderInfo inviteOrderUser) bool {
func (l *GetInviteRecordsLogic) canViewInviteRecord(currentUserId, logObjectId int64, visibleUserIds map[int64]struct{}, hasOrder bool, orderInfo inviteOrderUser) bool {
if _, ok := visibleUserIds[logObjectId]; !ok {
return false
}
if logObjectId == currentUserId {
if hasOrder {
return orderInfo.UserId == currentUserId || orderInfo.RefererId == currentUserId
}
return true
}
if !hasOrder {
return false
}
return orderInfo.UserId == currentUserId && orderInfo.SubscriptionUserId == logObjectId
return true
}
func normalizeInviteRecordsPagination(req *types.GetInviteRecordsRequest) {