diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 0fea4b0f8..033688f7e 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -85,7 +85,6 @@ func main() { chatGroup.POST("/newest_seq", apiChat.GetSeq) chatGroup.POST("/send_msg", apiChat.SendMsg) chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList) - //chatGroup.POST("/del_msg", apiChat) } //Manager managementGroup := r.Group("/manager") diff --git a/config/config.yaml b/config/config.yaml index 0b86cdbbd..21ded2735 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -8,7 +8,7 @@ etcd: etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可 mysql: - dbMysqlAddress: [ 43.128.5.63:13306 ] #mysql地址 目前仅支持单机,默认即可 + dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可 dbMysqlUserName: root #mysql用户名,建议修改 dbMysqlPassword: openIM # mysql密码,建议修改 dbMysqlDatabaseName: openIM_v2 #默认即可 @@ -19,7 +19,7 @@ mysql: dbMaxLifeTime: 120 mongo: - dbAddress: [ 43.128.5.63:37017 ] #redis地址 目前仅支持单机,默认即可 + dbAddress: [ 127.0.0.1:37017 ] #redis地址 目前仅支持单机,默认即可 dbDirect: false dbTimeout: 10 dbDatabase: openIM #mongo db 默认即可 @@ -30,7 +30,7 @@ mongo: dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改 redis: - dbAddress: 43.128.5.63:16379 #redis地址 目前仅支持单机,默认即可 + dbAddress: 127.0.0.1:16379 #redis地址 目前仅支持单机,默认即可 dbMaxIdle: 128 dbMaxActive: 0 dbIdleTimeout: 120 diff --git a/internal/api/chat/del_msg.go b/internal/api/chat/del_msg.go deleted file mode 100644 index 6cdda51ed..000000000 --- a/internal/api/chat/del_msg.go +++ /dev/null @@ -1,32 +0,0 @@ -package apiChat - -// -//import ( -// apiStruct "Open_IM/pkg/base_info" -// "Open_IM/pkg/common/config" -// "Open_IM/pkg/common/log" -// "Open_IM/pkg/common/token_verify" -// "Open_IM/pkg/grpc-etcdv3/getcdv3" -// pbChat "Open_IM/pkg/proto/chat" -// "Open_IM/pkg/utils" -// "github.com/gin-gonic/gin" -// "net/http" -// "strings" -//) -// -//func DelMsg(c *gin.Context) { -// var ( -// req apiStruct.DelMsgReq -// resp apiStruct.DelMsgResp -// reqPb pbChat. -// ) -// ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token")) -// if !ok { -// log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token")) -// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"}) -// return -// } -// grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) -// msgClient := pbChat.NewChatClient(grpcConn) -// //respPb, err := msgClient.DelMsgList() -//} diff --git a/internal/rpc/msg/del_msg.go b/internal/rpc/msg/del_msg.go index 1e76409f8..b2252730d 100644 --- a/internal/rpc/msg/del_msg.go +++ b/internal/rpc/msg/del_msg.go @@ -1,6 +1,7 @@ package msg import ( + "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" commonPb "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" @@ -9,7 +10,10 @@ import ( func (rpc *rpcChat) DelMsgList(_ context.Context, req *commonPb.DelMsgListReq) (*commonPb.DelMsgListResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) + //if err := db.DelMsg(req.UserID, req.SeqList); err != nil { + // log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsg failed", err.Error()) + //} resp := &commonPb.DelMsgListResp{} - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp) + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } diff --git a/pkg/common/db/model.go b/pkg/common/db/model.go index b45dcde79..6e3048db9 100644 --- a/pkg/common/db/model.go +++ b/pkg/common/db/model.go @@ -41,7 +41,7 @@ func init() { // mongo init // "mongodb://sysop:moon@localhost/records" uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" - uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&connect=direct", + uri = fmt.Sprintf("mongodb://%s/%s/?connect=direct&maxPoolSize=%d", config.Config.Mongo.DBAddress[0], config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) diff --git a/pkg/proto/chat/chat.pb.go b/pkg/proto/chat/chat.pb.go index eb385ede8..cf1c6ba50 100644 --- a/pkg/proto/chat/chat.pb.go +++ b/pkg/proto/chat/chat.pb.go @@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} } func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) } func (*MsgDataToMQ) ProtoMessage() {} func (*MsgDataToMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{0} + return fileDescriptor_chat_83f286704599d5b1, []int{0} } func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b) @@ -90,7 +90,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} } func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) } func (*MsgDataToDB) ProtoMessage() {} func (*MsgDataToDB) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{1} + return fileDescriptor_chat_83f286704599d5b1, []int{1} } func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b) @@ -137,7 +137,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} } func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) } func (*PushMsgDataToMQ) ProtoMessage() {} func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{2} + return fileDescriptor_chat_83f286704599d5b1, []int{2} } func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b) @@ -210,7 +210,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{3} + return fileDescriptor_chat_83f286704599d5b1, []int{3} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -258,7 +258,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{4} + return fileDescriptor_chat_83f286704599d5b1, []int{4} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -319,7 +319,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} } func (m *SendMsgReq) String() string { return proto.CompactTextString(m) } func (*SendMsgReq) ProtoMessage() {} func (*SendMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{5} + return fileDescriptor_chat_83f286704599d5b1, []int{5} } func (m *SendMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgReq.Unmarshal(m, b) @@ -375,7 +375,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} } func (m *SendMsgResp) String() string { return proto.CompactTextString(m) } func (*SendMsgResp) ProtoMessage() {} func (*SendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_89690664d189a305, []int{6} + return fileDescriptor_chat_83f286704599d5b1, []int{6} } func (m *SendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsgResp.Unmarshal(m, b) @@ -611,9 +611,9 @@ var _Chat_serviceDesc = grpc.ServiceDesc{ Metadata: "chat/chat.proto", } -func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_89690664d189a305) } +func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_83f286704599d5b1) } -var fileDescriptor_chat_89690664d189a305 = []byte{ +var fileDescriptor_chat_83f286704599d5b1 = []byte{ // 507 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xcd, 0x6e, 0xda, 0x40, 0x10, 0x96, 0x49, 0x80, 0x32, 0x34, 0x42, 0xda, 0x44, 0x95, 0xe5, 0x5e, 0x1c, 0x9f, 0x50, 0x2b, diff --git a/pkg/proto/chat/chat.proto b/pkg/proto/chat/chat.proto index 21ba8c4aa..146994f01 100644 --- a/pkg/proto/chat/chat.proto +++ b/pkg/proto/chat/chat.proto @@ -78,5 +78,5 @@ service Chat { rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp); rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp); rpc SendMsg(SendMsgReq) returns(SendMsgResp); - // rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp); + rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp); }