Files
chain33-dtalk/service/group/service/getgroupapplys.go
2022-03-17 15:59:24 +08:00

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
}