mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 21:02:11 +08:00
feat: add openim make lint
This commit is contained in:
parent
9ce3708a17
commit
b0a3cbdf4f
@ -174,20 +174,18 @@ linters-settings:
|
|||||||
# - ^print.*$
|
# - ^print.*$
|
||||||
- 'fmt\.Print.*'
|
- 'fmt\.Print.*'
|
||||||
- fmt.Println.* # too much log noise
|
- fmt.Println.* # too much log noise
|
||||||
|
- painc
|
||||||
# - ginkgo\\.F.* # these are used just for local development
|
# - ginkgo\\.F.* # these are used just for local development
|
||||||
# # Exclude godoc examples from forbidigo checks. Default is true.
|
# # Exclude godoc examples from forbidigo checks. Default is true.
|
||||||
# exclude_godoc_examples: false
|
# exclude_godoc_examples: false
|
||||||
funlen:
|
funlen:
|
||||||
lines: 150
|
lines: 220
|
||||||
statements: 80
|
statements: 80
|
||||||
gci:
|
|
||||||
# put imports beginning with prefix after 3rd-party packages;
|
|
||||||
# only support one prefix
|
|
||||||
# if not set, use goimports.local-prefixes
|
|
||||||
prefix: github.com/openimsdk/open-im-server
|
|
||||||
gocognit:
|
gocognit:
|
||||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||||
min-complexity: 30
|
min-complexity: 30
|
||||||
|
|
||||||
goconst:
|
goconst:
|
||||||
# minimal length of string constant, 3 by default
|
# minimal length of string constant, 3 by default
|
||||||
min-len: 3
|
min-len: 3
|
||||||
@ -213,9 +211,6 @@ linters-settings:
|
|||||||
# By default list of stable checks is used.
|
# By default list of stable checks is used.
|
||||||
enabled-checks:
|
enabled-checks:
|
||||||
#- rangeValCopy
|
#- rangeValCopy
|
||||||
- nestingreduce
|
|
||||||
- truncatecmp
|
|
||||||
- unnamedresult
|
|
||||||
- ruleguard
|
- ruleguard
|
||||||
|
|
||||||
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
|
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
|
||||||
@ -286,6 +281,9 @@ linters-settings:
|
|||||||
exclude:
|
exclude:
|
||||||
# example: exclude comments which contain numbers
|
# example: exclude comments which contain numbers
|
||||||
- '[0-9]+'
|
- '[0-9]+'
|
||||||
|
- 'func\s+\w+'
|
||||||
|
- 'FIXME:'
|
||||||
|
- '.*func.*'
|
||||||
# check that each sentence starts with a capital letter
|
# check that each sentence starts with a capital letter
|
||||||
capital: true
|
capital: true
|
||||||
godox:
|
godox:
|
||||||
@ -364,6 +362,7 @@ linters-settings:
|
|||||||
retract-allow-no-explanation: false
|
retract-allow-no-explanation: false
|
||||||
# Forbid the use of the `exclude` directives. Default is false.
|
# Forbid the use of the `exclude` directives. Default is false.
|
||||||
exclude-forbidden: false
|
exclude-forbidden: false
|
||||||
|
|
||||||
gomodguard:
|
gomodguard:
|
||||||
allowed:
|
allowed:
|
||||||
modules:
|
modules:
|
||||||
@ -740,8 +739,10 @@ linters:
|
|||||||
- dupword
|
- dupword
|
||||||
- errname
|
- errname
|
||||||
- gci
|
- gci
|
||||||
|
- gocritic
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gomnd
|
- gomnd
|
||||||
|
- goconst
|
||||||
- gosec
|
- gosec
|
||||||
- misspell # Spelling mistakes
|
- misspell # Spelling mistakes
|
||||||
- staticcheck # Static analysis
|
- staticcheck # Static analysis
|
||||||
|
|||||||
@ -115,7 +115,7 @@ func (o *GroupApi) GetGroupAbstractInfo(c *gin.Context) {
|
|||||||
a2r.Call(group.GroupClient.GetGroupAbstractInfo, o.Client, c)
|
a2r.Call(group.GroupClient.GetGroupAbstractInfo, o.Client, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (g *Group) SetGroupMemberNickname(c *gin.Context) {
|
// func (g *Group) SetGroupMemberNickname(c *gin.Context) {
|
||||||
// a2r.Call(group.GroupClient.SetGroupMemberNickname, g.userClient, c)
|
// a2r.Call(group.GroupClient.SetGroupMemberNickname, g.userClient, c)
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
|
|||||||
@ -86,7 +86,7 @@ func (d *GWebSocket) WriteMessage(messageType int, message []byte) error {
|
|||||||
return d.conn.WriteMessage(messageType, message)
|
return d.conn.WriteMessage(messageType, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (d *GWebSocket) setSendConn(sendConn *websocket.Conn) {
|
// func (d *GWebSocket) setSendConn(sendConn *websocket.Conn) {
|
||||||
// d.sendConn = sendConn
|
// d.sendConn = sendConn
|
||||||
//}
|
//}
|
||||||
|
|
||||||
@ -145,6 +145,6 @@ func (d *GWebSocket) SetPingHandler(handler PingPongHandler) {
|
|||||||
d.conn.SetPingHandler(handler)
|
d.conn.SetPingHandler(handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (d *GWebSocket) CheckSendConnDiffNow() bool {
|
// func (d *GWebSocket) CheckSendConnDiffNow() bool {
|
||||||
// return d.conn == d.sendConn
|
// return d.conn == d.sendConn
|
||||||
//}
|
//}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ func (a *Audience) set(key string, v []string) {
|
|||||||
a.audience = make(map[string][]string)
|
a.audience = make(map[string][]string)
|
||||||
a.Object = a.audience
|
a.Object = a.audience
|
||||||
}
|
}
|
||||||
//v, ok = this.audience[key]
|
// v, ok = this.audience[key]
|
||||||
//if ok {
|
//if ok {
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
|||||||
@ -314,7 +314,7 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
|
|||||||
|
|
||||||
// Get user IDs with "Do Not Disturb" enabled in super large groups.
|
// Get user IDs with "Do Not Disturb" enabled in super large groups.
|
||||||
func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbconversation.GetRecvMsgNotNotifyUserIDsReq) (*pbconversation.GetRecvMsgNotNotifyUserIDsResp, error) {
|
func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbconversation.GetRecvMsgNotNotifyUserIDsReq) (*pbconversation.GetRecvMsgNotNotifyUserIDsResp, error) {
|
||||||
//userIDs, err := c.conversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID)
|
// userIDs, err := c.conversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID)
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
//}
|
//}
|
||||||
@ -433,7 +433,7 @@ func (c *conversationServer) conversationSort(conversations map[int64]string, re
|
|||||||
keys = append(keys, key)
|
keys = append(keys, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(keys[:], func(i, j int) bool {
|
sort.Slice(keys, func(i, j int) bool {
|
||||||
return keys[i] > keys[j]
|
return keys[i] > keys[j]
|
||||||
})
|
})
|
||||||
index := 0
|
index := 0
|
||||||
|
|||||||
@ -107,7 +107,7 @@ func Start(config *config.GlobalConfig, client discoveryregistry.SvcDiscoveryReg
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *groupServer) GetJoinedGroupIDs(ctx context.Context, req *pbgroup.GetJoinedGroupIDsReq) (*pbgroup.GetJoinedGroupIDsResp, error) {
|
func (s *groupServer) GetJoinedGroupIDs(ctx context.Context, req *pbgroup.GetJoinedGroupIDsReq) (*pbgroup.GetJoinedGroupIDsResp, error) {
|
||||||
//TODO implement me
|
// TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -155,7 +155,7 @@ func (m *msgServer) MarkConversationAsRead(ctx context.Context, req *msg.MarkCon
|
|||||||
for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ {
|
for i := hasReadSeq + 1; i <= req.HasReadSeq; i++ {
|
||||||
seqs = append(seqs, i)
|
seqs = append(seqs, i)
|
||||||
}
|
}
|
||||||
//avoid client missed call MarkConversationMessageAsRead by order
|
// avoid client missed call MarkConversationMessageAsRead by order
|
||||||
for _, val := range req.Seqs {
|
for _, val := range req.Seqs {
|
||||||
if !utils2.Contain(val, seqs...) {
|
if !utils2.Contain(val, seqs...) {
|
||||||
seqs = append(seqs, val)
|
seqs = append(seqs, val)
|
||||||
|
|||||||
@ -101,7 +101,7 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
|
|||||||
atUserID = utils.DifferenceString([]string{constant.AtAllString}, msg.AtUserIDList)
|
atUserID = utils.DifferenceString([]string{constant.AtAllString}, msg.AtUserIDList)
|
||||||
if len(atUserID) == 0 { // just @everyone
|
if len(atUserID) == 0 { // just @everyone
|
||||||
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
|
||||||
} else { //@Everyone and @other people
|
} else { // @Everyone and @other people
|
||||||
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe}
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe}
|
||||||
err = m.Conversation.SetConversations(ctx, atUserID, conversation)
|
err = m.Conversation.SetConversations(ctx, atUserID, conversation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -51,7 +51,7 @@ func (m *msgServer) addInterceptorHandler(interceptorFunc ...MessageInterceptorF
|
|||||||
m.Handlers = append(m.Handlers, interceptorFunc...)
|
m.Handlers = append(m.Handlers, interceptorFunc...)
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error {
|
// func (m *msgServer) execInterceptorHandler(ctx context.Context, config *config.GlobalConfig, req *msg.SendMsgReq) error {
|
||||||
// for _, handler := range m.Handlers {
|
// for _, handler := range m.Handlers {
|
||||||
// msgData, err := handler(ctx, config, req)
|
// msgData, err := handler(ctx, config, req)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ type userServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) GetGroupOnlineUser(ctx context.Context, req *pbuser.GetGroupOnlineUserReq) (*pbuser.GetGroupOnlineUserResp, error) {
|
func (s *userServer) GetGroupOnlineUser(ctx context.Context, req *pbuser.GetGroupOnlineUserReq) (*pbuser.GetGroupOnlineUserResp, error) {
|
||||||
//TODO implement me
|
// TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||||
)
|
)
|
||||||
|
|
||||||
//func (c *MsgTool) ConversationsDestructMsgs() {
|
// func (c *MsgTool) ConversationsDestructMsgs() {
|
||||||
// log.ZInfo(context.Background(), "start msg destruct cron task")
|
// log.ZInfo(context.Background(), "start msg destruct cron task")
|
||||||
// ctx := mcontext.NewCtx(utils.GetSelfFuncName())
|
// ctx := mcontext.NewCtx(utils.GetSelfFuncName())
|
||||||
// conversations, err := c.conversationDatabase.GetConversationIDsNeedDestruct(ctx)
|
// conversations, err := c.conversationDatabase.GetConversationIDsNeedDestruct(ctx)
|
||||||
|
|||||||
@ -121,7 +121,7 @@ func InitMsgTool(config *config.GlobalConfig) (*MsgTool, error) {
|
|||||||
return msgTool, nil
|
return msgTool, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (c *MsgTool) AllConversationClearMsgAndFixSeq() {
|
// func (c *MsgTool) AllConversationClearMsgAndFixSeq() {
|
||||||
// ctx := mcontext.NewCtx(utils.GetSelfFuncName())
|
// ctx := mcontext.NewCtx(utils.GetSelfFuncName())
|
||||||
// log.ZInfo(ctx, "============================ start del cron task ============================")
|
// log.ZInfo(ctx, "============================ start del cron task ============================")
|
||||||
// conversationIDs, err := c.conversationDatabase.GetAllConversationIDs(ctx)
|
// conversationIDs, err := c.conversationDatabase.GetAllConversationIDs(ctx)
|
||||||
|
|||||||
@ -128,7 +128,7 @@ func Pb2DBGroupInfo(m *sdkws.GroupInfo) *relation.GroupModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//func Pb2DbGroupMember(m *sdkws.UserInfo) *relation.GroupMemberModel {
|
// func Pb2DbGroupMember(m *sdkws.UserInfo) *relation.GroupMemberModel {
|
||||||
// return &relation.GroupMemberModel{
|
// return &relation.GroupMemberModel{
|
||||||
// UserID: m.UserID,
|
// UserID: m.UserID,
|
||||||
// Nickname: m.Nickname,
|
// Nickname: m.Nickname,
|
||||||
|
|||||||
18
pkg/common/db/cache/conversation.go
vendored
18
pkg/common/db/cache/conversation.go
vendored
@ -30,7 +30,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
//ConversationKey = "CONVERSATION:"
|
// ConversationKey = "CONVERSATION:"
|
||||||
//conversationIDsKey = "CONVERSATION_IDS:"
|
//conversationIDsKey = "CONVERSATION_IDS:"
|
||||||
//conversationIDsHashKey = "CONVERSATION_IDS_HASH:"
|
//conversationIDsHashKey = "CONVERSATION_IDS_HASH:"
|
||||||
//conversationHasReadSeqKey = "CONVERSATION_HAS_READ_SEQ:"
|
//conversationHasReadSeqKey = "CONVERSATION_HAS_READ_SEQ:"
|
||||||
@ -66,13 +66,13 @@ type ConversationCache interface {
|
|||||||
GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error)
|
GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error)
|
||||||
DelUserRecvMsgOpt(ownerUserID, conversationID string) ConversationCache
|
DelUserRecvMsgOpt(ownerUserID, conversationID string) ConversationCache
|
||||||
// get one super group recv msg but do not notification userID list
|
// get one super group recv msg but do not notification userID list
|
||||||
//GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error)
|
// GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error)
|
||||||
DelSuperGroupRecvMsgNotNotifyUserIDs(groupID string) ConversationCache
|
DelSuperGroupRecvMsgNotNotifyUserIDs(groupID string) ConversationCache
|
||||||
// get one super group recv msg but do not notification userID list hash
|
// get one super group recv msg but do not notification userID list hash
|
||||||
//GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error)
|
// GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error)
|
||||||
DelSuperGroupRecvMsgNotNotifyUserIDsHash(groupID string) ConversationCache
|
DelSuperGroupRecvMsgNotNotifyUserIDsHash(groupID string) ConversationCache
|
||||||
|
|
||||||
//GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error)
|
// GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error)
|
||||||
DelUserAllHasReadSeqs(ownerUserID string, conversationIDs ...string) ConversationCache
|
DelUserAllHasReadSeqs(ownerUserID string, conversationIDs ...string) ConversationCache
|
||||||
|
|
||||||
GetConversationsByConversationID(ctx context.Context,
|
GetConversationsByConversationID(ctx context.Context,
|
||||||
@ -104,7 +104,7 @@ type ConversationRedisCache struct {
|
|||||||
expireTime time.Duration
|
expireTime time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
//func NewNewConversationRedis(
|
// func NewNewConversationRedis(
|
||||||
// rdb redis.UniversalClient,
|
// rdb redis.UniversalClient,
|
||||||
// conversationDB *relation.ConversationGorm,
|
// conversationDB *relation.ConversationGorm,
|
||||||
// options rockscache.Options,
|
// options rockscache.Options,
|
||||||
@ -236,7 +236,7 @@ func (c *ConversationRedisCache) DelConversations(ownerUserID string, conversati
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
func (c *ConversationRedisCache) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationtb.ConversationModel, error) {
|
func (c *ConversationRedisCache) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationtb.ConversationModel, error) {
|
||||||
//var keys []string
|
// var keys []string
|
||||||
//for _, conversarionID := range conversationIDs {
|
//for _, conversarionID := range conversationIDs {
|
||||||
// keys = append(keys, c.getConversationKey(ownerUserID, conversarionID))
|
// keys = append(keys, c.getConversationKey(ownerUserID, conversarionID))
|
||||||
//}
|
//}
|
||||||
@ -262,7 +262,7 @@ func (c *ConversationRedisCache) GetUserAllConversations(ctx context.Context, ow
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
//var keys []string
|
// var keys []string
|
||||||
//for _, conversarionID := range conversationIDs {
|
//for _, conversarionID := range conversationIDs {
|
||||||
// keys = append(keys, c.getConversationKey(ownerUserID, conversarionID))
|
// keys = append(keys, c.getConversationKey(ownerUserID, conversarionID))
|
||||||
//}
|
//}
|
||||||
@ -285,7 +285,7 @@ func (c *ConversationRedisCache) GetUserRecvMsgOpt(ctx context.Context, ownerUse
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) {
|
// func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) (userIDs []string, err error) {
|
||||||
// return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsKey(groupID), c.expireTime, func(ctx context.Context) (userIDs []string, err error) {
|
// return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsKey(groupID), c.expireTime, func(ctx context.Context) (userIDs []string, err error) {
|
||||||
// return c.conversationDB.FindSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID)
|
// return c.conversationDB.FindSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID)
|
||||||
// })
|
// })
|
||||||
@ -316,7 +316,7 @@ func (c *ConversationRedisCache) DelSuperGroupRecvMsgNotNotifyUserIDs(groupID st
|
|||||||
return cache
|
return cache
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) {
|
// func (c *ConversationRedisCache) GetSuperGroupRecvMsgNotNotifyUserIDsHash(ctx context.Context, groupID string) (hash uint64, err error) {
|
||||||
// return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsHashKey(groupID), c.expireTime, func(ctx context.Context) (hash uint64, err error) {
|
// return getCache(ctx, c.rcClient, c.getSuperGroupRecvNotNotifyUserIDsHashKey(groupID), c.expireTime, func(ctx context.Context) (hash uint64, err error) {
|
||||||
// userIDs, err := c.GetSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID)
|
// userIDs, err := c.GetSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
|
|||||||
2
pkg/common/db/cache/friend.go
vendored
2
pkg/common/db/cache/friend.go
vendored
@ -29,7 +29,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
friendExpireTime = time.Second * 60 * 60 * 12
|
friendExpireTime = time.Second * 60 * 60 * 12
|
||||||
//FriendIDsKey = "FRIEND_IDS:"
|
// FriendIDsKey = "FRIEND_IDS:"
|
||||||
//TwoWayFriendsIDsKey = "COMMON_FRIENDS_IDS:"
|
//TwoWayFriendsIDsKey = "COMMON_FRIENDS_IDS:"
|
||||||
//friendKey = "FRIEND_INFO:".
|
//friendKey = "FRIEND_INFO:".
|
||||||
)
|
)
|
||||||
|
|||||||
2
pkg/common/db/cache/group.go
vendored
2
pkg/common/db/cache/group.go
vendored
@ -32,7 +32,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
groupExpireTime = time.Second * 60 * 60 * 12
|
groupExpireTime = time.Second * 60 * 60 * 12
|
||||||
//GroupInfoKey = "GROUP_INFO:"
|
// GroupInfoKey = "GROUP_INFO:"
|
||||||
//groupMemberIDsKey = "GROUP_MEMBER_IDS:"
|
//groupMemberIDsKey = "GROUP_MEMBER_IDS:"
|
||||||
//groupMembersHashKey = "GROUP_MEMBERS_HASH2:"
|
//groupMembersHashKey = "GROUP_MEMBERS_HASH2:"
|
||||||
//groupMemberInfoKey = "GROUP_MEMBER_INFO:"
|
//groupMemberInfoKey = "GROUP_MEMBER_INFO:"
|
||||||
|
|||||||
2
pkg/common/db/cache/meta_cache.go
vendored
2
pkg/common/db/cache/meta_cache.go
vendored
@ -240,7 +240,7 @@ func batchGetCache2[T any, K comparable](
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//func batchGetCacheMap[T any](
|
// func batchGetCacheMap[T any](
|
||||||
// ctx context.Context,
|
// ctx context.Context,
|
||||||
// rcClient *rockscache.Client,
|
// rcClient *rockscache.Client,
|
||||||
// keys, originKeys []string,
|
// keys, originKeys []string,
|
||||||
|
|||||||
8
pkg/common/db/cache/msg.go
vendored
8
pkg/common/db/cache/msg.go
vendored
@ -38,10 +38,10 @@ const (
|
|||||||
conversationUserMinSeq = "CON_USER_MIN_SEQ:"
|
conversationUserMinSeq = "CON_USER_MIN_SEQ:"
|
||||||
hasReadSeq = "HAS_READ_SEQ:"
|
hasReadSeq = "HAS_READ_SEQ:"
|
||||||
|
|
||||||
//AppleDeviceToken = "DEVICE_TOKEN".
|
// AppleDeviceToken = "DEVICE_TOKEN".
|
||||||
getuiToken = "GETUI_TOKEN"
|
getuiToken = "GETUI_TOKEN"
|
||||||
getuiTaskID = "GETUI_TASK_ID"
|
getuiTaskID = "GETUI_TASK_ID"
|
||||||
//SignalCache = "SIGNAL_CACHE:"
|
// SignalCache = "SIGNAL_CACHE:"
|
||||||
//signalListCache = "SIGNAL_LIST_CACHE:".
|
//signalListCache = "SIGNAL_LIST_CACHE:".
|
||||||
FCM_TOKEN = "FCM_TOKEN:"
|
FCM_TOKEN = "FCM_TOKEN:"
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ func (c *msgCache) UserDeleteMsgs(ctx context.Context, conversationID string, se
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
//pipe := c.rdb.Pipeline()
|
// pipe := c.rdb.Pipeline()
|
||||||
//for _, seq := range seqs {
|
//for _, seq := range seqs {
|
||||||
// delUserListKey := c.getMessageDelUserListKey(conversationID, seq)
|
// delUserListKey := c.getMessageDelUserListKey(conversationID, seq)
|
||||||
// userDelListKey := c.getUserDelList(conversationID, userID)
|
// userDelListKey := c.getUserDelList(conversationID, userID)
|
||||||
@ -567,7 +567,7 @@ func (c *msgCache) DelUserDeleteMsgsList(ctx context.Context, conversationID str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//for _, seq := range seqs {
|
// for _, seq := range seqs {
|
||||||
// delUsers, err := c.rdb.SMembers(ctx, c.getMessageDelUserListKey(conversationID, seq)).Result()
|
// delUsers, err := c.rdb.SMembers(ctx, c.getMessageDelUserListKey(conversationID, seq)).Result()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// log.ZWarn(ctx, "DelUserDeleteMsgsList failed", err, "conversationID", conversationID, "seq", seq)
|
// log.ZWarn(ctx, "DelUserDeleteMsgsList failed", err, "conversationID", conversationID, "seq", seq)
|
||||||
|
|||||||
4
pkg/common/db/cache/user.go
vendored
4
pkg/common/db/cache/user.go
vendored
@ -35,7 +35,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
userExpireTime = time.Second * 60 * 60 * 12
|
userExpireTime = time.Second * 60 * 60 * 12
|
||||||
//UserInfoKey = "USER_INFO:".
|
// UserInfoKey = "USER_INFO:".
|
||||||
userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:"
|
userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:"
|
||||||
olineStatusKey = "ONLINE_STATUS:"
|
olineStatusKey = "ONLINE_STATUS:"
|
||||||
userOlineStatusExpireTime = time.Second * 60 * 60 * 24
|
userOlineStatusExpireTime = time.Second * 60 * 60 * 24
|
||||||
@ -58,7 +58,7 @@ type UserCache interface {
|
|||||||
type UserCacheRedis struct {
|
type UserCacheRedis struct {
|
||||||
metaCache
|
metaCache
|
||||||
rdb redis.UniversalClient
|
rdb redis.UniversalClient
|
||||||
//userDB relationtb.UserModelInterface
|
// userDB relationtb.UserModelInterface
|
||||||
userDB relationtb.UserModelInterface
|
userDB relationtb.UserModelInterface
|
||||||
expireTime time.Duration
|
expireTime time.Duration
|
||||||
rcClient *rockscache.Client
|
rcClient *rockscache.Client
|
||||||
|
|||||||
@ -141,7 +141,7 @@ func (c *ConversationMgo) GetConversationsByConversationID(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConversationMgo) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relation.ConversationModel, error) {
|
func (c *ConversationMgo) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relation.ConversationModel, error) {
|
||||||
//"is_msg_destruct = 1 && msg_destruct_time != 0 && (UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) || latest_msg_destruct_time is NULL)"
|
// "is_msg_destruct = 1 && msg_destruct_time != 0 && (UNIX_TIMESTAMP(NOW()) > (msg_destruct_time + UNIX_TIMESTAMP(latest_msg_destruct_time)) || latest_msg_destruct_time is NULL)"
|
||||||
return mgoutil.Find[*relation.ConversationModel](ctx, c.coll, bson.M{
|
return mgoutil.Find[*relation.ConversationModel](ctx, c.coll, bson.M{
|
||||||
"is_msg_destruct": 1,
|
"is_msg_destruct": 1,
|
||||||
"msg_destruct_time": bson.M{"$ne": 0},
|
"msg_destruct_time": bson.M{"$ne": 0},
|
||||||
|
|||||||
@ -67,7 +67,7 @@ func (g *GroupMemberMgo) Update(ctx context.Context, groupID string, userID stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GroupMemberMgo) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupMembers []*relation.GroupMemberModel, err error) {
|
func (g *GroupMemberMgo) Find(ctx context.Context, groupIDs []string, userIDs []string, roleLevels []int32) (groupMembers []*relation.GroupMemberModel, err error) {
|
||||||
//TODO implement me
|
// TODO implement me
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ type BlackModel struct {
|
|||||||
type BlackModelInterface interface {
|
type BlackModelInterface interface {
|
||||||
Create(ctx context.Context, blacks []*BlackModel) (err error)
|
Create(ctx context.Context, blacks []*BlackModel) (err error)
|
||||||
Delete(ctx context.Context, blacks []*BlackModel) (err error)
|
Delete(ctx context.Context, blacks []*BlackModel) (err error)
|
||||||
//UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]any) (err error)
|
// UpdateByMap(ctx context.Context, ownerUserID, blockUserID string, args map[string]any) (err error)
|
||||||
//Update(ctx context.Context, blacks []*BlackModel) (err error)
|
//Update(ctx context.Context, blacks []*BlackModel) (err error)
|
||||||
Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error)
|
Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error)
|
||||||
Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error)
|
Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error)
|
||||||
|
|||||||
@ -36,10 +36,10 @@ type GroupMemberModel struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GroupMemberModelInterface interface {
|
type GroupMemberModelInterface interface {
|
||||||
//NewTx(tx any) GroupMemberModelInterface
|
// NewTx(tx any) GroupMemberModelInterface
|
||||||
Create(ctx context.Context, groupMembers []*GroupMemberModel) (err error)
|
Create(ctx context.Context, groupMembers []*GroupMemberModel) (err error)
|
||||||
Delete(ctx context.Context, groupID string, userIDs []string) (err error)
|
Delete(ctx context.Context, groupID string, userIDs []string) (err error)
|
||||||
//DeleteGroup(ctx context.Context, groupIDs []string) (err error)
|
// DeleteGroup(ctx context.Context, groupIDs []string) (err error)
|
||||||
Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error)
|
Update(ctx context.Context, groupID string, userID string, data map[string]any) (err error)
|
||||||
UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error
|
UpdateRoleLevel(ctx context.Context, groupID string, userID string, roleLevel int32) error
|
||||||
FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error)
|
FindMemberUserID(ctx context.Context, groupID string) (userIDs []string, err error)
|
||||||
@ -47,11 +47,11 @@ type GroupMemberModelInterface interface {
|
|||||||
TakeOwner(ctx context.Context, groupID string) (groupMember *GroupMemberModel, err error)
|
TakeOwner(ctx context.Context, groupID string) (groupMember *GroupMemberModel, err error)
|
||||||
SearchMember(ctx context.Context, keyword string, groupID string, pagination pagination.Pagination) (total int64, groupList []*GroupMemberModel, err error)
|
SearchMember(ctx context.Context, keyword string, groupID string, pagination pagination.Pagination) (total int64, groupList []*GroupMemberModel, err error)
|
||||||
FindRoleLevelUserIDs(ctx context.Context, groupID string, roleLevel int32) ([]string, error)
|
FindRoleLevelUserIDs(ctx context.Context, groupID string, roleLevel int32) ([]string, error)
|
||||||
//MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error)
|
// MapGroupMemberNum(ctx context.Context, groupIDs []string) (count map[string]uint32, err error)
|
||||||
//FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error)
|
//FindJoinUserID(ctx context.Context, groupIDs []string) (groupUsers map[string][]string, err error)
|
||||||
FindUserJoinedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
FindUserJoinedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
||||||
TakeGroupMemberNum(ctx context.Context, groupID string) (count int64, err error)
|
TakeGroupMemberNum(ctx context.Context, groupID string) (count int64, err error)
|
||||||
//FindUsersJoinedGroupID(ctx context.Context, userIDs []string) (map[string][]string, error)
|
// FindUsersJoinedGroupID(ctx context.Context, userIDs []string) (map[string][]string, error)
|
||||||
FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
FindUserManagedGroupID(ctx context.Context, userID string) (groupIDs []string, err error)
|
||||||
IsUpdateRoleLevel(data map[string]any) bool
|
IsUpdateRoleLevel(data map[string]any) bool
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ type UserModelInterface interface {
|
|||||||
CountTotal(ctx context.Context, before *time.Time) (count int64, err error)
|
CountTotal(ctx context.Context, before *time.Time) (count int64, err error)
|
||||||
// Get user total quantity every day
|
// Get user total quantity every day
|
||||||
CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
|
CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
|
||||||
//CRUD user command
|
// CRUD user command
|
||||||
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error
|
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error
|
||||||
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
||||||
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error
|
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
package unrelation
|
package unrelation
|
||||||
|
|
||||||
//import (
|
// import (
|
||||||
// "context"
|
// "context"
|
||||||
//)
|
//)
|
||||||
//
|
//
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
package unrelation
|
package unrelation
|
||||||
|
|
||||||
//
|
//
|
||||||
//import (
|
// import (
|
||||||
// "context"
|
// "context"
|
||||||
//
|
//
|
||||||
// "go.mongodb.org/mongo-driver/bson"
|
// "go.mongodb.org/mongo-driver/bson"
|
||||||
|
|||||||
@ -40,7 +40,7 @@ func NewZookeeperDiscoveryRegister(zkConf *config.Zookeeper) (discoveryregistry.
|
|||||||
openkeeper.WithUserNameAndPassword(username, password),
|
openkeeper.WithUserNameAndPassword(username, password),
|
||||||
openkeeper.WithRoundRobin(),
|
openkeeper.WithRoundRobin(),
|
||||||
openkeeper.WithTimeout(10),
|
openkeeper.WithTimeout(10),
|
||||||
//openkeeper.WithLogger(log.NewZkLogger()),
|
// openkeeper.WithLogger(log.NewZkLogger()),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
uriFormat := "address:%s, username:%s, password:%s, schema:%s."
|
uriFormat := "address:%s, username:%s, password:%s, schema:%s."
|
||||||
|
|||||||
@ -35,7 +35,7 @@ type Output struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OpenIMClientVersion struct {
|
type OpenIMClientVersion struct {
|
||||||
ClientVersion string `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"` //sdk core version
|
ClientVersion string `json:"clientVersion,omitempty" yaml:"clientVersion,omitempty"` // sdk core version
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns info as a human-friendly version string.
|
// String returns info as a human-friendly version string.
|
||||||
|
|||||||
@ -68,7 +68,7 @@ func newContentTypeConf(conf *config.Notification) map[int32]config.Notification
|
|||||||
constant.BlackAddedNotification: conf.BlackAdded,
|
constant.BlackAddedNotification: conf.BlackAdded,
|
||||||
constant.BlackDeletedNotification: conf.BlackDeleted,
|
constant.BlackDeletedNotification: conf.BlackDeleted,
|
||||||
constant.FriendInfoUpdatedNotification: conf.FriendInfoUpdated,
|
constant.FriendInfoUpdatedNotification: conf.FriendInfoUpdated,
|
||||||
constant.FriendsInfoUpdateNotification: conf.FriendInfoUpdated, //use the same FriendInfoUpdated
|
constant.FriendsInfoUpdateNotification: conf.FriendInfoUpdated, // use the same FriendInfoUpdated
|
||||||
// conversation
|
// conversation
|
||||||
constant.ConversationChangeNotification: conf.ConversationChanged,
|
constant.ConversationChangeNotification: conf.ConversationChanged,
|
||||||
constant.ConversationUnreadNotification: conf.ConversationChanged,
|
constant.ConversationUnreadNotification: conf.ConversationChanged,
|
||||||
|
|||||||
@ -218,7 +218,7 @@ func (f *FriendNotificationSender) BlackDeletedNotification(ctx context.Context,
|
|||||||
ToUserID: req.BlackUserID,
|
ToUserID: req.BlackUserID,
|
||||||
}}
|
}}
|
||||||
if err := f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips); err != nil {
|
if err := f.Notification(ctx, req.OwnerUserID, req.BlackUserID, constant.BlackDeletedNotification, &blackDeletedTips); err != nil {
|
||||||
//err
|
// err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user