mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-19 04:37:01 +08:00
Merge branch 'OpenIMSDK:main' into add-feature-829
This commit is contained in:
commit
ff958b99fb
@ -62,6 +62,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
restart: always
|
restart: always
|
||||||
|
network_mode: "host"
|
||||||
|
|
||||||
kafka:
|
kafka:
|
||||||
image: wurstmeister/kafka
|
image: wurstmeister/kafka
|
||||||
@ -72,7 +73,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
KAFKA_BROKER_ID: 0
|
KAFKA_BROKER_ID: 0
|
||||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181
|
||||||
KAFKA_CREATE_TOPICS: "latestMsgToRedis:8:1,msgToPush:8:1,offlineMsgToMongoMysql:8:1"
|
KAFKA_CREATE_TOPICS: "latestMsgToRedis:8:1,msgToPush:8:1,offlineMsgToMongoMysql:8:1"
|
||||||
KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9092
|
KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9092
|
||||||
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093
|
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093
|
||||||
@ -80,6 +81,7 @@ services:
|
|||||||
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
|
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper
|
- zookeeper
|
||||||
|
network_mode: "host"
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
|
|||||||
@ -40,7 +40,13 @@ type Req struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Req) String() string {
|
func (r *Req) String() string {
|
||||||
return utils.StructToJsonString(r)
|
var tReq Req
|
||||||
|
tReq.ReqIdentifier = r.ReqIdentifier
|
||||||
|
tReq.Token = r.Token
|
||||||
|
tReq.SendID = r.SendID
|
||||||
|
tReq.OperationID = r.OperationID
|
||||||
|
tReq.MsgIncr = r.MsgIncr
|
||||||
|
return utils.StructToJsonString(tReq)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Resp struct {
|
type Resp struct {
|
||||||
@ -53,7 +59,13 @@ type Resp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resp) String() string {
|
func (r *Resp) String() string {
|
||||||
return utils.StructToJsonString(r)
|
var tResp Resp
|
||||||
|
tResp.ReqIdentifier = r.ReqIdentifier
|
||||||
|
tResp.MsgIncr = r.MsgIncr
|
||||||
|
tResp.OperationID = r.OperationID
|
||||||
|
tResp.ErrCode = r.ErrCode
|
||||||
|
tResp.ErrMsg = r.ErrMsg
|
||||||
|
return utils.StructToJsonString(tResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageHandler interface {
|
type MessageHandler interface {
|
||||||
|
|||||||
@ -20,14 +20,17 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
|
|
||||||
"github.com/OpenIMSDK/protocol/constant"
|
"github.com/OpenIMSDK/protocol/constant"
|
||||||
"github.com/OpenIMSDK/protocol/sdkws"
|
"github.com/OpenIMSDK/protocol/sdkws"
|
||||||
"github.com/OpenIMSDK/tools/errs"
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
"github.com/OpenIMSDK/tools/tx"
|
"github.com/OpenIMSDK/tools/tx"
|
||||||
|
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
|
||||||
|
|
||||||
|
registry "github.com/OpenIMSDK/tools/discoveryregistry"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache"
|
||||||
@ -36,7 +39,6 @@ import (
|
|||||||
tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification"
|
||||||
registry "github.com/OpenIMSDK/tools/discoveryregistry"
|
|
||||||
|
|
||||||
pbuser "github.com/OpenIMSDK/protocol/user"
|
pbuser "github.com/OpenIMSDK/protocol/user"
|
||||||
"github.com/OpenIMSDK/tools/utils"
|
"github.com/OpenIMSDK/tools/utils"
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
|
|
||||||
"github.com/OpenIMSDK/protocol/constant"
|
"github.com/OpenIMSDK/protocol/constant"
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
"github.com/OpenIMSDK/tools/mcontext"
|
"github.com/OpenIMSDK/tools/mcontext"
|
||||||
|
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *MsgTool) ConvertTools() {
|
func (c *MsgTool) ConvertTools() {
|
||||||
|
|||||||
@ -209,6 +209,7 @@ func (f *friendDatabase) RefuseFriendRequest(
|
|||||||
if fr.HandleResult != 0 {
|
if fr.HandleResult != 0 {
|
||||||
return errs.ErrArgs.Wrap("the friend request has been processed")
|
return errs.ErrArgs.Wrap("the friend request has been processed")
|
||||||
}
|
}
|
||||||
|
log.ZDebug(ctx, "refuse friend request", "friendRequest db", fr, "friendRequest arg", friendRequest)
|
||||||
friendRequest.HandleResult = constant.FriendResponseRefuse
|
friendRequest.HandleResult = constant.FriendResponseRefuse
|
||||||
friendRequest.HandleTime = time.Now()
|
friendRequest.HandleTime = time.Now()
|
||||||
err = f.friendRequest.Update(ctx, friendRequest)
|
err = f.friendRequest.Update(ctx, friendRequest)
|
||||||
|
|||||||
@ -71,10 +71,13 @@ func (f *FriendRequestGorm) UpdateByMap(
|
|||||||
|
|
||||||
// 更新记录 (非零值).
|
// 更新记录 (非零值).
|
||||||
func (f *FriendRequestGorm) Update(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) {
|
func (f *FriendRequestGorm) Update(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) {
|
||||||
|
fr2 := *friendRequest
|
||||||
|
fr2.FromUserID = ""
|
||||||
|
fr2.ToUserID = ""
|
||||||
return utils.Wrap(
|
return utils.Wrap(
|
||||||
f.db(ctx).
|
f.db(ctx).
|
||||||
Where("from_user_id = ? AND to_user_id =?", friendRequest.FromUserID, friendRequest.ToUserID).
|
Where("from_user_id = ? AND to_user_id =?", friendRequest.FromUserID, friendRequest.ToUserID).
|
||||||
Updates(friendRequest).
|
Updates(fr2).
|
||||||
Error,
|
Error,
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
|
|||||||
@ -33,5 +33,6 @@ func NewMetaDB(db *gorm.DB, table any) *MetaDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *MetaDB) db(ctx context.Context) *gorm.DB {
|
func (g *MetaDB) db(ctx context.Context) *gorm.DB {
|
||||||
return g.DB.WithContext(ctx).Model(g.table)
|
db := g.DB.WithContext(ctx).Model(g.table)
|
||||||
|
return db
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
|
||||||
|
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *MsgMongoDriver) ConvertMsgsDocLen(ctx context.Context, conversationIDs []string) {
|
func (m *MsgMongoDriver) ConvertMsgsDocLen(ctx context.Context, conversationIDs []string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user