mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 03:58:55 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
This commit is contained in:
commit
6360980b66
@ -166,6 +166,28 @@ groupMemberInfoSet:
|
|||||||
desc: "groupMemberInfoSet desc"
|
desc: "groupMemberInfoSet desc"
|
||||||
ext: "groupMemberInfoSet ext"
|
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#################################
|
#############################friend#################################
|
||||||
friendApplicationAdded:
|
friendApplicationAdded:
|
||||||
isSendMsg: false
|
isSendMsg: false
|
||||||
|
@ -45,10 +45,10 @@ type PongHandler func(string) error
|
|||||||
type Client struct {
|
type Client struct {
|
||||||
w *sync.Mutex
|
w *sync.Mutex
|
||||||
conn LongConn
|
conn LongConn
|
||||||
platformID int
|
PlatformID int `json:"platformID"`
|
||||||
isCompress bool
|
IsCompress bool `json:"isCompress"`
|
||||||
userID string
|
UserID string `json:"userID"`
|
||||||
isBackground bool
|
IsBackground bool `json:"isBackground"`
|
||||||
ctx *UserConnContext
|
ctx *UserConnContext
|
||||||
longConnServer LongConnServer
|
longConnServer LongConnServer
|
||||||
closed bool
|
closed bool
|
||||||
@ -59,21 +59,21 @@ func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
|
|||||||
return &Client{
|
return &Client{
|
||||||
w: new(sync.Mutex),
|
w: new(sync.Mutex),
|
||||||
conn: conn,
|
conn: conn,
|
||||||
platformID: utils.StringToInt(ctx.GetPlatformID()),
|
PlatformID: utils.StringToInt(ctx.GetPlatformID()),
|
||||||
isCompress: isCompress,
|
IsCompress: isCompress,
|
||||||
userID: ctx.GetUserID(),
|
UserID: ctx.GetUserID(),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isCompress bool, longConnServer LongConnServer) {
|
func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, isCompress bool, longConnServer LongConnServer) {
|
||||||
c.w = new(sync.Mutex)
|
c.w = new(sync.Mutex)
|
||||||
c.conn = conn
|
c.conn = conn
|
||||||
c.platformID = utils.StringToInt(ctx.GetPlatformID())
|
c.PlatformID = utils.StringToInt(ctx.GetPlatformID())
|
||||||
c.isCompress = isCompress
|
c.IsCompress = isCompress
|
||||||
c.userID = ctx.GetUserID()
|
c.UserID = ctx.GetUserID()
|
||||||
c.ctx = ctx
|
c.ctx = ctx
|
||||||
c.longConnServer = longConnServer
|
c.longConnServer = longConnServer
|
||||||
c.isBackground = false
|
c.IsBackground = false
|
||||||
c.closed = false
|
c.closed = false
|
||||||
c.closedErr = nil
|
c.closedErr = nil
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (c *Client) readMessage() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
func (c *Client) handleMessage(message []byte) error {
|
func (c *Client) handleMessage(message []byte) error {
|
||||||
if c.isCompress {
|
if c.IsCompress {
|
||||||
var decompressErr error
|
var decompressErr error
|
||||||
message, decompressErr = c.longConnServer.DeCompress(message)
|
message, decompressErr = c.longConnServer.DeCompress(message)
|
||||||
if decompressErr != nil {
|
if decompressErr != nil {
|
||||||
@ -141,10 +141,10 @@ func (c *Client) handleMessage(message []byte) error {
|
|||||||
if err := c.longConnServer.Validate(binaryReq); err != nil {
|
if err := c.longConnServer.Validate(binaryReq); err != nil {
|
||||||
return utils.Wrap(err, "")
|
return utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
if binaryReq.SendID != c.userID {
|
if binaryReq.SendID != c.UserID {
|
||||||
return utils.Wrap(errors.New("exception conn userID not same to req userID"), binaryReq.String())
|
return utils.Wrap(errors.New("exception conn userID not same to req userID"), binaryReq.String())
|
||||||
}
|
}
|
||||||
ctx := mcontext.WithMustInfoCtx([]string{binaryReq.OperationID, binaryReq.SendID, constant.PlatformIDToName(c.platformID), c.ctx.GetConnID()})
|
ctx := mcontext.WithMustInfoCtx([]string{binaryReq.OperationID, binaryReq.SendID, constant.PlatformIDToName(c.PlatformID), c.ctx.GetConnID()})
|
||||||
log.ZDebug(ctx, "gateway req message", "req", binaryReq.String())
|
log.ZDebug(ctx, "gateway req message", "req", binaryReq.String())
|
||||||
var messageErr error
|
var messageErr error
|
||||||
var resp []byte
|
var resp []byte
|
||||||
@ -173,7 +173,7 @@ func (c *Client) setAppBackgroundStatus(ctx context.Context, req Req) ([]byte, e
|
|||||||
if messageErr != nil {
|
if messageErr != nil {
|
||||||
return nil, messageErr
|
return nil, messageErr
|
||||||
}
|
}
|
||||||
c.isBackground = isBackground
|
c.IsBackground = isBackground
|
||||||
//todo callback
|
//todo callback
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ func (c *Client) writeBinaryMsg(resp Resp) error {
|
|||||||
return utils.Wrap(err, "")
|
return utils.Wrap(err, "")
|
||||||
}
|
}
|
||||||
_ = c.conn.SetWriteDeadline(writeWait)
|
_ = c.conn.SetWriteDeadline(writeWait)
|
||||||
if c.isCompress {
|
if c.IsCompress {
|
||||||
var compressErr error
|
var compressErr error
|
||||||
resultBuf, compressErr = c.longConnServer.Compress(encodedBuf)
|
resultBuf, compressErr = c.longConnServer.Compress(encodedBuf)
|
||||||
if compressErr != nil {
|
if compressErr != nil {
|
||||||
|
@ -60,10 +60,10 @@ func (s *Server) GetUsersOnlineStatus(ctx context.Context, req *msggateway.GetUs
|
|||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
if client != nil {
|
if client != nil {
|
||||||
ps := new(msggateway.GetUsersOnlineStatusResp_SuccessDetail)
|
ps := new(msggateway.GetUsersOnlineStatusResp_SuccessDetail)
|
||||||
ps.Platform = constant.PlatformIDToName(client.platformID)
|
ps.Platform = constant.PlatformIDToName(client.PlatformID)
|
||||||
ps.Status = constant.OnlineStatus
|
ps.Status = constant.OnlineStatus
|
||||||
ps.ConnID = client.ctx.GetConnID()
|
ps.ConnID = client.ctx.GetConnID()
|
||||||
ps.IsBackground = client.isBackground
|
ps.IsBackground = client.IsBackground
|
||||||
temp.Status = constant.OnlineStatus
|
temp.Status = constant.OnlineStatus
|
||||||
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps)
|
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps)
|
||||||
}
|
}
|
||||||
@ -98,15 +98,15 @@ func (s *Server) SuperGroupOnlineBatchPushOneMsg(ctx context.Context, req *msgga
|
|||||||
if client != nil {
|
if client != nil {
|
||||||
temp := &msggateway.SingleMsgToUserPlatform{
|
temp := &msggateway.SingleMsgToUserPlatform{
|
||||||
RecvID: v,
|
RecvID: v,
|
||||||
RecvPlatFormID: int32(client.platformID),
|
RecvPlatFormID: int32(client.PlatformID),
|
||||||
}
|
}
|
||||||
if !client.isBackground {
|
if !client.IsBackground {
|
||||||
err := client.PushMessage(ctx, req.MsgData)
|
err := client.PushMessage(ctx, req.MsgData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
temp.ResultCode = -2
|
temp.ResultCode = -2
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
} else {
|
} else {
|
||||||
if utils.IsContainInt(client.platformID, s.pushTerminal) {
|
if utils.IsContainInt(client.PlatformID, s.pushTerminal) {
|
||||||
tempT.OnlinePush = true
|
tempT.OnlinePush = true
|
||||||
prome.Inc(prome.MsgOnlinePushSuccessCounter)
|
prome.Inc(prome.MsgOnlinePushSuccessCounter)
|
||||||
resp = append(resp, temp)
|
resp = append(resp, temp)
|
||||||
|
@ -123,22 +123,22 @@ func (ws *WsServer) registerClient(client *Client) {
|
|||||||
clientOK bool
|
clientOK bool
|
||||||
cli []*Client
|
cli []*Client
|
||||||
)
|
)
|
||||||
cli, userOK, clientOK = ws.clients.Get(client.userID, client.platformID)
|
cli, userOK, clientOK = ws.clients.Get(client.UserID, client.PlatformID)
|
||||||
if !userOK {
|
if !userOK {
|
||||||
log.ZDebug(client.ctx, "user not exist", "userID", client.userID, "platformID", client.platformID)
|
log.ZDebug(client.ctx, "user not exist", "userID", client.UserID, "platformID", client.PlatformID)
|
||||||
ws.clients.Set(client.userID, client)
|
ws.clients.Set(client.UserID, client)
|
||||||
atomic.AddInt64(&ws.onlineUserNum, 1)
|
atomic.AddInt64(&ws.onlineUserNum, 1)
|
||||||
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.ZDebug(client.ctx, "user exist", "userID", client.userID, "platformID", client.platformID)
|
log.ZDebug(client.ctx, "user exist", "userID", client.UserID, "platformID", client.PlatformID)
|
||||||
if clientOK { //已经有同平台的连接存在
|
if clientOK { //已经有同平台的连接存在
|
||||||
ws.clients.Set(client.userID, client)
|
ws.clients.Set(client.UserID, client)
|
||||||
ws.multiTerminalLoginChecker(cli)
|
ws.multiTerminalLoginChecker(cli)
|
||||||
log.ZInfo(client.ctx, "repeat login", "userID", client.userID, "platformID", client.platformID, "old remote addr", getRemoteAdders(cli))
|
log.ZInfo(client.ctx, "repeat login", "userID", client.UserID, "platformID", client.PlatformID, "old remote addr", getRemoteAdders(cli))
|
||||||
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
||||||
} else {
|
} else {
|
||||||
ws.clients.Set(client.userID, client)
|
ws.clients.Set(client.UserID, client)
|
||||||
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ func (ws *WsServer) multiTerminalLoginChecker(client []*Client) {
|
|||||||
}
|
}
|
||||||
func (ws *WsServer) unregisterClient(client *Client) {
|
func (ws *WsServer) unregisterClient(client *Client) {
|
||||||
defer ws.clientPool.Put(client)
|
defer ws.clientPool.Put(client)
|
||||||
isDeleteUser := ws.clients.delete(client.userID, client.ctx.GetRemoteAddr())
|
isDeleteUser := ws.clients.delete(client.UserID, client.ctx.GetRemoteAddr())
|
||||||
if isDeleteUser {
|
if isDeleteUser {
|
||||||
atomic.AddInt64(&ws.onlineUserNum, -1)
|
atomic.AddInt64(&ws.onlineUserNum, -1)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ func (u *UserMap) Get(key string, platformID int) ([]*Client, bool, bool) {
|
|||||||
if userExisted {
|
if userExisted {
|
||||||
var clients []*Client
|
var clients []*Client
|
||||||
for _, client := range allClients.([]*Client) {
|
for _, client := range allClients.([]*Client) {
|
||||||
if client.platformID == platformID {
|
if client.PlatformID == platformID {
|
||||||
clients = append(clients, client)
|
clients = append(clients, client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
"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"
|
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/proto/sdkws"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||||
@ -926,21 +925,34 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
} else {
|
} else {
|
||||||
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
tips.OpUser = s.groupMemberDB2PB(opMember, 0)
|
||||||
}
|
}
|
||||||
s.Notification.GroupInfoSetNotification(ctx, tips)
|
var num int
|
||||||
if req.GroupInfoForSet.Notification != "" {
|
if req.GroupInfoForSet.Notification != "" {
|
||||||
args := &pbConversation.ModifyConversationFieldReq{
|
num++
|
||||||
Conversation: &pbConversation.Conversation{
|
s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||||
OwnerUserID: mcontext.GetOpUserID(ctx),
|
//args := &pbConversation.ModifyConversationFieldReq{
|
||||||
ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
// Conversation: &pbConversation.Conversation{
|
||||||
ConversationType: constant.SuperGroupChatType,
|
// OwnerUserID: mcontext.GetOpUserID(ctx),
|
||||||
GroupID: group.GroupID,
|
// ConversationID: utils.GetConversationIDBySessionType(constant.GroupChatType, group.GroupID),
|
||||||
},
|
// ConversationType: constant.SuperGroupChatType,
|
||||||
FieldType: constant.FieldGroupAtType,
|
// GroupID: group.GroupID,
|
||||||
UserIDList: userIDs,
|
// },
|
||||||
}
|
// FieldType: constant.FieldGroupAtType,
|
||||||
if err := s.conversationRpcClient.ModifyConversationField(ctx, args); err != nil {
|
// UserIDList: userIDs,
|
||||||
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
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
@ -332,6 +332,8 @@ type Notification struct {
|
|||||||
GroupMemberInfoSet NotificationConf `yaml:"groupMemberInfoSet"`
|
GroupMemberInfoSet NotificationConf `yaml:"groupMemberInfoSet"`
|
||||||
GroupMemberSetToAdmin NotificationConf `yaml:"groupMemberSetToAdmin"`
|
GroupMemberSetToAdmin NotificationConf `yaml:"groupMemberSetToAdmin"`
|
||||||
GroupMemberSetToOrdinary NotificationConf `yaml:"groupMemberSetToOrdinaryUser"`
|
GroupMemberSetToOrdinary NotificationConf `yaml:"groupMemberSetToOrdinaryUser"`
|
||||||
|
GroupInfoSetAnnouncement NotificationConf `yaml:"groupInfoSetAnnouncement"`
|
||||||
|
GroupInfoSetName NotificationConf `yaml:"groupInfoSetName"`
|
||||||
////////////////////////user///////////////////////
|
////////////////////////user///////////////////////
|
||||||
UserInfoUpdated NotificationConf `yaml:"userInfoUpdated"`
|
UserInfoUpdated NotificationConf `yaml:"userInfoUpdated"`
|
||||||
//////////////////////friend///////////////////////
|
//////////////////////friend///////////////////////
|
||||||
|
@ -70,6 +70,8 @@ const (
|
|||||||
GroupMemberInfoSetNotification = 1516
|
GroupMemberInfoSetNotification = 1516
|
||||||
GroupMemberSetToAdminNotification = 1517
|
GroupMemberSetToAdminNotification = 1517
|
||||||
GroupMemberSetToOrdinaryUserNotification = 1518
|
GroupMemberSetToOrdinaryUserNotification = 1518
|
||||||
|
GroupInfoSetAnnouncementNotification = 1519
|
||||||
|
GroupInfoSetNameNotification = 1520
|
||||||
|
|
||||||
SignalingNotificationBegin = 1600
|
SignalingNotificationBegin = 1600
|
||||||
SignalingNotification = 1601
|
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:./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:./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:./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;
|
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()
|
// OnJoinGroupApplication()
|
||||||
message JoinGroupApplicationTips{
|
message JoinGroupApplicationTips{
|
||||||
GroupInfo group = 1;
|
GroupInfo group = 1;
|
||||||
|
@ -37,6 +37,8 @@ func newContentTypeConf() map[int32]config.NotificationConf {
|
|||||||
constant.GroupMemberInfoSetNotification: config.Config.Notification.GroupMemberInfoSet,
|
constant.GroupMemberInfoSetNotification: config.Config.Notification.GroupMemberInfoSet,
|
||||||
constant.GroupMemberSetToAdminNotification: config.Config.Notification.GroupMemberSetToAdmin,
|
constant.GroupMemberSetToAdminNotification: config.Config.Notification.GroupMemberSetToAdmin,
|
||||||
constant.GroupMemberSetToOrdinaryUserNotification: config.Config.Notification.GroupMemberSetToOrdinary,
|
constant.GroupMemberSetToOrdinaryUserNotification: config.Config.Notification.GroupMemberSetToOrdinary,
|
||||||
|
constant.GroupInfoSetAnnouncementNotification: config.Config.Notification.GroupInfoSetAnnouncement,
|
||||||
|
constant.GroupInfoSetNameNotification: config.Config.Notification.GroupInfoSetName,
|
||||||
// user
|
// user
|
||||||
constant.UserInfoUpdatedNotification: config.Config.Notification.UserInfoUpdated,
|
constant.UserInfoUpdatedNotification: config.Config.Notification.UserInfoUpdated,
|
||||||
// friend
|
// friend
|
||||||
@ -79,6 +81,8 @@ func newSessionTypeConf() map[int32]int32 {
|
|||||||
constant.GroupMemberInfoSetNotification: constant.SuperGroupChatType,
|
constant.GroupMemberInfoSetNotification: constant.SuperGroupChatType,
|
||||||
constant.GroupMemberSetToAdminNotification: constant.SuperGroupChatType,
|
constant.GroupMemberSetToAdminNotification: constant.SuperGroupChatType,
|
||||||
constant.GroupMemberSetToOrdinaryUserNotification: constant.SuperGroupChatType,
|
constant.GroupMemberSetToOrdinaryUserNotification: constant.SuperGroupChatType,
|
||||||
|
constant.GroupInfoSetAnnouncementNotification: constant.SuperGroupChatType,
|
||||||
|
constant.GroupInfoSetNameNotification: constant.SuperGroupChatType,
|
||||||
// user
|
// user
|
||||||
constant.UserInfoUpdatedNotification: constant.SingleChatType,
|
constant.UserInfoUpdatedNotification: constant.SingleChatType,
|
||||||
// friend
|
// friend
|
||||||
|
@ -289,55 +289,23 @@ func (g *GroupNotificationSender) mergeGroupFull(ctx context.Context, groupID st
|
|||||||
return groupInfo, nil
|
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) {
|
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)
|
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) {
|
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)
|
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) {
|
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)
|
group, err := g.getGroupInfo(ctx, req.GroupID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -377,22 +345,12 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, re
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//userIDs, err := g.getGroupOwnerAndAdminUserID(ctx, req.GroupID)
|
|
||||||
//if err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
|
tips := &sdkws.MemberQuitTips{Group: group, QuitUser: &sdkws.GroupMemberFullInfo{
|
||||||
GroupID: group.GroupID,
|
GroupID: group.GroupID,
|
||||||
UserID: user.UserID,
|
UserID: user.UserID,
|
||||||
Nickname: user.Nickname,
|
Nickname: user.Nickname,
|
||||||
FaceURL: user.FaceURL,
|
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)
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), req.GroupID, constant.MemberQuitNotification, tips)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user