diff --git a/cmd/cmdutils/Makefile b/cmd/cmdutils/Makefile new file mode 100644 index 000000000..7f0bcbbe5 --- /dev/null +++ b/cmd/cmdutils/Makefile @@ -0,0 +1,25 @@ +.PHONY: all build run gotool install clean help + +BINARY_NAME=open_im_cmd_utils +BIN_DIR=../../bin/ + + +all: gotool build + +build: + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" + +run: + @go run ./ + +gotool: + go fmt ./ + go vet ./ + +install: + make build + mv ${BINARY_NAME} ${BIN_DIR} + +clean: + @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + diff --git a/pkg/common/db/cache/msg.go b/pkg/common/db/cache/msg.go index 0f7320c26..6e409f868 100644 --- a/pkg/common/db/cache/msg.go +++ b/pkg/common/db/cache/msg.go @@ -1,13 +1,13 @@ package cache import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/tracelog" - pbChat "Open_IM/pkg/proto/msg" - pbRtc "Open_IM/pkg/proto/rtc" - "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" + "OpenIM/pkg/common/config" + "OpenIM/pkg/common/constant" + "OpenIM/pkg/common/tracelog" + pbChat "OpenIM/pkg/proto/msg" + pbRtc "OpenIM/pkg/proto/rtc" + "OpenIM/pkg/proto/sdkws" + "OpenIM/pkg/utils" "context" "errors" "fmt" diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index d9d39f283..8e5213c67 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -1,21 +1,21 @@ package controller import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db/cache" - unRelationTb "Open_IM/pkg/common/db/table/unrelation" - "Open_IM/pkg/common/db/unrelation" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/prome" - "Open_IM/pkg/common/tracelog" + "OpenIM/pkg/common/constant" + "OpenIM/pkg/common/db/cache" + unRelationTb "OpenIM/pkg/common/db/table/unrelation" + "OpenIM/pkg/common/db/unrelation" + "OpenIM/pkg/common/log" + "OpenIM/pkg/common/prome" + "OpenIM/pkg/common/tracelog" "fmt" "github.com/gogo/protobuf/sortkeys" "sync" "time" - pbMsg "Open_IM/pkg/proto/msg" - "Open_IM/pkg/proto/sdkws" - "Open_IM/pkg/utils" + pbMsg "OpenIM/pkg/proto/msg" + "OpenIM/pkg/proto/sdkws" + "OpenIM/pkg/utils" "context" "errors" "github.com/go-redis/redis/v8" @@ -71,7 +71,6 @@ type MsgDatabaseInterface interface { GetUserMinSeq(ctx context.Context, userID string) (int64, error) GetGroupMaxSeq(ctx context.Context, groupID string) (int64, error) GetGroupMinSeq(ctx context.Context, groupID string) (int64, error) - GetMessageListBySeq(ctx context.Context, userID string, seqs []int64) ([]*sdkws.MsgData, error) } func NewMsgDatabase(mgo *mongo.Client, rdb redis.UniversalClient) MsgDatabaseInterface { @@ -187,11 +186,6 @@ func (db *MsgDatabase) GetGroupMinSeq(ctx context.Context, groupID string) (int6 return db.cache.GetGroupMinSeq(ctx, groupID) } -func (db *MsgDatabase) GetMessageListBySeq(ctx context.Context, userID string, seqs []int64) ([]*sdkws.MsgData, error) { - seqMsg, _, err := db.cache.GetMessageListBySeq(ctx, userID, seqs) - return seqMsg, err -} - func (db *MsgDatabase) BatchInsertChat2DB(ctx context.Context, sourceID string, msgList []*pbMsg.MsgDataToMQ, currentMaxSeq int64) error { //newTime := utils.GetCurrentTimestampByMill() if int64(len(msgList)) > db.msg.GetSingleGocMsgNum() {