Refactor code

pull/131/head
wenxu12345 3 years ago
parent 6e14375b86
commit 9f55418bfb

@ -253,7 +253,7 @@ func CreateGroup(c *gin.Context) {
if RpcResp.ErrCode == 0 { if RpcResp.ErrCode == 0 {
utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo) utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo)
} }
log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp) log.NewInfo(req.OperationID, "CreateGroup api return ", resp)
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
} }

@ -111,7 +111,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
for _, user := range req.InitMemberList { for _, user := range req.InitMemberList {
us, err := im_mysql_model.GetUserByUserID(user.UserID) us, err := im_mysql_model.GetUserByUserID(user.UserID)
if err != nil { if err != nil {
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.UserID) log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), user.UserID)
continue continue
} }
if user.RoleLevel == constant.GroupOwner { if user.RoleLevel == constant.GroupOwner {
@ -133,7 +133,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
} }
} }
resp := &pbGroup.CreateGroupResp{} resp := &pbGroup.CreateGroupResp{GroupInfo: &open_im_sdk.GroupInfo{}}
group, err := im_mysql_model.GetGroupInfoByGroupID(groupId) group, err := im_mysql_model.GetGroupInfoByGroupID(groupId)
if err != nil { if err != nil {
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId) log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId)
@ -143,7 +143,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
} }
chat.GroupCreatedNotification(req.OperationID, req.OpUserID, req.OwnerUserID, groupId, okUserIDList) chat.GroupCreatedNotification(req.OperationID, req.OpUserID, req.OwnerUserID, groupId, okUserIDList)
utils.CopyStructFields(resp.GroupInfo, group) utils.CopyStructFields(resp.GroupInfo, group)
resp.GroupInfo.MemberCount = uint32(imdb.GetGroupMemberNumByGroupID(groupId)) resp.GroupInfo.MemberCount = imdb.GetGroupMemberNumByGroupID(groupId)
resp.GroupInfo.OwnerUserID = req.OwnerUserID resp.GroupInfo.OwnerUserID = req.OwnerUserID
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String()) log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())

Loading…
Cancel
Save