...
|
...
|
@@ -3,12 +3,12 @@ package user |
|
|
import (
|
|
|
"context"
|
|
|
"github.com/samber/lo"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
...
|
...
|
@@ -42,13 +42,20 @@ func (l *MiniUserFollowingLogic) MiniUserFollowing(req *types.MiniUserFollowedSe |
|
|
total = int64(len(users))
|
|
|
offset, limit = domain.OffsetLimit(req.Page, req.Size)
|
|
|
)
|
|
|
users = lo.Slice(users, offset, offset+limit)
|
|
|
resp = &types.MiniUserFollowedSearchResponse{
|
|
|
Total: total,
|
|
|
List: make([]*types.UserFollowItem, 0),
|
|
|
}
|
|
|
for {
|
|
|
if offset > len(user.Following) {
|
|
|
break
|
|
|
}
|
|
|
users = lo.Slice(users, offset, offset+limit)
|
|
|
lo.ForEach(users, func(item int64, index int) {
|
|
|
if foundUser, _ := l.svcCtx.UserRepository.FindOne(l.ctx, conn, item); foundUser != nil {
|
|
|
if len(req.Name) > 0 && !strings.Contains(foundUser.Name, req.Name) {
|
|
|
return
|
|
|
}
|
|
|
var companyName = ""
|
|
|
if company, _ := domain.LazyLoad(companyMap, l.ctx, conn, foundUser.CompanyId, l.svcCtx.CompanyRepository.FindOne); company != nil {
|
|
|
companyName = company.Name
|
...
|
...
|
@@ -64,5 +71,11 @@ func (l *MiniUserFollowingLogic) MiniUserFollowing(req *types.MiniUserFollowedSe |
|
|
})
|
|
|
}
|
|
|
})
|
|
|
if len(resp.List) >= limit {
|
|
|
break
|
|
|
}
|
|
|
req.Page += 1
|
|
|
offset, limit = domain.OffsetLimit(req.Page, req.Size)
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|