mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
feat: Change after webhook filter && feat SendSimpleMsg (#3151)
* feat: msg filter and search system account * feat: search system account * chore: msg * chore: msg * chore: msg * chore: webhook filter && sendSimpleMessage
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
"github.com/openimsdk/tools/db/pagination"
|
||||
"github.com/openimsdk/tools/db/tx"
|
||||
"github.com/openimsdk/tools/utils/datautil"
|
||||
@@ -37,8 +38,10 @@ type UserDatabase interface {
|
||||
Find(ctx context.Context, userIDs []string) (users []*model.User, err error)
|
||||
// Find userInfo By Nickname
|
||||
FindByNickname(ctx context.Context, nickname string) (users []*model.User, err error)
|
||||
// Find notificationAccounts
|
||||
// FindNotification find system account by level
|
||||
FindNotification(ctx context.Context, level int64) (users []*model.User, err error)
|
||||
// FindSystemAccount find all system account
|
||||
FindSystemAccount(ctx context.Context) (users []*model.User, err error)
|
||||
// Create Insert multiple external guarantees that the userID is not repeated and does not exist in the storage
|
||||
Create(ctx context.Context, users []*model.User) (err error)
|
||||
// UpdateByMap update (zero value) external guarantee userID exists
|
||||
@@ -139,6 +142,10 @@ func (u *userDatabase) FindNotification(ctx context.Context, level int64) (users
|
||||
return u.userDB.TakeNotification(ctx, level)
|
||||
}
|
||||
|
||||
func (u *userDatabase) FindSystemAccount(ctx context.Context) (users []*model.User, err error) {
|
||||
return u.userDB.TakeGTEAppManagerLevel(ctx, constant.AppNotificationAdmin)
|
||||
}
|
||||
|
||||
// Create Insert multiple external guarantees that the userID is not repeated and does not exist in the storage.
|
||||
func (u *userDatabase) Create(ctx context.Context, users []*model.User) (err error) {
|
||||
return u.tx.Transaction(ctx, func(ctx context.Context) error {
|
||||
|
||||
@@ -16,9 +16,10 @@ package mgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/protocol/user"
|
||||
"github.com/openimsdk/tools/db/mongoutil"
|
||||
@@ -71,6 +72,10 @@ func (u *UserMgo) TakeNotification(ctx context.Context, level int64) (user []*mo
|
||||
return mongoutil.Find[*model.User](ctx, u.coll, bson.M{"app_manger_level": level})
|
||||
}
|
||||
|
||||
func (u *UserMgo) TakeGTEAppManagerLevel(ctx context.Context, level int64) (user []*model.User, err error) {
|
||||
return mongoutil.Find[*model.User](ctx, u.coll, bson.M{"app_manager_level": bson.M{"$gte": level}})
|
||||
}
|
||||
|
||||
func (u *UserMgo) TakeByNickname(ctx context.Context, nickname string) (user []*model.User, err error) {
|
||||
return mongoutil.Find[*model.User](ctx, u.coll, bson.M{"nickname": nickname})
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@ package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||
"github.com/openimsdk/protocol/user"
|
||||
"github.com/openimsdk/tools/db/pagination"
|
||||
"time"
|
||||
)
|
||||
|
||||
type User interface {
|
||||
@@ -28,6 +29,7 @@ type User interface {
|
||||
Find(ctx context.Context, userIDs []string) (users []*model.User, err error)
|
||||
Take(ctx context.Context, userID string) (user *model.User, err error)
|
||||
TakeNotification(ctx context.Context, level int64) (user []*model.User, err error)
|
||||
TakeGTEAppManagerLevel(ctx context.Context, level int64) (user []*model.User, err error)
|
||||
TakeByNickname(ctx context.Context, nickname string) (user []*model.User, err error)
|
||||
Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*model.User, err error)
|
||||
PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*model.User, err error)
|
||||
|
||||
Reference in New Issue
Block a user