From 1d4b5960d2608e612255d2cf3582d00d22ed295a Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Wed, 31 May 2023 17:54:05 +0800 Subject: [PATCH] remove office --- cmd/rpc/office/Makefile | 39 -------- cmd/rpc/office/main.go | 19 ---- config/config.yaml | 2 - internal/api/office.go | 25 ----- internal/api/route.go | 6 -- internal/rpc/office/office.go | 119 ----------------------- pkg/common/config/config.go | 2 - pkg/common/db/controller/office.go | 18 ---- pkg/common/db/table/unrelation/office.go | 1 - pkg/common/db/unrelation/office.go | 1 - pkg/proto/proto_dir.cfg | 15 --- 11 files changed, 247 deletions(-) delete mode 100644 cmd/rpc/office/Makefile delete mode 100644 cmd/rpc/office/main.go delete mode 100644 internal/api/office.go delete mode 100644 internal/rpc/office/office.go delete mode 100644 pkg/common/db/controller/office.go delete mode 100644 pkg/common/db/table/unrelation/office.go delete mode 100644 pkg/common/db/unrelation/office.go delete mode 100644 pkg/proto/proto_dir.cfg diff --git a/cmd/rpc/office/Makefile b/cmd/rpc/office/Makefile deleted file mode 100644 index 5f4508094..000000000 --- a/cmd/rpc/office/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -.PHONY: all build run gotool install clean help - -NAME=open_im_office -BIN_DIR=../../../bin/ - -OS:= $(or $(os),linux) -ARCH:=$(or $(arch),amd64) -all: gotool build - -ifeq ($(OS),windows) - -BINARY_NAME=${NAME}.exe - -else - -BINARY_NAME=${NAME} - -endif - -build: - CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} - -run: - @go run ./ - -gotool: - go fmt ./ - go vet ./ - -install:build - mv ${BINARY_NAME} ${BIN_DIR} - -clean: - @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - - - - - diff --git a/cmd/rpc/office/main.go b/cmd/rpc/office/main.go deleted file mode 100644 index 6bd317960..000000000 --- a/cmd/rpc/office/main.go +++ /dev/null @@ -1,19 +0,0 @@ -package office - -import ( - "github.com/OpenIMSDK/Open-IM-Server/internal/rpc/office" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/cmd" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" -) - -func main() { - rpcCmd := cmd.NewRpcCmd("office") - rpcCmd.AddPortFlag() - rpcCmd.AddPrometheusPortFlag() - if err := rpcCmd.Exec(); err != nil { - panic(err.Error()) - } - if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImOfficeName, office.Start); err != nil { - panic(err.Error()) - } -} diff --git a/config/config.yaml b/config/config.yaml index 6a9faccbb..573c3bfeb 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -142,7 +142,6 @@ rpcport: #rpc服务端口 默认即可 openImConversationPort: [ 10180 ] openImRtcPort: [ 10190 ] openImThirdPort: [ 10200 ] - openImOfficePort: [ 10210 ] rpcregistername: #rpc注册服务名,默认即可 openImUserName: User @@ -155,7 +154,6 @@ rpcregistername: #rpc注册服务名,默认即可 openImConversationName: Conversation openImRtcName: Rtc openImThirdName: Third - openImOfficeName: Office log: storageLocation: ../logs/ diff --git a/internal/api/office.go b/internal/api/office.go deleted file mode 100644 index a03333906..000000000 --- a/internal/api/office.go +++ /dev/null @@ -1,25 +0,0 @@ -package api - -import ( - "context" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" - "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" - "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office" - "google.golang.org/grpc" -) - -func NewOffice(c discoveryregistry.SvcDiscoveryRegistry) *Office { - conn, err := c.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImOfficeName) - if err != nil { - panic(err) - } - return &Office{conn: conn} -} - -type Office struct { - conn *grpc.ClientConn -} - -func (o *Office) client(ctx context.Context) (office.OfficeClient, error) { - return office.NewOfficeClient(o.conn), nil -} diff --git a/internal/api/route.go b/internal/api/route.go index 164ca4b6f..70483e510 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -170,11 +170,5 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive conversationGroup.POST("/get_conversations_has_read_and_max_seq", c.GetConversationsHasReadAndMaxSeq) conversationGroup.POST("/set_conversations", c.SetConversations) } - - office := r.Group("/office") - { - o := NewOffice(discov) - _, _ = office, o - } return r } diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go deleted file mode 100644 index b183c5701..000000000 --- a/internal/rpc/office/office.go +++ /dev/null @@ -1,119 +0,0 @@ -package office - -import ( - "context" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" - "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" - "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office" - "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" - "google.golang.org/grpc" -) - -func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error { - mongo, err := unrelation.NewMongo() - if err != nil { - return err - } - //rdb, err := cache.NewRedis() - //if err != nil { - // return err - //} - office.RegisterOfficeServer(server, &officeServer{ - officeDatabase: controller.NewOfficeDatabase(mongo), - msgRpcClient: rpcclient.NewMsgClient(client), - user: rpcclient.NewUserClient(client), - }) - return nil -} - -type officeServer struct { - officeDatabase controller.OfficeDatabase - user *rpcclient.UserClient - msgRpcClient *rpcclient.MsgClient -} - -func (o *officeServer) GetUserTags(ctx context.Context, req *office.GetUserTagsReq) (*office.GetUserTagsResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) CreateTag(ctx context.Context, req *office.CreateTagReq) (*office.CreateTagResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) DeleteTag(ctx context.Context, req *office.DeleteTagReq) (*office.DeleteTagResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) SetTag(ctx context.Context, req *office.SetTagReq) (*office.SetTagResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) SendMsg2Tag(ctx context.Context, req *office.SendMsg2TagReq) (*office.SendMsg2TagResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) GetTagSendLogs(ctx context.Context, req *office.GetTagSendLogsReq) (*office.GetTagSendLogsResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) GetUserTagByID(ctx context.Context, req *office.GetUserTagByIDReq) (*office.GetUserTagByIDResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) CreateOneWorkMoment(ctx context.Context, req *office.CreateOneWorkMomentReq) (*office.CreateOneWorkMomentResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) DeleteOneWorkMoment(ctx context.Context, req *office.DeleteOneWorkMomentReq) (*office.DeleteOneWorkMomentResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) LikeOneWorkMoment(ctx context.Context, req *office.LikeOneWorkMomentReq) (*office.LikeOneWorkMomentResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) CommentOneWorkMoment(ctx context.Context, req *office.CommentOneWorkMomentReq) (*office.CommentOneWorkMomentResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) DeleteComment(ctx context.Context, req *office.DeleteCommentReq) (*office.DeleteCommentResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) GetWorkMomentByID(ctx context.Context, req *office.GetWorkMomentByIDReq) (*office.GetWorkMomentByIDResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) ChangeWorkMomentPermission(ctx context.Context, req *office.ChangeWorkMomentPermissionReq) (*office.ChangeWorkMomentPermissionResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) GetUserWorkMoments(ctx context.Context, req *office.GetUserWorkMomentsReq) (*office.GetUserWorkMomentsResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) GetUserFriendWorkMoments(ctx context.Context, req *office.GetUserFriendWorkMomentsReq) (*office.GetUserFriendWorkMomentsResp, error) { - //TODO implement me - panic("implement me") -} - -func (o *officeServer) SetUserWorkMomentsLevel(ctx context.Context, req *office.SetUserWorkMomentsLevelReq) (*office.SetUserWorkMomentsLevelResp, error) { - //TODO implement me - panic("implement me") -} diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 8a1192216..c6b565024 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -161,7 +161,6 @@ type config struct { OpenImCachePort []int `yaml:"openImCachePort"` OpenImRtcPort []int `yaml:"openImRtcPort"` OpenImThirdPort []int `yaml:"openImThirdPort"` - OpenImOfficePort []int `yaml:"openImOfficePort"` } RpcRegisterName struct { OpenImUserName string `yaml:"openImUserName"` @@ -174,7 +173,6 @@ type config struct { OpenImConversationName string `yaml:"openImConversationName"` OpenImRtcName string `yaml:"openImRtcName"` OpenImThirdName string `yaml:"openImThirdName"` - OpenImOfficeName string `yaml:"openImOfficeName"` } Zookeeper struct { Schema string `yaml:"schema"` diff --git a/pkg/common/db/controller/office.go b/pkg/common/db/controller/office.go deleted file mode 100644 index 36d17f2ab..000000000 --- a/pkg/common/db/controller/office.go +++ /dev/null @@ -1,18 +0,0 @@ -package controller - -import ( - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" -) - -func NewOfficeDatabase(mgo *unrelation.Mongo) OfficeDatabase { - return &officeDatabase{mgo: mgo} -} - -type OfficeDatabase interface { - // table.unrelation.office.go - // unrelation.office.go -} - -type officeDatabase struct { - mgo *unrelation.Mongo -} diff --git a/pkg/common/db/table/unrelation/office.go b/pkg/common/db/table/unrelation/office.go deleted file mode 100644 index 5cad2078d..000000000 --- a/pkg/common/db/table/unrelation/office.go +++ /dev/null @@ -1 +0,0 @@ -package unrelation diff --git a/pkg/common/db/unrelation/office.go b/pkg/common/db/unrelation/office.go deleted file mode 100644 index 5cad2078d..000000000 --- a/pkg/common/db/unrelation/office.go +++ /dev/null @@ -1 +0,0 @@ -package unrelation diff --git a/pkg/proto/proto_dir.cfg b/pkg/proto/proto_dir.cfg deleted file mode 100644 index 5d16b0067..000000000 --- a/pkg/proto/proto_dir.cfg +++ /dev/null @@ -1,15 +0,0 @@ - -all_proto=( - wrapperspb/wrapperspb.proto - auth/auth.proto - friend/friend.proto - group/group.proto - user/user.proto - rtc/rtc.proto - msg/msg.proto - push/push.proto - msggateway/msg_gateway.proto - sdkws/ws.proto - conversation/conversation.proto - third/third.proto -)