Compare commits

..

42 Commits

Author SHA1 Message Date
Xinwei Xiong(cubxxw-openim) d187f53c79 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 11:02:26 +08:00
Xinwei Xiong(cubxxw-openim) 5134fdf7e7 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 11:02:01 +08:00
Xinwei Xiong(cubxxw-openim) 347f6f3382 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 10:52:55 +08:00
Xinwei Xiong(cubxxw-openim) 103aa98e95 fix: kafka environment port
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 10:52:17 +08:00
Xinwei Xiong(cubxxw-openim) 77733fdb2b feat: docker compose
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-03 09:36:32 +08:00
Xinwei Xiong(cubxxw-openim) 3c796b7405 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 21:08:38 +08:00
Xinwei Xiong(cubxxw-openim) fa263b9a87 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 20:40:11 +08:00
Xinwei Xiong(cubxxw-openim) 108c4b1a50 feat: set config file path
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 19:55:01 +08:00
Xinwei Xiong(cubxxw-openim) e4eb8ffd6e fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-02 17:27:18 +08:00
Xinwei Xiong(cubxxw-openim) ca72ce2d6f fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-01 17:41:46 +08:00
Xinwei Xiong(cubxxw-openim) 475ad26abd fix: scripts fix
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-09-01 11:24:37 +08:00
Xinwei Xiong(cubxxw-openim) cffefbd242 feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 22:00:01 +08:00
Xinwei Xiong(cubxxw-openim) cc5fa648de feat: add docker buildx images is openim-web
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 20:19:37 +08:00
Xinwei Xiong(cubxxw-openim) 263ab752dd feat: add docker buildx images is openim-web
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:02:29 +08:00
Xinwei Xiong(cubxxw-openim) cf0ef7652a feat: update openim-web
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:02:29 +08:00
Xinwei Xiong(cubxxw-openim) 709d772233 feat: update openim-web
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:02:28 +08:00
Xinwei Xiong(cubxxw-openim) c9df323da4 feat: set more help and port set
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:02:28 +08:00
Xinwei Xiong(cubxxw-openim) 22df23cf8b feat: update openim-web
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:02:26 +08:00
Xinwei Xiong(cubxxw-openim) 0031aeca02 feat: add more test project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:29 +08:00
Xinwei Xiong(cubxxw-openim) 67e6e789ec fix: update slack link
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:29 +08:00
Xinwei Xiong(cubxxw-openim) 9fdb85d354 fix: update slack link
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:29 +08:00
Xinwei Xiong(cubxxw-openim) 8b2bfba89b feat: set more help and port set
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:28 +08:00
Xinwei Xiong(cubxxw-openim) 2934535c18 feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:28 +08:00
Xinwei Xiong(cubxxw-openim) 9b9bfae857 feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:27 +08:00
Xinwei Xiong(cubxxw-openim) 32edd4b17c feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:27 +08:00
Xinwei Xiong(cubxxw-openim) d5651ae1d8 feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:27 +08:00
Xinwei Xiong(cubxxw-openim) 8aad2cf300 feat: add more test
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:26 +08:00
Xinwei Xiong(cubxxw-openim) 4bf4eb5464 feat: add test file
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:26 +08:00
Xinwei Xiong(cubxxw-openim) e66e490ae6 feat: sava images file
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:26 +08:00
Xinwei Xiong(cubxxw-openim) 1d6d163da0 feat: add more test project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:25 +08:00
Xinwei Xiong(cubxxw-openim) 8e1bb9abb9 feat: add more test project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:25 +08:00
Xinwei Xiong(cubxxw-openim) d26e2594f2 feat: add more test project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:24 +08:00
Xinwei Xiong(cubxxw-openim) 5893181226 fix: fix chat bug
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:24 +08:00
Xinwei Xiong(cubxxw-openim) e2b581f2cc feat: add test file
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:24 +08:00
Xinwei Xiong(cubxxw-openim) 2531091742 fix: fix actions no pass
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:23 +08:00
Xinwei Xiong(cubxxw-openim) 9d42a2abc2 feat: fix go work go version and build scripts
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:23 +08:00
Xinwei Xiong(cubxxw-openim) 0ff8402c83 feat: add versionchecker deploy
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:22 +08:00
Xinwei Xiong(cubxxw-openim) 76484e09ac feat: init project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:22 +08:00
Xinwei Xiong(cubxxw-openim) 8c2e7c1fdc feat: init project
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:22 +08:00
Xinwei Xiong(cubxxw-openim) d62fedcabb feat: add more test code
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:21 +08:00
Xinwei Xiong(cubxxw-openim) 4d89bba8c0 feat: add more test code
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:21 +08:00
Xinwei Xiong(cubxxw-openim) 8da0c53523 feat: add more test code
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
2023-08-30 19:01:21 +08:00
15 changed files with 41 additions and 142 deletions
+14
View File
@@ -18,6 +18,9 @@ import (
"context"
"fmt"
"net"
"net/http"
"os"
"runtime"
"strconv"
"time"
@@ -43,6 +46,16 @@ func main() {
}
}
func startPprof() {
runtime.GOMAXPROCS(1)
runtime.SetMutexProfileFraction(1)
runtime.SetBlockProfileRate(1)
if err := http.ListenAndServe(":6060", nil); err != nil {
panic(err)
}
os.Exit(0)
}
func run(port int) error {
if port == 0 {
return fmt.Errorf("port is empty")
@@ -79,6 +92,7 @@ func run(port int) error {
}
fmt.Println("start api server, address: ", address, ", OpenIM version: ", config.Version)
log.ZInfo(context.Background(), "start server success", "address", address, "version", config.Version)
go startPprof()
err = router.Run(address)
if err != nil {
log.ZError(context.Background(), "api run failed ", err, "address", address)
+1 -1
View File
@@ -37,7 +37,7 @@ require (
require github.com/google/uuid v1.3.0
require (
github.com/OpenIMSDK/protocol v0.0.18
github.com/OpenIMSDK/protocol v0.0.17
github.com/OpenIMSDK/tools v0.0.14
github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible
github.com/go-redis/redis v6.15.9+incompatible
+2 -2
View File
@@ -17,8 +17,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/OpenIMSDK/protocol v0.0.18 h1:hXukFiDMLZx7s+hDCQePIK9ABiHyNlobNL4MppvOuMY=
github.com/OpenIMSDK/protocol v0.0.18/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/protocol v0.0.17 h1:ixjKUVGlTW+jQK5cPaKV//6l4bk9DAlbjDhocztYSbU=
github.com/OpenIMSDK/protocol v0.0.17/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/tools v0.0.14 h1:WLof/+WxyPyRST+QkoTKubYCiV73uCLiL8pgnpH/yKQ=
github.com/OpenIMSDK/tools v0.0.14/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
-4
View File
@@ -88,7 +88,3 @@ func (o *FriendApi) IsFriend(c *gin.Context) {
func (o *FriendApi) GetFriendIDs(c *gin.Context) {
a2r.Call(friend.FriendClient.GetFriendIDs, o.Client, c)
}
func (o *FriendApi) GetSpecifiedFriendsInfo(c *gin.Context) {
a2r.Call(friend.FriendClient.GetSpecifiedFriendsInfo, o.Client, c)
}
+6 -1
View File
@@ -170,7 +170,12 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM
log.ZDebug(c, "getSendMsgReq", "req", req.Content)
switch req.ContentType {
case constant.Text:
data = apistruct.TextElem{}
text, ok := req.Content["text"].(string)
if !ok {
return nil, errs.ErrArgs.WithDetail("text is not string")
}
data = apistruct.TextContentElem{Content: text}
log.ZDebug(c, "getSendMsgReq", "data", data)
case constant.Picture:
data = apistruct.PictureElem{}
case constant.Voice:
-1
View File
@@ -106,7 +106,6 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
friendRouterGroup.POST("/import_friend", f.ImportFriends)
friendRouterGroup.POST("/is_friend", f.IsFriend)
friendRouterGroup.POST("/get_friend_id", f.GetFriendIDs)
friendRouterGroup.POST("/get_specified_friends_info", f.GetSpecifiedFriendsInfo)
}
g := NewGroupApi(*groupRpc)
groupRouterGroup := r.Group("/group", ParseToken)
+6 -45
View File
@@ -133,18 +133,6 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
// }
// }
}
var unequal int
var conv tablerelation.ConversationModel
if len(req.UserIDs) == 1 {
cs, err := c.conversationDatabase.FindConversations(ctx, req.UserIDs[0], []string{req.Conversation.ConversationID})
if err != nil {
return nil, err
}
if len(cs) == 0 {
return nil, errs.ErrRecordNotFound.Wrap("conversation not found")
}
conv = *cs[0]
}
var conversation tablerelation.ConversationModel
conversation.ConversationID = req.Conversation.ConversationID
conversation.ConversationType = req.Conversation.ConversationType
@@ -153,45 +141,24 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
m := make(map[string]interface{})
if req.Conversation.RecvMsgOpt != nil {
m["recv_msg_opt"] = req.Conversation.RecvMsgOpt.Value
if req.Conversation.RecvMsgOpt.Value != conv.RecvMsgOpt {
unequal++
}
}
if req.Conversation.AttachedInfo != nil {
m["attached_info"] = req.Conversation.AttachedInfo.Value
if req.Conversation.AttachedInfo.Value != conv.AttachedInfo {
unequal++
}
}
if req.Conversation.Ex != nil {
m["ex"] = req.Conversation.Ex.Value
if req.Conversation.Ex.Value != conv.Ex {
unequal++
}
}
if req.Conversation.IsPinned != nil {
m["is_pinned"] = req.Conversation.IsPinned.Value
if req.Conversation.IsPinned.Value != conv.IsPinned {
unequal++
}
}
if req.Conversation.GroupAtType != nil {
m["group_at_type"] = req.Conversation.GroupAtType.Value
if req.Conversation.GroupAtType.Value != conv.GroupAtType {
unequal++
}
}
if req.Conversation.MsgDestructTime != nil {
m["msg_destruct_time"] = req.Conversation.MsgDestructTime.Value
if req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime {
unequal++
}
}
if req.Conversation.IsMsgDestruct != nil {
m["is_msg_destruct"] = req.Conversation.IsMsgDestruct.Value
if req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct {
unequal++
}
}
if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.SuperGroupChatType {
var conversations []*tablerelation.ConversationModel
@@ -204,25 +171,19 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
if err := c.conversationDatabase.SyncPeerUserPrivateConversationTx(ctx, conversations); err != nil {
return nil, err
}
if len(req.UserIDs) != 1 || unequal > 0 {
for _, userID := range req.UserIDs {
c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID)
}
for _, userID := range req.UserIDs {
c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value, req.Conversation.ConversationID)
}
}
if req.Conversation.BurnDuration != nil {
m["burn_duration"] = req.Conversation.BurnDuration.Value
if req.Conversation.BurnDuration.Value != conv.BurnDuration {
unequal++
}
}
if err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m); err != nil {
err := c.conversationDatabase.SetUsersConversationFiledTx(ctx, req.UserIDs, &conversation, m)
if err != nil {
return nil, err
}
if len(req.UserIDs) != 1 || unequal > 0 {
for _, v := range req.UserIDs {
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
}
for _, v := range req.UserIDs {
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
}
return &pbconversation.SetConversationsResp{}, nil
}
-65
View File
@@ -17,8 +17,6 @@ package friend
import (
"context"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/tools/log"
@@ -359,66 +357,3 @@ func (s *friendServer) GetFriendIDs(
}
return resp, nil
}
func (s *friendServer) GetSpecifiedFriendsInfo(ctx context.Context, req *pbfriend.GetSpecifiedFriendsInfoReq) (*pbfriend.GetSpecifiedFriendsInfoResp, error) {
if len(req.UserIDList) == 0 {
return nil, errs.ErrArgs.Wrap("userIDList is empty")
}
if utils.Duplicate(req.UserIDList) {
return nil, errs.ErrArgs.Wrap("userIDList repeated")
}
userMap, err := s.userRpcClient.GetUsersInfoMap(ctx, req.UserIDList)
if err != nil {
return nil, err
}
friends, err := s.friendDatabase.FindFriendsWithError(ctx, req.OwnerUserID, req.UserIDList)
if err != nil {
return nil, err
}
blacks, err := s.blackDatabase.FindBlackInfos(ctx, req.OwnerUserID, req.UserIDList)
if err != nil {
return nil, err
}
friendMap := utils.SliceToMap(friends, func(e *tablerelation.FriendModel) string {
return e.FriendUserID
})
blackMap := utils.SliceToMap(blacks, func(e *tablerelation.BlackModel) string {
return e.BlockUserID
})
resp := &pbfriend.GetSpecifiedFriendsInfoResp{
Infos: make([]*pbfriend.GetSpecifiedFriendsInfoInfo, 0, len(req.UserIDList)),
}
for _, userID := range req.UserIDList {
user := userMap[userID]
if user == nil {
continue
}
var friendInfo *sdkws.FriendInfo
if friend := friendMap[userID]; friend != nil {
friendInfo = &sdkws.FriendInfo{
OwnerUserID: friend.OwnerUserID,
Remark: friend.Remark,
CreateTime: friend.CreateTime.UnixMilli(),
AddSource: friend.AddSource,
OperatorUserID: friend.OperatorUserID,
Ex: friend.Ex,
}
}
var blackInfo *sdkws.BlackInfo
if black := blackMap[userID]; black != nil {
blackInfo = &sdkws.BlackInfo{
OwnerUserID: black.OwnerUserID,
CreateTime: black.CreateTime.UnixMilli(),
AddSource: black.AddSource,
OperatorUserID: black.OperatorUserID,
Ex: black.Ex,
}
}
resp.Infos = append(resp.Infos, &pbfriend.GetSpecifiedFriendsInfoInfo{
UserInfo: user,
FriendInfo: friendInfo,
BlackInfo: blackInfo,
})
}
return resp, nil
}
+1 -3
View File
@@ -128,9 +128,7 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe
func (m *msgServer) encapsulateMsgData(msg *sdkws.MsgData) {
msg.ServerMsgID = GetMsgID(msg.SendID)
if msg.SendTime == 0 {
msg.SendTime = utils.GetCurrentTimestampByMill()
}
msg.SendTime = utils.GetCurrentTimestampByMill()
switch msg.ContentType {
case constant.Text:
fallthrough
+4 -1
View File
@@ -72,8 +72,11 @@ type CustomElem struct {
Description string `mapstructure:"description"`
Extension string `mapstructure:"extension"`
}
type TextElem struct {
Text string `mapstructure:"text" validate:"required"`
}
type TextContentElem struct {
Content string `json:"content" validate:"required"`
}
+1 -1
View File
@@ -244,7 +244,7 @@ func (u *UserCacheRedis) SetUserStatus(ctx context.Context, list []*user.OnlineS
}
if newPlatformIDs == nil {
onlineStatus.Status = constant.Offline
onlineStatus.PlatformIDs = []int32{}
onlineStatus.PlatformIDs = nil
newjsonData, err := json.Marshal(&onlineStatus)
if err != nil {
return errs.Wrap(err)
-5
View File
@@ -36,7 +36,6 @@ type BlackDatabase interface {
pageNumber, showNumber int32,
) (blacks []*relation.BlackModel, total int64, err error)
FindBlackIDs(ctx context.Context, ownerUserID string) (blackIDs []string, err error)
FindBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*relation.BlackModel, err error)
// CheckIn 检查user2是否在user1的黑名单列表中(inUser1Blacks==true) 检查user1是否在user2的黑名单列表中(inUser2Blacks==true)
CheckIn(ctx context.Context, userID1, userID2 string) (inUser1Blacks bool, inUser2Blacks bool, err error)
}
@@ -103,7 +102,3 @@ func (b *blackDatabase) CheckIn(
func (b *blackDatabase) FindBlackIDs(ctx context.Context, ownerUserID string) (blackIDs []string, err error) {
return b.cache.GetBlackIDs(ctx, ownerUserID)
}
func (b *blackDatabase) FindBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*relation.BlackModel, err error) {
return b.black.FindOwnerBlackInfos(ctx, ownerUserID, userIDs)
}
-6
View File
@@ -17,8 +17,6 @@ package relation
import (
"context"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/ormutil"
"gorm.io/gorm"
@@ -105,7 +103,3 @@ func (b *BlackGorm) FindBlackUserIDs(ctx context.Context, ownerUserID string) (b
"",
)
}
func (b *BlackGorm) FindOwnerBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*relation.BlackModel, err error) {
return blacks, errs.Wrap(b.db(ctx).Where("owner_user_id = ? and block_user_id in ?", ownerUserID, userIDs).Find(&blacks).Error)
}
+5 -2
View File
@@ -43,7 +43,10 @@ type BlackModelInterface interface {
Update(ctx context.Context, blacks []*BlackModel) (err error)
Find(ctx context.Context, blacks []*BlackModel) (blackList []*BlackModel, err error)
Take(ctx context.Context, ownerUserID, blockUserID string) (black *BlackModel, err error)
FindOwnerBlacks(ctx context.Context, ownerUserID string, pageNumber, showNumber int32) (blacks []*BlackModel, total int64, err error)
FindOwnerBlackInfos(ctx context.Context, ownerUserID string, userIDs []string) (blacks []*BlackModel, err error)
FindOwnerBlacks(
ctx context.Context,
ownerUserID string,
pageNumber, showNumber int32,
) (blacks []*BlackModel, total int64, err error)
FindBlackUserIDs(ctx context.Context, ownerUserID string) (blackUserIDs []string, err error)
}
+1 -5
View File
@@ -250,11 +250,7 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s
}
msg.CreateTime = utils.GetCurrentTimestampByMill()
msg.ClientMsgID = utils.GetMsgID(sendID)
optionsConfig := s.contentTypeConf[contentType]
if sesstionType == constant.SuperGroupChatType && contentType == constant.HasReadReceipt {
optionsConfig.ReliabilityLevel = constant.UnreliableNotification
}
options := config.GetOptionsByNotification(optionsConfig)
options := config.GetOptionsByNotification(s.contentTypeConf[contentType])
msg.Options = options
offlineInfo.Title = title
offlineInfo.Desc = desc