Refactor code

pull/131/head
wenxu12345 3 years ago
parent 7574d06718
commit 89d69a8fb6

@ -3,6 +3,8 @@ package group
import (
api "Open_IM/pkg/base_info"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"

@ -447,6 +447,28 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G
}
chat.ApplicationProcessedNotification(req)
if req.HandleResult == constant.GroupResponseAgree {
if req.HandleResult == constant.GroupResponseAgree {
user, err := imdb.GetUserByUserID(req.FromUserID)
if err != nil {
log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), req.FromUserID)
return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
member := imdb.GroupMember{}
member.GroupID = req.GroupID
member.UserID = req.FromUserID
member.RoleLevel = constant.GroupOrdinaryUsers
member.OperatorUserID = req.OpUserID
member.FaceUrl = user.FaceUrl
member.Nickname = user.Nickname
err = imdb.InsertIntoGroupMember(member)
if err != nil {
log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), req.FromUserID)
return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
}
}
chat.MemberEnterNotification(req)
}

Loading…
Cancel
Save