|
|
|
// Copyright © 2023 OpenIM. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package relation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/openimsdk/protocol/msg"
|
|
|
|
"github.com/openimsdk/protocol/sdkws"
|
|
|
|
"github.com/openimsdk/tools/errs"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
singleGocMsgNum = 100
|
|
|
|
singleGocMsgNum5000 = 5000
|
|
|
|
Msg = "msg"
|
|
|
|
OldestList = 0
|
|
|
|
NewestList = -1
|
|
|
|
)
|
|
|
|
|
|
|
|
var ErrMsgListNotExist = errs.New("user not have msg in mongoDB")
|
|
|
|
|
|
|
|
type MsgDocModel struct {
|
|
|
|
DocID string `bson:"doc_id"`
|
|
|
|
Msg []*MsgInfoModel `bson:"msgs"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type RevokeModel struct {
|
|
|
|
Role int32 `bson:"role"`
|
|
|
|
UserID string `bson:"user_id"`
|
|
|
|
Nickname string `bson:"nickname"`
|
|
|
|
Time int64 `bson:"time"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type OfflinePushModel struct {
|
|
|
|
Title string `bson:"title"`
|
|
|
|
Desc string `bson:"desc"`
|
|
|
|
Ex string `bson:"ex"`
|
|
|
|
IOSPushSound string `bson:"ios_push_sound"`
|
|
|
|
IOSBadgeCount bool `bson:"ios_badge_count"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type MsgDataModel struct {
|
|
|
|
SendID string `bson:"send_id"`
|
|
|
|
RecvID string `bson:"recv_id"`
|
|
|
|
GroupID string `bson:"group_id"`
|
|
|
|
ClientMsgID string `bson:"client_msg_id"`
|
|
|
|
ServerMsgID string `bson:"server_msg_id"`
|
|
|
|
SenderPlatformID int32 `bson:"sender_platform_id"`
|
|
|
|
SenderNickname string `bson:"sender_nickname"`
|
|
|
|
SenderFaceURL string `bson:"sender_face_url"`
|
|
|
|
SessionType int32 `bson:"session_type"`
|
|
|
|
MsgFrom int32 `bson:"msg_from"`
|
|
|
|
ContentType int32 `bson:"content_type"`
|
|
|
|
Content string `bson:"content"`
|
|
|
|
Seq int64 `bson:"seq"`
|
|
|
|
SendTime int64 `bson:"send_time"`
|
|
|
|
CreateTime int64 `bson:"create_time"`
|
|
|
|
Status int32 `bson:"status"`
|
|
|
|
IsRead bool `bson:"is_read"`
|
|
|
|
Options map[string]bool `bson:"options"`
|
|
|
|
OfflinePush *OfflinePushModel `bson:"offline_push"`
|
|
|
|
AtUserIDList []string `bson:"at_user_id_list"`
|
|
|
|
AttachedInfo string `bson:"attached_info"`
|
|
|
|
Ex string `bson:"ex"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type MsgInfoModel struct {
|
|
|
|
Msg *MsgDataModel `bson:"msg"`
|
|
|
|
Revoke *RevokeModel `bson:"revoke"`
|
|
|
|
DelList []string `bson:"del_list"`
|
|
|
|
IsRead bool `bson:"is_read"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserCount struct {
|
|
|
|
UserID string `bson:"user_id"`
|
|
|
|
Count int64 `bson:"count"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GroupCount struct {
|
|
|
|
GroupID string `bson:"group_id"`
|
|
|
|
Count int64 `bson:"count"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type MsgDocModelInterface interface {
|
|
|
|
PushMsgsToDoc(ctx context.Context, docID string, msgsToMongo []MsgInfoModel) error
|
|
|
|
Create(ctx context.Context, model *MsgDocModel) error
|
|
|
|
UpdateMsg(ctx context.Context, docID string, index int64, key string, value any) (*mongo.UpdateResult, error)
|
|
|
|
PushUnique(ctx context.Context, docID string, index int64, key string, value any) (*mongo.UpdateResult, error)
|
|
|
|
UpdateMsgContent(ctx context.Context, docID string, index int64, msg []byte) error
|
|
|
|
IsExistDocID(ctx context.Context, docID string) (bool, error)
|
|
|
|
FindOneByDocID(ctx context.Context, docID string) (*MsgDocModel, error)
|
|
|
|
GetMsgBySeqIndexIn1Doc(ctx context.Context, userID, docID string, seqs []int64) ([]*MsgInfoModel, error)
|
|
|
|
GetNewestMsg(ctx context.Context, conversationID string) (*MsgInfoModel, error)
|
|
|
|
GetOldestMsg(ctx context.Context, conversationID string) (*MsgInfoModel, error)
|
|
|
|
DeleteDocs(ctx context.Context, docIDs []string) error
|
|
|
|
GetMsgDocModelByIndex(ctx context.Context, conversationID string, index, sort int64) (*MsgDocModel, error)
|
|
|
|
DeleteMsgsInOneDocByIndex(ctx context.Context, docID string, indexes []int) error
|
|
|
|
MarkSingleChatMsgsAsRead(ctx context.Context, userID string, docID string, indexes []int64) error
|
|
|
|
SearchMessage(ctx context.Context, req *msg.SearchMessageReq) (int32, []*MsgInfoModel, error)
|
|
|
|
RangeUserSendCount(ctx context.Context, start time.Time, end time.Time, group bool, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, users []*UserCount, dateCount map[string]int64, err error)
|
|
|
|
RangeGroupSendCount(ctx context.Context, start time.Time, end time.Time, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, groups []*GroupCount, dateCount map[string]int64, err error)
|
|
|
|
ConvertMsgsDocLen(ctx context.Context, conversationIDs []string)
|
feat: optimize corn tasks (#2238)
* fix: GroupApplicationAcceptedNotification
* fix: GroupApplicationAcceptedNotification
* fix: NotificationUserInfoUpdate
* cicd: robot automated Change
* fix: component
* fix: getConversationInfo
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* fix bug: get localIP
* update some ci file (#2200)
* Update openimci.yml
* Update golangci-lint.yml
* Update e2e-test.yml
* 3.6.1 code conventions (#2202)
* refactor: webhooks update.
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* feat: s3 api addr
* refactor: webhooks update.
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* refactor: webhooks update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* refactor: kafka update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Windows can compile and run.
* Windows can compile and run.
* refactor: kafka update.
* feat: msg cache split
* refactor: webhooks update
* refactor: webhooks update
* refactor: friends update
* refactor: group update
* refactor: third update
* refactor: api update
* refactor: crontab update
* refactor: msggateway update
* mage
* mage
* refactor: all module update.
* check
* refactor: all module update.
* load config
* load config
* load config
* load config
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update tools
* update tools
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update protocol
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: api remove token auth by redis directly.
* Code Refactoring
* refactor: websocket auth change to call rpc of auth.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: remove msggateway redis.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* fix: runtime: goroutine stack exceeds
* refactor: cmd update.
* refactor notification
* refactor notification
* refactor
* refactor: cmd update.
* refactor: cmd update.
* refactor
* refactor
* refactor
* protojson
* protojson
* protojson
* go mod
* wrapperspb
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: context update.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: api name change.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: update file
* refactor
* refactor
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: callback update.
* fix: callback update.
* refactor
* fix: update message.
* fix: msg cache timeout.
* refactor
* refactor
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* refactor
* refactor
* fix: push update.
* fix: websocket handle error remove when upgrade error.
* fix: priority url
* fix: minio config
* refactor: add zk logger.
* refactor
* fix: minio config
* refactor
* refactor
* refactor
* refactor
* refactor: remove zk logger.
* refactor: update tools version.
* refactor
* refactor: update server version to 3.7.0.
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor
* refactor
* refactor
* refactor: log level change.
* refactor: 3.7.0 code conventions.
---------
Co-authored-by: skiffer-git <44203734@qq.com>
Co-authored-by: withchao <993506633@qq.com>
* Update action (#2211)
* Rename golangci-lint.yml to golangci-lint.bak
* Update e2e-test.yml
* Update openimci.yml
* Update action (#2213)
* Rename golangci-lint.yml to golangci-lint.bak
* Update e2e-test.yml
* Update openimci.yml
* Rename docker-buildx.yml to docker-buildx.bak
* update go.mod go.sum (#2210)
* 3.6.1 code conventions (#2203)
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* refactor: webhooks update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* refactor: kafka update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Windows can compile and run.
* Windows can compile and run.
* refactor: kafka update.
* feat: msg cache split
* refactor: webhooks update
* refactor: webhooks update
* refactor: friends update
* refactor: group update
* refactor: third update
* refactor: api update
* refactor: crontab update
* refactor: msggateway update
* mage
* mage
* refactor: all module update.
* check
* refactor: all module update.
* load config
* load config
* load config
* load config
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update tools
* update tools
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update protocol
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: api remove token auth by redis directly.
* Code Refactoring
* refactor: websocket auth change to call rpc of auth.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: remove msggateway redis.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* fix: runtime: goroutine stack exceeds
* refactor: cmd update.
* refactor notification
* refactor notification
* refactor
* refactor: cmd update.
* refactor: cmd update.
* refactor
* refactor
* refactor
* protojson
* protojson
* protojson
* go mod
* wrapperspb
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: context update.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: api name change.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: update file
* refactor
* refactor
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: callback update.
* fix: callback update.
* refactor
* fix: update message.
* fix: msg cache timeout.
* refactor
* refactor
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* refactor
* refactor
* fix: push update.
* fix: websocket handle error remove when upgrade error.
* fix: priority url
* fix: minio config
* refactor: add zk logger.
* refactor
* fix: minio config
* refactor
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* fix bug: get localIP
* refactor
* refactor
* refactor
* refactor: remove zk logger.
* refactor: update tools version.
* refactor
* refactor: update server version to 3.7.0.
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor
* refactor
* refactor
* refactor: log level change.
* refactor: 3.7.0 code conventions.
---------
Co-authored-by: skiffer-git <44203734@qq.com>
Co-authored-by: withchao <993506633@qq.com>
Co-authored-by: root <root@localhost.localdomain>
* update go.mod go.sum
* Remove Chinese comments
* user localhost for minio
* user localhost for minio
* Remove Chinese comments
* Remove Chinese comments
* Remove Chinese comments
* Set up 4 instances of transfer
* Set up 4 instances of transfer
* Add comments to the configuration file
* Add comments to the configuration file
---------
Co-authored-by: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: withchao <993506633@qq.com>
Co-authored-by: root <root@localhost.localdomain>
* Update the document (#2219)
* 3.6.1 code conventions (#2203)
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* refactor: webhooks update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* refactor: kafka update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Windows can compile and run.
* Windows can compile and run.
* refactor: kafka update.
* feat: msg cache split
* refactor: webhooks update
* refactor: webhooks update
* refactor: friends update
* refactor: group update
* refactor: third update
* refactor: api update
* refactor: crontab update
* refactor: msggateway update
* mage
* mage
* refactor: all module update.
* check
* refactor: all module update.
* load config
* load config
* load config
* load config
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update tools
* update tools
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update protocol
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: api remove token auth by redis directly.
* Code Refactoring
* refactor: websocket auth change to call rpc of auth.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: remove msggateway redis.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* fix: runtime: goroutine stack exceeds
* refactor: cmd update.
* refactor notification
* refactor notification
* refactor
* refactor: cmd update.
* refactor: cmd update.
* refactor
* refactor
* refactor
* protojson
* protojson
* protojson
* go mod
* wrapperspb
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: context update.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: api name change.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: update file
* refactor
* refactor
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: callback update.
* fix: callback update.
* refactor
* fix: update message.
* fix: msg cache timeout.
* refactor
* refactor
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* refactor
* refactor
* fix: push update.
* fix: websocket handle error remove when upgrade error.
* fix: priority url
* fix: minio config
* refactor: add zk logger.
* refactor
* fix: minio config
* refactor
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* fix bug: get localIP
* refactor
* refactor
* refactor
* refactor: remove zk logger.
* refactor: update tools version.
* refactor
* refactor: update server version to 3.7.0.
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor
* refactor
* refactor
* refactor: log level change.
* refactor: 3.7.0 code conventions.
---------
Co-authored-by: skiffer-git <44203734@qq.com>
Co-authored-by: withchao <993506633@qq.com>
Co-authored-by: root <root@localhost.localdomain>
* update go.mod go.sum (#2209)
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* remove \r
* fix bug: get localIP
* update some ci file (#2200)
* Update openimci.yml
* Update golangci-lint.yml
* Update e2e-test.yml
* 3.6.1 code conventions (#2202)
* refactor: webhooks update.
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* feat: s3 api addr
* refactor: webhooks update.
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* Adjust configuration settings
* refactor: webhooks update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* refactor: kafka update.
* refactor: kafka update.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Simplify the Docker Compose configuration, remove unnecessary environment variables, and eliminate the gateway service.
* Windows can compile and run.
* Windows can compile and run.
* refactor: kafka update.
* feat: msg cache split
* refactor: webhooks update
* refactor: webhooks update
* refactor: friends update
* refactor: group update
* refactor: third update
* refactor: api update
* refactor: crontab update
* refactor: msggateway update
* mage
* mage
* refactor: all module update.
* check
* refactor: all module update.
* load config
* load config
* load config
* load config
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* refactor: all module update.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update tools
* update tools
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* update protocol
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: all module update.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* Optimize Docker configuration and script.
* refactor: api remove token auth by redis directly.
* Code Refactoring
* refactor: websocket auth change to call rpc of auth.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: kick online user and remove token change to call auth rpc.
* refactor: remove msggateway redis.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor webhook
* refactor: cmd update.
* refactor: cmd update.
* fix: runtime: goroutine stack exceeds
* refactor: cmd update.
* refactor notification
* refactor notification
* refactor
* refactor: cmd update.
* refactor: cmd update.
* refactor
* refactor
* refactor
* protojson
* protojson
* protojson
* go mod
* wrapperspb
* refactor: cmd update.
* refactor: cmd update.
* refactor: cmd update.
* refactor: context update.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: websocket update info.
* refactor: api name change.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: update file
* refactor
* refactor
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* refactor: debug info.
* fix: callback update.
* fix: callback update.
* refactor
* fix: update message.
* fix: msg cache timeout.
* refactor
* refactor
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* fix: push update.
* refactor
* refactor
* fix: push update.
* fix: websocket handle error remove when upgrade error.
* fix: priority url
* fix: minio config
* refactor: add zk logger.
* refactor
* fix: minio config
* refactor
* refactor
* refactor
* refactor
* refactor: remove zk logger.
* refactor: update tools version.
* refactor
* refactor: update server version to 3.7.0.
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor: zk log debug.
* refactor
* refactor
* refactor
* refactor: log level change.
* refactor: 3.7.0 code conventions.
---------
Co-authored-by: skiffer-git <44203734@qq.com>
Co-authored-by: withchao <993506633@qq.com>
* update go.mod go.sum
* Remove Chinese comments
* user localhost for minio
* user localhost for minio
* Remove Chinese comments
* Remove Chinese comments
* Remove Chinese comments
* Set up 4 instances of transfer
* Set up 4 instances of transfer
* Add comments to the configuration file
* Add comments to the configuration file
---------
Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: xuan <146319162+wxuanF@users.noreply.github.com>
Co-authored-by: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: withchao <993506633@qq.com>
* Update the document
* Update the document
---------
Co-authored-by: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: withchao <993506633@qq.com>
Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: xuan <146319162+wxuanF@users.noreply.github.com>
* feat: cron task
* feat: cron task
* feat: cron task
* update action (#2225)
* Rename e2e-test.yml to e2e-test.bak
* Rename create-branch-on-tag.yml to create-branch-on-tag.bak
* Rename pull-request.yml to pull-request.bak
* Update slack invite link
* Update slack invite link
* feat: cron task
* feat: cron task
* go.mod
* fix: go.mod
---------
Co-authored-by: withchao <withchao@users.noreply.github.com>
Co-authored-by: skiffer-git <44203734@qq.com>
Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: xuan <146319162+wxuanF@users.noreply.github.com>
Co-authored-by: OpenIM-Gordon <46924906+FGadvancer@users.noreply.github.com>
Co-authored-by: skiffer-git <72860476+skiffer-git@users.noreply.github.com>
5 months ago
|
|
|
|
|
|
|
DeleteDoc(ctx context.Context, docID string) error
|
|
|
|
DeleteMsgByIndex(ctx context.Context, docID string, index []int) error
|
|
|
|
GetBeforeMsg(ctx context.Context, ts int64, limit int) ([]*MsgDocModel, error)
|
|
|
|
|
|
|
|
//ClearMsg(ctx context.Context, t time.Time) (int64, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) TableName() string {
|
|
|
|
return Msg
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) GetSingleGocMsgNum() int64 {
|
|
|
|
return singleGocMsgNum
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) GetSingleGocMsgNum5000() int64 {
|
|
|
|
return singleGocMsgNum5000
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MsgDocModel) IsFull() bool {
|
|
|
|
return m.Msg[len(m.Msg)-1].Msg != nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m MsgDocModel) GetDocID(conversationID string, seq int64) string {
|
|
|
|
seqSuffix := (seq - 1) / singleGocMsgNum
|
|
|
|
return m.indexGen(conversationID, seqSuffix)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m MsgDocModel) GetDocIDSeqsMap(conversationID string, seqs []int64) map[string][]int64 {
|
|
|
|
t := make(map[string][]int64)
|
|
|
|
for i := 0; i < len(seqs); i++ {
|
|
|
|
docID := m.GetDocID(conversationID, seqs[i])
|
|
|
|
if value, ok := t[docID]; !ok {
|
|
|
|
var temp []int64
|
|
|
|
t[docID] = append(temp, seqs[i])
|
|
|
|
} else {
|
|
|
|
t[docID] = append(value, seqs[i])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return t
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) GetMsgIndex(seq int64) int64 {
|
|
|
|
return (seq - 1) % singleGocMsgNum
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) indexGen(conversationID string, seqSuffix int64) string {
|
|
|
|
return conversationID + ":" + strconv.FormatInt(seqSuffix, 10)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (MsgDocModel) GenExceptionMessageBySeqs(seqs []int64) (exceptionMsg []*sdkws.MsgData) {
|
|
|
|
for _, v := range seqs {
|
|
|
|
msgModel := new(sdkws.MsgData)
|
|
|
|
msgModel.Seq = v
|
|
|
|
exceptionMsg = append(exceptionMsg, msgModel)
|
|
|
|
}
|
|
|
|
return exceptionMsg
|
|
|
|
}
|