mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
group
This commit is contained in:
parent
cfb157d2e4
commit
cb26321847
2
go.mod
2
go.mod
@ -35,7 +35,7 @@ require (
|
|||||||
golang.org/x/image v0.3.0
|
golang.org/x/image v0.3.0
|
||||||
google.golang.org/api v0.103.0
|
google.golang.org/api v0.103.0
|
||||||
google.golang.org/grpc v1.52.3
|
google.golang.org/grpc v1.52.3
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.30.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
gorm.io/driver/mysql v1.3.5
|
gorm.io/driver/mysql v1.3.5
|
||||||
gorm.io/gorm v1.23.8
|
gorm.io/gorm v1.23.8
|
||||||
|
3
go.sum
3
go.sum
@ -1349,8 +1349,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
|
|||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
|
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||||
|
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
@ -23,7 +23,7 @@ func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (
|
|||||||
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
||||||
CallbackCommand: constant.CallbackBeforeCreateGroupCommand,
|
CallbackCommand: constant.CallbackBeforeCreateGroupCommand,
|
||||||
OperationID: mcontext.GetOperationID(ctx),
|
OperationID: mcontext.GetOperationID(ctx),
|
||||||
GroupInfo: *req.GroupInfo,
|
GroupInfo: req.GroupInfo,
|
||||||
}
|
}
|
||||||
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
cbReq.InitMemberList = append(cbReq.InitMemberList, &apistruct.GroupAddMemberInfo{
|
||||||
UserID: req.OwnerUserID,
|
UserID: req.OwnerUserID,
|
||||||
|
@ -14,7 +14,7 @@ func (c CallbackCommand) GetCallbackCommand() string {
|
|||||||
type CallbackBeforeCreateGroupReq struct {
|
type CallbackBeforeCreateGroupReq struct {
|
||||||
OperationID string `json:"operationID"`
|
OperationID string `json:"operationID"`
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
common.GroupInfo
|
*common.GroupInfo
|
||||||
InitMemberList []*apistruct.GroupAddMemberInfo `json:"initMemberList"`
|
InitMemberList []*apistruct.GroupAddMemberInfo `json:"initMemberList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pkg/common/db/cache/black.go
vendored
2
pkg/common/db/cache/black.go
vendored
@ -46,7 +46,7 @@ func (b *BlackCacheRedis) NewCache() BlackCache {
|
|||||||
expireTime: b.expireTime,
|
expireTime: b.expireTime,
|
||||||
rcClient: b.rcClient,
|
rcClient: b.rcClient,
|
||||||
blackDB: b.blackDB,
|
blackDB: b.blackDB,
|
||||||
metaCache: NewMetaCacheRedis(b.rcClient, b.metaCache.GetPreDeleteKeys()...),
|
metaCache: NewMetaCacheRedis(b.rcClient, b.metaCache.GetPreDelKeys()...),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pkg/common/db/cache/conversation.go
vendored
2
pkg/common/db/cache/conversation.go
vendored
@ -68,7 +68,7 @@ func NewNewConversationRedis(rdb redis.UniversalClient, conversationDB *relation
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConversationRedisCache) NewCache() ConversationCache {
|
func (c *ConversationRedisCache) NewCache() ConversationCache {
|
||||||
return &ConversationRedisCache{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDeleteKeys()...), conversationDB: c.conversationDB, expireTime: c.expireTime}
|
return &ConversationRedisCache{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDelKeys()...), conversationDB: c.conversationDB, expireTime: c.expireTime}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConversationRedisCache) getConversationKey(ownerUserID, conversationID string) string {
|
func (c *ConversationRedisCache) getConversationKey(ownerUserID, conversationID string) string {
|
||||||
|
2
pkg/common/db/cache/extend_msg_set.go
vendored
2
pkg/common/db/cache/extend_msg_set.go
vendored
@ -40,7 +40,7 @@ func NewExtendMsgSetCacheRedis(rdb redis.UniversalClient, extendMsgSetDB unrelat
|
|||||||
|
|
||||||
func (e *ExtendMsgSetCacheRedis) NewCache() ExtendMsgSetCache {
|
func (e *ExtendMsgSetCacheRedis) NewCache() ExtendMsgSetCache {
|
||||||
return &ExtendMsgSetCacheRedis{
|
return &ExtendMsgSetCacheRedis{
|
||||||
metaCache: NewMetaCacheRedis(e.rcClient, e.metaCache.GetPreDeleteKeys()...),
|
metaCache: NewMetaCacheRedis(e.rcClient, e.metaCache.GetPreDelKeys()...),
|
||||||
expireTime: e.expireTime,
|
expireTime: e.expireTime,
|
||||||
extendMsgSetDB: e.extendMsgSetDB,
|
extendMsgSetDB: e.extendMsgSetDB,
|
||||||
rcClient: e.rcClient,
|
rcClient: e.rcClient,
|
||||||
|
2
pkg/common/db/cache/friend.go
vendored
2
pkg/common/db/cache/friend.go
vendored
@ -48,7 +48,7 @@ func NewFriendCacheRedis(rdb redis.UniversalClient, friendDB relationTb.FriendMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *FriendCacheRedis) NewCache() FriendCache {
|
func (c *FriendCacheRedis) NewCache() FriendCache {
|
||||||
return &FriendCacheRedis{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDeleteKeys()...), friendDB: c.friendDB, expireTime: c.expireTime}
|
return &FriendCacheRedis{rcClient: c.rcClient, metaCache: NewMetaCacheRedis(c.rcClient, c.metaCache.GetPreDelKeys()...), friendDB: c.friendDB, expireTime: c.expireTime}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FriendCacheRedis) getFriendIDsKey(ownerUserID string) string {
|
func (f *FriendCacheRedis) getFriendIDsKey(ownerUserID string) string {
|
||||||
|
2
pkg/common/db/cache/group.go
vendored
2
pkg/common/db/cache/group.go
vendored
@ -74,7 +74,7 @@ func NewGroupCacheRedis(rdb redis.UniversalClient, groupDB relationTb.GroupModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupCacheRedis) NewCache() GroupCache {
|
func (g *GroupCacheRedis) NewCache() GroupCache {
|
||||||
return &GroupCacheRedis{rcClient: g.rcClient, expireTime: g.expireTime, groupDB: g.groupDB, groupMemberDB: g.groupMemberDB, groupRequestDB: g.groupRequestDB, mongoDB: g.mongoDB, metaCache: NewMetaCacheRedis(g.rcClient, g.metaCache.GetPreDeleteKeys()...)}
|
return &GroupCacheRedis{rcClient: g.rcClient, expireTime: g.expireTime, groupDB: g.groupDB, groupMemberDB: g.groupMemberDB, groupRequestDB: g.groupRequestDB, mongoDB: g.mongoDB, metaCache: NewMetaCacheRedis(g.rcClient, g.metaCache.GetPreDelKeys()...)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupCacheRedis) getGroupInfoKey(groupID string) string {
|
func (g *GroupCacheRedis) getGroupInfoKey(groupID string) string {
|
||||||
|
9
pkg/common/db/cache/rockscache.go
vendored
9
pkg/common/db/cache/rockscache.go
vendored
@ -21,7 +21,8 @@ type metaCache interface {
|
|||||||
// delete key rapid
|
// delete key rapid
|
||||||
DelKey(ctx context.Context, key string) error
|
DelKey(ctx context.Context, key string) error
|
||||||
AddKeys(keys ...string)
|
AddKeys(keys ...string)
|
||||||
GetPreDeleteKeys() []string
|
ClearKeys()
|
||||||
|
GetPreDelKeys() []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMetaCacheRedis(rcClient *rockscache.Client, keys ...string) metaCache {
|
func NewMetaCacheRedis(rcClient *rockscache.Client, keys ...string) metaCache {
|
||||||
@ -49,7 +50,11 @@ func (m *metaCacheRedis) AddKeys(keys ...string) {
|
|||||||
m.keys = append(m.keys, keys...)
|
m.keys = append(m.keys, keys...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *metaCacheRedis) GetPreDeleteKeys() []string {
|
func (m *metaCacheRedis) ClearKeys() {
|
||||||
|
m.keys = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *metaCacheRedis) GetPreDelKeys() []string {
|
||||||
return m.keys
|
return m.keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pkg/common/db/cache/user.go
vendored
2
pkg/common/db/cache/user.go
vendored
@ -44,7 +44,7 @@ func NewUserCacheRedis(rdb redis.UniversalClient, userDB relationTb.UserModelInt
|
|||||||
|
|
||||||
func (u *UserCacheRedis) NewCache() UserCache {
|
func (u *UserCacheRedis) NewCache() UserCache {
|
||||||
return &UserCacheRedis{
|
return &UserCacheRedis{
|
||||||
metaCache: NewMetaCacheRedis(u.rcClient, u.metaCache.GetPreDeleteKeys()...),
|
metaCache: NewMetaCacheRedis(u.rcClient, u.metaCache.GetPreDelKeys()...),
|
||||||
userDB: u.userDB,
|
userDB: u.userDB,
|
||||||
expireTime: u.expireTime,
|
expireTime: u.expireTime,
|
||||||
rcClient: u.rcClient,
|
rcClient: u.rcClient,
|
||||||
|
@ -75,10 +75,10 @@ func (c *ConversationDataBase) SetUsersConversationFiledTx(ctx context.Context,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cache = cache.DelConversationIDs(NotUserIDs)
|
cache = cache.DelConversationIDs(NotUserIDs)
|
||||||
log.ZDebug(ctx, "SetUsersConversationFiledTx", "cache", cache.GetPreDeleteKeys(), "addr", &cache)
|
log.ZDebug(ctx, "SetUsersConversationFiledTx", "cache", cache.GetPreDelKeys(), "addr", &cache)
|
||||||
}
|
}
|
||||||
// clear cache
|
// clear cache
|
||||||
log.ZDebug(ctx, "SetUsersConversationFiledTx", "cache", cache.GetPreDeleteKeys(), "addr", &cache)
|
log.ZDebug(ctx, "SetUsersConversationFiledTx", "cache", cache.GetPreDelKeys(), "addr", &cache)
|
||||||
return cache.DelUsersConversation(haveUserIDs, conversation.ConversationID).ExecDel(ctx)
|
return cache.DelUsersConversation(haveUserIDs, conversation.ConversationID).ExecDel(ctx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,15 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/nfnt/resize"
|
|
||||||
"golang.org/x/image/bmp"
|
|
||||||
"image"
|
"image"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
"image/png"
|
"image/png"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/nfnt/resize"
|
||||||
|
"golang.org/x/image/bmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenSmallImage(src, dst string) error {
|
func GenSmallImage(src, dst string) error {
|
||||||
@ -51,6 +52,4 @@ func scale(in io.Reader, out io.Writer, width, height, quality int) error {
|
|||||||
default:
|
default:
|
||||||
return errors.New("ERROR FORMAT")
|
return errors.New("ERROR FORMAT")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user