40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitlab.33.cn/chat/dtalk/service/group/model/biz"
|
|
"gitlab.33.cn/chat/dtalk/service/group/model/types"
|
|
"gitlab.33.cn/utils/go-kit/convert"
|
|
)
|
|
|
|
func (s *Service) GetGroupApplysSvc(ctx context.Context, req *types.GetGroupApplysReq) (res *types.GetGroupApplysResp, err error) {
|
|
//personId := req.PersonId
|
|
groupId := convert.ToInt64(req.Id)
|
|
|
|
groupApplyBizs, err := s.getGroupApplys(groupId, req.Count, req.Offset)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
res = &types.GetGroupApplysResp{}
|
|
res.GroupApplys = make([]*types.GroupApplyInfo, 0)
|
|
for _, groupApplyBiz := range groupApplyBizs {
|
|
res.GroupApplys = append(res.GroupApplys, groupApplyBiz.ToTypes())
|
|
}
|
|
|
|
return res, nil
|
|
}
|
|
|
|
func (s *Service) getGroupApplys(groupId int64, limit, offset int32) ([]*biz.GroupApplyBiz, error) {
|
|
groupApplys, err := s.dao.GetGroupApplys(groupId, limit, offset)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
groupApplyBizs := make([]*biz.GroupApplyBiz, 0)
|
|
for _, groupApply := range groupApplys {
|
|
groupApplyBizs = append(groupApplyBizs, groupApply.ToBiz())
|
|
}
|
|
return groupApplyBizs, nil
|
|
}
|