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
@ -244,16 +244,16 @@ func CreateGroup(c *gin.Context) {
|
|||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
RpcResp, err := client.CreateGroup(context.Background(), req)
|
RpcResp, err := client.CreateGroup(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "CreateGroup failed", err.Error(), req.String())
|
log.NewError(req.OperationID, "CreateGroup failed ", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := api.CreateGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
resp := api.CreateGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||||
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 ", RpcResp)
|
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())
|
||||||
@ -195,7 +195,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
|||||||
|
|
||||||
_, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
_, err := imdb.GetGroupInfoByGroupID(req.GroupID)
|
||||||
if err != nil {
|
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
|
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
|
resultNode.Result = 0
|
||||||
toUserInfo, err := imdb.GetUserByUserID(v)
|
toUserInfo, err := imdb.GetUserByUserID(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), v)
|
log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), v)
|
||||||
resultNode.Result = -1
|
resultNode.Result = -1
|
||||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||||
continue
|
continue
|
||||||
@ -253,7 +253,7 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
resp.ErrCode = constant.ErrDB.ErrCode
|
resp.ErrCode = constant.ErrDB.ErrCode
|
||||||
resp.ErrMsg = constant.ErrDB.ErrMsg
|
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
|
return &resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
|
|||||||
for _, groupID := range req.GroupIDList {
|
for _, groupID := range req.GroupIDList {
|
||||||
groupInfoFromMysql, err := im_mysql_model.GetGroupInfoByGroupID(groupID)
|
groupInfoFromMysql, err := im_mysql_model.GetGroupInfoByGroupID(groupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), groupID)
|
log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var groupInfo open_im_sdk.GroupInfo
|
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)
|
_, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID)
|
||||||
if err != nil {
|
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
|
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)
|
groupUserInfo, err := im_mysql_model.GetGroupMemberInfoByGroupIDAndUserID(req.GroupInfo.GroupID, req.OpUserID)
|
||||||
if err != nil {
|
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
|
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)
|
group, err := im_mysql_model.GetGroupInfoByGroupID(req.GroupInfo.GroupID)
|
||||||
if err != nil {
|
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
|
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,15 +76,13 @@ type GetGroupAllMemberResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateGroupReq struct {
|
type CreateGroupReq struct {
|
||||||
MemberList []*GroupAddMemberInfo `json:"memberList" binding:"required"`
|
MemberList []*GroupAddMemberInfo `json:"memberList" binding:"required"`
|
||||||
GroupName string `json:"groupName"`
|
OwnerUserID string `json:"ownerUserID" binding:"required"`
|
||||||
Introduction string `json:"introduction"`
|
GroupName string `json:"groupName"`
|
||||||
Notification string `json:"notification"`
|
GroupType int32 `json:"groupType"`
|
||||||
FaceUrl string `json:"faceUrl"`
|
OperationID string `json:"operationID" binding:"required"`
|
||||||
OperationID string `json:"operationID" binding:"required"`
|
|
||||||
GroupType int32 `json:"groupType"`
|
|
||||||
Ex string `json:"ex"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateGroupResp struct {
|
type CreateGroupResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
GroupInfo open_im_sdk.GroupInfo `json:"data"`
|
GroupInfo open_im_sdk.GroupInfo `json:"data"`
|
||||||
|
@ -27,23 +27,25 @@ func SetErrCodeMsg(c *gin.Context, status int) *CommResp {
|
|||||||
return &resp
|
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 {
|
//type GroupInfo struct {
|
||||||
// GroupID string `json:"groupID"`
|
// GroupID string `json:"groupID"`
|
||||||
// GroupName string `json:"groupName"`
|
// GroupName string `json:"groupName"`
|
||||||
// Notification string `json:"notification"`
|
// Notification string `json:"notification"`
|
||||||
// Introduction string `json:"introduction"`
|
// Introduction string `json:"introduction"`
|
||||||
// FaceUrl string `json:"faceUrl"`
|
// FaceUrl string `json:"faceUrl"`
|
||||||
// OperationID string `json:"operationID"`
|
|
||||||
// OwnerUserID string `json:"ownerUserID"`
|
// OwnerUserID string `json:"ownerUserID"`
|
||||||
// CreateTime int64 `json:"createTime"`
|
|
||||||
// MemberCount uint32 `json:"memberCount"`
|
|
||||||
// Ex string `json:"ex"`
|
// Ex string `json:"ex"`
|
||||||
// Status int32 `json:"status"`
|
|
||||||
// CreatorUserID string `json:"creatorUserID"`
|
|
||||||
// GroupType int32 `json:"groupType"`
|
// GroupType int32 `json:"groupType"`
|
||||||
//}
|
//}
|
||||||
//
|
|
||||||
//type GroupMemberFullInfo struct {
|
//type GroupMemberFullInfo struct {
|
||||||
// GroupID string `json:"groupID"`
|
// GroupID string `json:"groupID"`
|
||||||
// UserID string `json:"userID"`
|
// UserID string `json:"userID"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user