mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 10:22:36 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
This commit is contained in:
commit
8b76ecd84e
@ -166,6 +166,28 @@ groupMemberInfoSet:
|
||||
desc: "groupMemberInfoSet desc"
|
||||
ext: "groupMemberInfoSet ext"
|
||||
|
||||
groupInfoSetAnnouncement:
|
||||
isSendMsg: true
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupInfoSetAnnouncement title"
|
||||
desc: "groupInfoSetAnnouncement desc"
|
||||
ext: "groupInfoSetAnnouncement ext"
|
||||
|
||||
|
||||
groupInfoSetName:
|
||||
isSendMsg: true
|
||||
reliabilityLevel: 1
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupInfoSetName title"
|
||||
desc: "groupInfoSetName desc"
|
||||
ext: "groupInfoSetName ext"
|
||||
|
||||
|
||||
#############################friend#################################
|
||||
friendApplicationAdded:
|
||||
isSendMsg: false
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
)
|
||||
|
||||
func NewAuth(discov discoveryregistry.SvcDiscoveryRegistry) *Auth {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Auth{conn: conn, discov: discov}
|
||||
// }
|
||||
return &Auth{discov: discov}
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
)
|
||||
|
||||
func NewConversation(discov discoveryregistry.SvcDiscoveryRegistry) *Conversation {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImConversationName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImConversationName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Conversation{conn: conn, discov: discov}
|
||||
// }
|
||||
return &Conversation{discov: discov}
|
||||
}
|
||||
|
||||
type Conversation struct {
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
)
|
||||
|
||||
func NewFriend(discov discoveryregistry.SvcDiscoveryRegistry) *Friend {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Friend{conn: conn, discov: discov}
|
||||
// }
|
||||
return &Friend{discov: discov}
|
||||
}
|
||||
|
||||
type Friend struct {
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
)
|
||||
|
||||
func NewGroup(discov discoveryregistry.SvcDiscoveryRegistry) *Group {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Group{conn: conn, discov: discov}
|
||||
// }
|
||||
return &Group{discov: discov}
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
|
@ -22,11 +22,11 @@ import (
|
||||
)
|
||||
|
||||
func NewMsg(discov discoveryregistry.SvcDiscoveryRegistry) *Message {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Message{conn: conn, validate: validator.New(), discov: discov}
|
||||
// }
|
||||
return &Message{validate: validator.New(), discov: discov}
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
|
@ -18,11 +18,11 @@ import (
|
||||
)
|
||||
|
||||
func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImThirdName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImThirdName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
return &Third{conn: conn, discov: discov}
|
||||
// }
|
||||
return &Third{discov: discov}
|
||||
}
|
||||
|
||||
type Third struct {
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/apiresp"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
"google.golang.org/grpc"
|
||||
@ -18,12 +17,11 @@ import (
|
||||
)
|
||||
|
||||
func NewUser(discov discoveryregistry.SvcDiscoveryRegistry) *User {
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImUserName)
|
||||
if err != nil {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImUserName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
}
|
||||
log.ZInfo(context.Background(), "user rpc conn", "conn", conn)
|
||||
return &User{conn: conn, discov: discov}
|
||||
// }
|
||||
return &User{discov: discov}
|
||||
}
|
||||
|
||||
type User struct {
|
||||
|
@ -26,7 +26,6 @@ import (
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||
pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
@ -926,21 +925,34 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
} else {
|
||||
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
||||
}
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
var num int
|
||||
if req.GroupInfoForSet.Notification != "" {
|
||||
args := &pbConversation.ModifyConversationFieldReq{
|
||||
Conversation: &pbConversation.Conversation{
|
||||
OwnerUserID: mcontext.GetOpUserID(ctx),
|
||||
ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
||||
ConversationType: constant.SuperGroupChatType,
|
||||
GroupID: group.GroupID,
|
||||
},
|
||||
FieldType: constant.FieldGroupAtType,
|
||||
UserIDList: userIDs,
|
||||
num++
|
||||
s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||
//args := &pbConversation.ModifyConversationFieldReq{
|
||||
// Conversation: &pbConversation.Conversation{
|
||||
// OwnerUserID: mcontext.GetOpUserID(ctx),
|
||||
// ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
||||
// ConversationType: constant.SuperGroupChatType,
|
||||
// GroupID: group.GroupID,
|
||||
// },
|
||||
// FieldType: constant.FieldGroupAtType,
|
||||
// UserIDList: userIDs,
|
||||
//}
|
||||
//if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil {
|
||||
// log.ZWarn(ctx, "modifyConversationField failed", err, "args", args)
|
||||
//}
|
||||
}
|
||||
if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil {
|
||||
log.ZWarn(ctx, "modifyConversationField failed", err, "args", args)
|
||||
switch len(data) - num {
|
||||
case 0:
|
||||
case 1:
|
||||
if req.GroupInfoForSet.GroupName == "" {
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
} else {
|
||||
s.Notification.GroupInfoSetNameNotification(ctx, &sdkws.GroupInfoSetNameTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||
}
|
||||
default:
|
||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
@ -332,6 +332,8 @@ type Notification struct {
|
||||
GroupMemberInfoSet NotificationConf `yaml:"groupMemberInfoSet"`
|
||||
GroupMemberSetToAdmin NotificationConf `yaml:"groupMemberSetToAdmin"`
|
||||
GroupMemberSetToOrdinary NotificationConf `yaml:"groupMemberSetToOrdinaryUser"`
|
||||
GroupInfoSetAnnouncement NotificationConf `yaml:"groupInfoSetAnnouncement"`
|
||||
GroupInfoSetName NotificationConf `yaml:"groupInfoSetName"`
|
||||
////////////////////////user///////////////////////
|
||||
UserInfoUpdated NotificationConf `yaml:"userInfoUpdated"`
|
||||
//////////////////////friend///////////////////////
|
||||
|
@ -70,6 +70,8 @@ const (
|
||||
GroupMemberInfoSetNotification = 1516
|
||||
GroupMemberSetToAdminNotification = 1517
|
||||
GroupMemberSetToOrdinaryUserNotification = 1518
|
||||
GroupInfoSetAnnouncementNotification = 1519
|
||||
GroupInfoSetNameNotification = 1520
|
||||
|
||||
SignalingNotificationBegin = 1600
|
||||
SignalingNotification = 1601
|
||||
|
@ -11,4 +11,3 @@ protoc --go_out=plugins=grpc:./sdkws --go_opt=module=github.com/OpenIMSDK/Open-I
|
||||
protoc --go_out=plugins=grpc:./third --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third third/third.proto
|
||||
protoc --go_out=plugins=grpc:./user --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user user/user.proto
|
||||
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
|
||||
protoc --go_out=plugins=grpc:./office --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office office/office.proto
|
File diff suppressed because it is too large
Load Diff
@ -233,6 +233,16 @@ message GroupInfoSetTips{
|
||||
GroupInfo group = 3;
|
||||
}
|
||||
|
||||
message GroupInfoSetNameTips{
|
||||
GroupMemberFullInfo opUser = 1; //who do this
|
||||
GroupInfo group = 2;
|
||||
}
|
||||
|
||||
message GroupInfoSetAnnouncementTips{
|
||||
GroupMemberFullInfo opUser = 1; //who do this
|
||||
GroupInfo group = 2;
|
||||
}
|
||||
|
||||
// OnJoinGroupApplication()
|
||||
message JoinGroupApplicationTips{
|
||||
GroupInfo group = 1;
|
||||
|
@ -37,6 +37,8 @@ func newContentTypeConf() map[int32]config.NotificationConf {
|
||||
constant.GroupMemberInfoSetNotification: config.Config.Notification.GroupMemberInfoSet,
|
||||
constant.GroupMemberSetToAdminNotification: config.Config.Notification.GroupMemberSetToAdmin,
|
||||
constant.GroupMemberSetToOrdinaryUserNotification: config.Config.Notification.GroupMemberSetToOrdinary,
|
||||
constant.GroupInfoSetAnnouncementNotification: config.Config.Notification.GroupInfoSetAnnouncement,
|
||||
constant.GroupInfoSetNameNotification: config.Config.Notification.GroupInfoSetName,
|
||||
// user
|
||||
constant.UserInfoUpdatedNotification: config.Config.Notification.UserInfoUpdated,
|
||||
// friend
|
||||
@ -79,6 +81,8 @@ func newSessionTypeConf() map[int32]int32 {
|
||||
constant.GroupMemberInfoSetNotification: constant.SuperGroupChatType,
|
||||
constant.GroupMemberSetToAdminNotification: constant.SuperGroupChatType,
|
||||
constant.GroupMemberSetToOrdinaryUserNotification: constant.SuperGroupChatType,
|
||||
constant.GroupInfoSetAnnouncementNotification: constant.SuperGroupChatType,
|
||||
constant.GroupInfoSetNameNotification: constant.SuperGroupChatType,
|
||||
// user
|
||||
constant.UserInfoUpdatedNotification: constant.SingleChatType,
|
||||
// friend
|
||||
|
@ -289,55 +289,23 @@ func (g *GroupNotificationSender) mergeGroupFull(ctx context.Context, groupID st
|
||||
return groupInfo, nil
|
||||
}
|
||||
|
||||
//func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, group *relation.GroupModel, members []*relation.GroupMemberModel, userMap map[string]*sdkws.UserInfo) (err error) {
|
||||
// defer log.ZDebug(ctx, "GroupCreatedNotification.return")
|
||||
// defer func() {
|
||||
// if err != nil {
|
||||
// log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
||||
// }
|
||||
// }()
|
||||
// groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, &userMap)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupCreatedNotification, groupInfo)
|
||||
//}
|
||||
|
||||
func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, tips *sdkws.GroupCreatedTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupCreatedNotification, tips)
|
||||
}
|
||||
|
||||
//func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, group *relation.GroupModel, members []*relation.GroupMemberModel, needVerification *int32) (err error) {
|
||||
// groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, nil)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// tips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
|
||||
// if needVerification != nil {
|
||||
// tips.Group.NeedVerification = *needVerification
|
||||
// }
|
||||
// return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupInfoSetNotification, tips)
|
||||
//}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, tips *sdkws.GroupInfoSetTips) (err error) {
|
||||
//groupInfo, err := g.mergeGroupFull(ctx, group.GroupID, group, &members, nil)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//tips := &sdkws.GroupInfoSetTips{Group: groupInfo.Group, OpUser: groupInfo.GroupOwnerUser}
|
||||
//if needVerification != nil {
|
||||
// tips.Group.NeedVerification = *needVerification
|
||||
//}
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Context, tips *sdkws.GroupInfoSetNameTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNameNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx context.Context, tips *sdkws.GroupInfoSetAnnouncementTips) (err error) {
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetAnnouncementNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) (err error) {
|
||||
defer log.ZDebug(ctx, "return")
|
||||
defer func() {
|
||||
if err != nil {
|
||||
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
||||
}
|
||||
}()
|
||||
group, err := g.getGroupInfo(ctx, req.GroupID)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -377,22 +345,12 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, re
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//userIDs, err := g.getGroupOwnerAndAdminUserID(ctx, req.GroupID)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
|
||||
GroupID: group.GroupID,
|
||||
UserID: user.UserID,
|
||||
Nickname: user.Nickname,
|
||||
FaceURL: user.FaceURL,
|
||||
}}
|
||||
//for _, userID := range append(userIDs, opUserID) {
|
||||
// err = g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), userID, constant.MemberQuitNotification, tips)
|
||||
// if err != nil {
|
||||
// log.ZError(ctx, "MemberQuitNotification failed", err, "group", req.GroupID, "userID", userID)
|
||||
// }
|
||||
//}
|
||||
return g.Notification(ctx, mcontext.GetOpUserID(ctx), req.GroupID, constant.MemberQuitNotification, tips)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user