mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 11:06:43 +08:00
Merge remote-tracking branch 'origin/tuoyun' into tuoyun
This commit is contained in:
commit
40ed7258d4
@ -251,9 +251,9 @@ func CreateGroup(c *gin.Context) {
|
||||
|
||||
resp := api.CreateGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
if RpcResp.ErrCode == 0 {
|
||||
utils.CopyStructFields(&resp.GroupInfo, &RpcResp.GroupInfo)
|
||||
utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo)
|
||||
}
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup api return ", RpcResp)
|
||||
log.NewInfo(req.OperationID, "CreateGroup api return ", 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 {
|
||||
us, err := im_mysql_model.GetUserByUserID(user.UserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.UserID)
|
||||
log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), user.UserID)
|
||||
continue
|
||||
}
|
||||
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)
|
||||
if err != nil {
|
||||
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)
|
||||
utils.CopyStructFields(resp.GroupInfo, group)
|
||||
resp.GroupInfo.MemberCount = uint32(imdb.GetGroupMemberNumByGroupID(groupId))
|
||||
resp.GroupInfo.MemberCount = imdb.GetGroupMemberNumByGroupID(groupId)
|
||||
resp.GroupInfo.OwnerUserID = req.OwnerUserID
|
||||
|
||||
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())
|
||||
@ -195,7 +195,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
||||
|
||||
_, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", req.GroupID, err)
|
||||
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", req.GroupID, err)
|
||||
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
//
|
||||
@ -209,7 +209,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
||||
resultNode.Result = 0
|
||||
toUserInfo, err := imdb.GetUserByUserID(v)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), v)
|
||||
log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), v)
|
||||
resultNode.Result = -1
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||
continue
|
||||
@ -253,7 +253,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrDB.ErrCode
|
||||
resp.ErrMsg = constant.ErrDB.ErrMsg
|
||||
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed,", err.Error(), req.GroupID)
|
||||
log.NewError(req.OperationID, "GetGroupMemberListByGroupID failed,", err.Error(), req.GroupID)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
@ -411,7 +411,7 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
|
||||
for _, groupID := range req.GroupIDList {
|
||||
groupInfoFromMysql, err := im_mysql_model.GetGroupInfoByGroupID(groupID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), groupID)
|
||||
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID)
|
||||
continue
|
||||
}
|
||||
var groupInfo open_im_sdk.GroupInfo
|
||||
@ -482,7 +482,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq)
|
||||
|
||||
_, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed", err.Error(), req.GroupID, req.OpUserID)
|
||||
log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed", err.Error(), req.GroupID, req.OpUserID)
|
||||
return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ func hasAccess(req *pbGroup.SetGroupInfoReq) bool {
|
||||
}
|
||||
groupUserInfo, err := im_mysql_model.GetGroupMemberInfoByGroupIDAndUserID(req.GroupInfo.GroupID, req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed, ", err.Error(), req.GroupInfo.GroupID, req.OpUserID)
|
||||
log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed, ", err.Error(), req.GroupInfo.GroupID, req.OpUserID)
|
||||
return false
|
||||
|
||||
}
|
||||
@ -528,7 +528,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
|
||||
group, err := im_mysql_model.GetGroupInfoByGroupID(req.GroupInfo.GroupID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), req.GroupInfo.GroupID)
|
||||
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), req.GroupInfo.GroupID)
|
||||
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,12 @@ type GetGroupAllMemberResp struct {
|
||||
|
||||
type CreateGroupReq struct {
|
||||
MemberList []*GroupAddMemberInfo `json:"memberList" binding:"required"`
|
||||
OwnerUserID string `json:"ownerUserID" binding:"required"`
|
||||
GroupName string `json:"groupName"`
|
||||
Introduction string `json:"introduction"`
|
||||
Notification string `json:"notification"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupType int32 `json:"groupType"`
|
||||
Ex string `json:"ex"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
type CreateGroupResp struct {
|
||||
CommResp
|
||||
GroupInfo open_im_sdk.GroupInfo `json:"data"`
|
||||
|
@ -27,23 +27,25 @@ func SetErrCodeMsg(c *gin.Context, status int) *CommResp {
|
||||
return &resp
|
||||
}
|
||||
|
||||
//
|
||||
//GroupName string `json:"groupName"`
|
||||
// Introduction string `json:"introduction"`
|
||||
// Notification string `json:"notification"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// OperationID string `json:"operationID" binding:"required"`
|
||||
// GroupType int32 `json:"groupType"`
|
||||
// Ex string `json:"ex"`
|
||||
|
||||
//type GroupInfo struct {
|
||||
// GroupID string `json:"groupID"`
|
||||
// GroupName string `json:"groupName"`
|
||||
// Notification string `json:"notification"`
|
||||
// Introduction string `json:"introduction"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// OperationID string `json:"operationID"`
|
||||
// OwnerUserID string `json:"ownerUserID"`
|
||||
// CreateTime int64 `json:"createTime"`
|
||||
// MemberCount uint32 `json:"memberCount"`
|
||||
// Ex string `json:"ex"`
|
||||
// Status int32 `json:"status"`
|
||||
// CreatorUserID string `json:"creatorUserID"`
|
||||
// GroupType int32 `json:"groupType"`
|
||||
//}
|
||||
//
|
||||
|
||||
//type GroupMemberFullInfo struct {
|
||||
// GroupID string `json:"groupID"`
|
||||
// UserID string `json:"userID"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user