mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 14:02:15 +08:00
Merge branch 'openimsdk:main' into main
This commit is contained in:
commit
62f58de42f
3
.github/workflows/go-build-test.yml
vendored
3
.github/workflows/go-build-test.yml
vendored
@ -7,6 +7,9 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
@ -77,7 +77,7 @@ git push origin fix-bug-123
|
||||
### 9. 签署 CLA
|
||||
如果这是你第一次提交 PR,你需要在 PR 的评论中回复:
|
||||
```
|
||||
I have read the CLA Document and I hereby sign the CLA
|
||||
The signature to be committed in order to sign the CLA
|
||||
```
|
||||
|
||||
### 编程规范
|
||||
|
||||
@ -75,7 +75,7 @@ Go to your fork on GitHub and click the "Pull Request" button. Ensure the PR des
|
||||
### 9. Sign the CLA
|
||||
If this is your first time submitting a PR, you will need to reply in the comments of the PR:
|
||||
```
|
||||
I have read the CLA Document and I hereby sign the CLA
|
||||
The signature to be committed in order to sign the CLA
|
||||
```
|
||||
|
||||
### Programming Standards
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
enable: "etcd"
|
||||
enable: etcd
|
||||
etcd:
|
||||
rootDirectory: openim
|
||||
address: [ localhost:12379 ]
|
||||
|
||||
@ -3,17 +3,17 @@ username: ''
|
||||
# Password for authentication
|
||||
password: ''
|
||||
# Producer acknowledgment settings
|
||||
producerAck: ""
|
||||
producerAck:
|
||||
# Compression type to use (e.g., none, gzip, snappy)
|
||||
compressType: "none"
|
||||
compressType: none
|
||||
# List of Kafka broker addresses
|
||||
address: [ localhost:19094 ]
|
||||
# Kafka topic for Redis integration
|
||||
toRedisTopic: "toRedis"
|
||||
toRedisTopic: toRedis
|
||||
# Kafka topic for MongoDB integration
|
||||
toMongoTopic: "toMongo"
|
||||
toMongoTopic: toMongo
|
||||
# Kafka topic for push notifications
|
||||
toPushTopic: "toPush"
|
||||
toPushTopic: toPush
|
||||
# Consumer group ID for Redis topic
|
||||
toRedisGroupID: redis
|
||||
# Consumer group ID for MongoDB topic
|
||||
@ -25,12 +25,12 @@ tls:
|
||||
# Enable or disable TLS
|
||||
enableTLS: false
|
||||
# CA certificate file path
|
||||
caCrt: ""
|
||||
caCrt:
|
||||
# Client certificate file path
|
||||
clientCrt: ""
|
||||
clientCrt:
|
||||
# Client key file path
|
||||
clientKey: ""
|
||||
clientKey:
|
||||
# Client key password
|
||||
clientKeyPwd: ""
|
||||
clientKeyPwd:
|
||||
# Whether to skip TLS verification (not recommended for production)
|
||||
insecureSkipVerify: false
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
# Name of the bucket in MinIO
|
||||
bucket: "openim"
|
||||
bucket: openim
|
||||
# Access key ID for MinIO authentication
|
||||
accessKeyID: "root"
|
||||
accessKeyID: root
|
||||
# Secret access key for MinIO authentication
|
||||
secretAccessKey: "openIM123"
|
||||
secretAccessKey: openIM123
|
||||
# Session token for MinIO authentication (optional)
|
||||
sessionToken: ''
|
||||
sessionToken:
|
||||
# Internal address of the MinIO server
|
||||
internalAddress: "localhost:10005"
|
||||
internalAddress: localhost:10005
|
||||
# External address of the MinIO server, accessible from outside. Supports both HTTP and HTTPS using a domain name
|
||||
externalAddress: "http://external_ip:10005"
|
||||
externalAddress: http://external_ip:10005
|
||||
# Flag to enable or disable public read access to the bucket
|
||||
publicRead: false
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# URI for database connection, leave empty if using address and credential settings directly
|
||||
uri: ''
|
||||
uri:
|
||||
# List of MongoDB server addresses
|
||||
address: [ localhost:37017 ]
|
||||
# Name of the database
|
||||
|
||||
@ -28,11 +28,11 @@ groupCreated:
|
||||
# Enables or disables offline push notifications.
|
||||
enable: false
|
||||
# Title for the notification when a group is created.
|
||||
title: "create group title"
|
||||
title: create group title
|
||||
# Description for the notification.
|
||||
desc: "create group desc"
|
||||
desc: create group desc
|
||||
# Additional information for the notification.
|
||||
ext: "create group ext"
|
||||
ext: create group ext
|
||||
|
||||
groupInfoSet:
|
||||
isSendMsg: false
|
||||
@ -40,9 +40,9 @@ groupInfoSet:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupInfoSet title"
|
||||
desc: "groupInfoSet desc"
|
||||
ext: "groupInfoSet ext"
|
||||
title: groupInfoSet title
|
||||
desc: groupInfoSet desc
|
||||
ext: groupInfoSet ext
|
||||
|
||||
|
||||
joinGroupApplication:
|
||||
@ -51,9 +51,9 @@ joinGroupApplication:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "joinGroupApplication title"
|
||||
desc: "joinGroupApplication desc"
|
||||
ext: "joinGroupApplication ext"
|
||||
title: joinGroupApplication title
|
||||
desc: joinGroupApplication desc
|
||||
ext: joinGroupApplication ext
|
||||
|
||||
memberQuit:
|
||||
isSendMsg: true
|
||||
@ -61,9 +61,9 @@ memberQuit:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "memberQuit title"
|
||||
desc: "memberQuit desc"
|
||||
ext: "memberQuit ext"
|
||||
title: memberQuit title
|
||||
desc: memberQuit desc
|
||||
ext: memberQuit ext
|
||||
|
||||
groupApplicationAccepted:
|
||||
isSendMsg: false
|
||||
@ -71,9 +71,9 @@ groupApplicationAccepted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupApplicationAccepted title"
|
||||
desc: "groupApplicationAccepted desc"
|
||||
ext: "groupApplicationAccepted ext"
|
||||
title: groupApplicationAccepted title
|
||||
desc: groupApplicationAccepted desc
|
||||
ext: groupApplicationAccepted ext
|
||||
|
||||
groupApplicationRejected:
|
||||
isSendMsg: false
|
||||
@ -81,9 +81,9 @@ groupApplicationRejected:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupApplicationRejected title"
|
||||
desc: "groupApplicationRejected desc"
|
||||
ext: "groupApplicationRejected ext"
|
||||
title: groupApplicationRejected title
|
||||
desc: groupApplicationRejected desc
|
||||
ext: groupApplicationRejected ext
|
||||
|
||||
|
||||
groupOwnerTransferred:
|
||||
@ -92,9 +92,9 @@ groupOwnerTransferred:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupOwnerTransferred title"
|
||||
desc: "groupOwnerTransferred desc"
|
||||
ext: "groupOwnerTransferred ext"
|
||||
title: groupOwnerTransferred title
|
||||
desc: groupOwnerTransferred desc
|
||||
ext: groupOwnerTransferred ext
|
||||
|
||||
memberKicked:
|
||||
isSendMsg: true
|
||||
@ -102,9 +102,9 @@ memberKicked:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "memberKicked title"
|
||||
desc: "memberKicked desc"
|
||||
ext: "memberKicked ext"
|
||||
title: memberKicked title
|
||||
desc: memberKicked desc
|
||||
ext: memberKicked ext
|
||||
|
||||
memberInvited:
|
||||
isSendMsg: true
|
||||
@ -112,9 +112,9 @@ memberInvited:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "memberInvited title"
|
||||
desc: "memberInvited desc"
|
||||
ext: "memberInvited ext"
|
||||
title: memberInvited title
|
||||
desc: memberInvited desc
|
||||
ext: memberInvited ext
|
||||
|
||||
memberEnter:
|
||||
isSendMsg: true
|
||||
@ -122,9 +122,9 @@ memberEnter:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "memberEnter title"
|
||||
desc: "memberEnter desc"
|
||||
ext: "memberEnter ext"
|
||||
title: memberEnter title
|
||||
desc: memberEnter desc
|
||||
ext: memberEnter ext
|
||||
|
||||
groupDismissed:
|
||||
isSendMsg: true
|
||||
@ -132,9 +132,9 @@ groupDismissed:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupDismissed title"
|
||||
desc: "groupDismissed desc"
|
||||
ext: "groupDismissed ext"
|
||||
title: groupDismissed title
|
||||
desc: groupDismissed desc
|
||||
ext: groupDismissed ext
|
||||
|
||||
groupMuted:
|
||||
isSendMsg: true
|
||||
@ -142,9 +142,9 @@ groupMuted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupMuted title"
|
||||
desc: "groupMuted desc"
|
||||
ext: "groupMuted ext"
|
||||
title: groupMuted title
|
||||
desc: groupMuted desc
|
||||
ext: groupMuted ext
|
||||
|
||||
groupCancelMuted:
|
||||
isSendMsg: true
|
||||
@ -152,11 +152,11 @@ groupCancelMuted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupCancelMuted title"
|
||||
desc: "groupCancelMuted desc"
|
||||
ext: "groupCancelMuted ext"
|
||||
title: groupCancelMuted title
|
||||
desc: groupCancelMuted desc
|
||||
ext: groupCancelMuted ext
|
||||
defaultTips:
|
||||
tips: "group Cancel Muted"
|
||||
tips: group Cancel Muted
|
||||
|
||||
|
||||
groupMemberMuted:
|
||||
@ -165,9 +165,9 @@ groupMemberMuted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupMemberMuted title"
|
||||
desc: "groupMemberMuted desc"
|
||||
ext: "groupMemberMuted ext"
|
||||
title: groupMemberMuted title
|
||||
desc: groupMemberMuted desc
|
||||
ext: groupMemberMuted ext
|
||||
|
||||
groupMemberCancelMuted:
|
||||
isSendMsg: true
|
||||
@ -175,9 +175,9 @@ groupMemberCancelMuted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupMemberCancelMuted title"
|
||||
desc: "groupMemberCancelMuted desc"
|
||||
ext: "groupMemberCancelMuted ext"
|
||||
title: groupMemberCancelMuted title
|
||||
desc: groupMemberCancelMuted desc
|
||||
ext: groupMemberCancelMuted ext
|
||||
|
||||
groupMemberInfoSet:
|
||||
isSendMsg: false
|
||||
@ -185,9 +185,9 @@ groupMemberInfoSet:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupMemberInfoSet title"
|
||||
desc: "groupMemberInfoSet desc"
|
||||
ext: "groupMemberInfoSet ext"
|
||||
title: groupMemberInfoSet title
|
||||
desc: groupMemberInfoSet desc
|
||||
ext: groupMemberInfoSet ext
|
||||
|
||||
groupInfoSetAnnouncement:
|
||||
isSendMsg: true
|
||||
@ -195,9 +195,9 @@ groupInfoSetAnnouncement:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupInfoSetAnnouncement title"
|
||||
desc: "groupInfoSetAnnouncement desc"
|
||||
ext: "groupInfoSetAnnouncement ext"
|
||||
title: groupInfoSetAnnouncement title
|
||||
desc: groupInfoSetAnnouncement desc
|
||||
ext: groupInfoSetAnnouncement ext
|
||||
|
||||
|
||||
groupInfoSetName:
|
||||
@ -206,9 +206,9 @@ groupInfoSetName:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "groupInfoSetName title"
|
||||
desc: "groupInfoSetName desc"
|
||||
ext: "groupInfoSetName ext"
|
||||
title: groupInfoSetName title
|
||||
desc: groupInfoSetName desc
|
||||
ext: groupInfoSetName ext
|
||||
|
||||
|
||||
#############################friend#################################
|
||||
@ -218,9 +218,9 @@ friendApplicationAdded:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "Somebody applies to add you as a friend"
|
||||
desc: "Somebody applies to add you as a friend"
|
||||
ext: "Somebody applies to add you as a friend"
|
||||
title: Somebody applies to add you as a friend
|
||||
desc: Somebody applies to add you as a friend
|
||||
ext: Somebody applies to add you as a friend
|
||||
|
||||
friendApplicationApproved:
|
||||
isSendMsg: true
|
||||
@ -228,9 +228,9 @@ friendApplicationApproved:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "Someone applies to add your friend application"
|
||||
desc: "Someone applies to add your friend application"
|
||||
ext: "Someone applies to add your friend application"
|
||||
title: Someone applies to add your friend application
|
||||
desc: Someone applies to add your friend application
|
||||
ext: Someone applies to add your friend application
|
||||
|
||||
friendApplicationRejected:
|
||||
isSendMsg: false
|
||||
@ -238,9 +238,9 @@ friendApplicationRejected:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "Someone rejected your friend application"
|
||||
desc: "Someone rejected your friend application"
|
||||
ext: "Someone rejected your friend application"
|
||||
title: Someone rejected your friend application
|
||||
desc: Someone rejected your friend application
|
||||
ext: Someone rejected your friend application
|
||||
|
||||
friendAdded:
|
||||
isSendMsg: false
|
||||
@ -248,9 +248,9 @@ friendAdded:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "We have become friends"
|
||||
desc: "We have become friends"
|
||||
ext: "We have become friends"
|
||||
title: We have become friends
|
||||
desc: We have become friends
|
||||
ext: We have become friends
|
||||
|
||||
friendDeleted:
|
||||
isSendMsg: false
|
||||
@ -258,9 +258,9 @@ friendDeleted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "deleted a friend"
|
||||
desc: "deleted a friend"
|
||||
ext: "deleted a friend"
|
||||
title: deleted a friend
|
||||
desc: deleted a friend
|
||||
ext: deleted a friend
|
||||
|
||||
friendRemarkSet:
|
||||
isSendMsg: false
|
||||
@ -268,9 +268,9 @@ friendRemarkSet:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "Your friend's profile has been changed"
|
||||
desc: "Your friend's profile has been changed"
|
||||
ext: "Your friend's profile has been changed"
|
||||
title: Your friend's profile has been changed
|
||||
desc: Your friend's profile has been changed
|
||||
ext: Your friend's profile has been changed
|
||||
|
||||
blackAdded:
|
||||
isSendMsg: false
|
||||
@ -278,9 +278,9 @@ blackAdded:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "blocked a user"
|
||||
desc: "blocked a user"
|
||||
ext: "blocked a user"
|
||||
title: blocked a user
|
||||
desc: blocked a user
|
||||
ext: blocked a user
|
||||
|
||||
blackDeleted:
|
||||
isSendMsg: false
|
||||
@ -288,9 +288,9 @@ blackDeleted:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "Remove a blocked user"
|
||||
desc: "Remove a blocked user"
|
||||
ext: "Remove a blocked user"
|
||||
title: Remove a blocked user
|
||||
desc: Remove a blocked user
|
||||
ext: Remove a blocked user
|
||||
|
||||
friendInfoUpdated:
|
||||
isSendMsg: false
|
||||
@ -298,9 +298,9 @@ friendInfoUpdated:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "friend info updated"
|
||||
desc: "friend info updated"
|
||||
ext: "friend info updated"
|
||||
title: friend info updated
|
||||
desc: friend info updated
|
||||
ext: friend info updated
|
||||
|
||||
#####################user#########################
|
||||
userInfoUpdated:
|
||||
@ -309,9 +309,9 @@ userInfoUpdated:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "Remove a blocked user"
|
||||
desc: "Remove a blocked user"
|
||||
ext: "Remove a blocked user"
|
||||
title: Remove a blocked user
|
||||
desc: Remove a blocked user
|
||||
ext: Remove a blocked user
|
||||
|
||||
userStatusChanged:
|
||||
isSendMsg: false
|
||||
@ -319,9 +319,9 @@ userStatusChanged:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: false
|
||||
title: "user status changed"
|
||||
desc: "user status changed"
|
||||
ext: "user status changed"
|
||||
title: user status changed
|
||||
desc: user status changed
|
||||
ext: user status changed
|
||||
|
||||
#####################conversation#########################
|
||||
conversationChanged:
|
||||
@ -330,9 +330,9 @@ conversationChanged:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "conversation changed"
|
||||
desc: "conversation changed"
|
||||
ext: "conversation changed"
|
||||
title: conversation changed
|
||||
desc: conversation changed
|
||||
ext: conversation changed
|
||||
|
||||
conversationSetPrivate:
|
||||
isSendMsg: true
|
||||
@ -340,6 +340,6 @@ conversationSetPrivate:
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
enable: true
|
||||
title: "burn after reading"
|
||||
desc: "burn after reading"
|
||||
ext: "burn after reading"
|
||||
title: burn after reading
|
||||
desc: burn after reading
|
||||
ext: burn after reading
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
cronExecuteTime: "0 2 * * *"
|
||||
cronExecuteTime: 0 2 * * *
|
||||
retainChatRecords: 365
|
||||
fileExpireTime: 90
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
ports: [ 10140 ]
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
@ -13,28 +13,28 @@ prometheus:
|
||||
ports: [ 20107 ]
|
||||
|
||||
maxConcurrentWorkers: 3
|
||||
#"Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified."
|
||||
enable: "geTui"
|
||||
#Use geTui for offline push notifications, or choose fcm or jpns; corresponding configuration settings must be specified.
|
||||
enable: geTui
|
||||
geTui:
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
masterSecret: ''
|
||||
appKey: ''
|
||||
intent: ''
|
||||
channelID: ''
|
||||
channelName: ''
|
||||
pushUrl: https://restapi.getui.com/v2/$appId
|
||||
masterSecret:
|
||||
appKey:
|
||||
intent:
|
||||
channelID:
|
||||
channelName:
|
||||
fcm:
|
||||
# Prioritize using file paths. If the file path is empty, use URL
|
||||
filePath: "" # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
|
||||
authURL: "" # Must start with https or http.
|
||||
filePath: # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and filePath.
|
||||
authURL: # Must start with https or http.
|
||||
jpns:
|
||||
appKey: ''
|
||||
masterSecret: ''
|
||||
pushURL: ''
|
||||
pushIntent: ''
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushURL:
|
||||
pushIntent:
|
||||
|
||||
# iOS system push sound and badge count
|
||||
iosPush:
|
||||
pushSound: "xxx"
|
||||
pushSound: xxx
|
||||
badgeCount: true
|
||||
production: false
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP
|
||||
listenIP: 0.0.0.0
|
||||
# List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. These must match the number of configured prometheus ports
|
||||
@ -15,26 +15,26 @@ prometheus:
|
||||
|
||||
object:
|
||||
# Use MinIO as object storage, or set to "cos", "oss", "kodo", "aws", while also configuring the corresponding settings
|
||||
enable: "minio"
|
||||
enable: minio
|
||||
cos:
|
||||
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
|
||||
secretID: ''
|
||||
secretKey: ''
|
||||
sessionToken: ''
|
||||
secretID:
|
||||
secretKey:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
oss:
|
||||
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||
bucket: "demo-9999999"
|
||||
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||
accessKeyID: ''
|
||||
accessKeySecret: ''
|
||||
sessionToken: ''
|
||||
endpoint: https://oss-cn-chengdu.aliyuncs.com
|
||||
bucket: demo-9999999
|
||||
bucketURL: https://demo-9999999.oss-cn-chengdu.aliyuncs.com
|
||||
accessKeyID:
|
||||
accessKeySecret:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
kodo:
|
||||
endpoint: "http://s3.cn-south-1.qiniucs.com"
|
||||
bucket: "kodo-bucket-test"
|
||||
bucketURL: "http://kodo-bucket-test-oetobfb.qiniudns.com"
|
||||
accessKeyID: ''
|
||||
accessKeySecret: ''
|
||||
sessionToken: ''
|
||||
endpoint: http://s3.cn-south-1.qiniucs.com
|
||||
bucket: kodo-bucket-test
|
||||
bucketURL: http://kodo-bucket-test-oetobfb.qiniudns.com
|
||||
accessKeyID:
|
||||
accessKeySecret:
|
||||
sessionToken:
|
||||
publicRead: false
|
||||
@ -1,6 +1,6 @@
|
||||
rpc:
|
||||
# API or other RPCs can access this RPC through this IP; if left blank, the internal network IP is obtained by default
|
||||
registerIP: ''
|
||||
registerIP:
|
||||
# Listening IP; 0.0.0.0 means both internal and external IPs are listened to, if blank, the internal network IP is automatically obtained by default
|
||||
listenIP: 0.0.0.0
|
||||
# Listening ports; if multiple are configured, multiple instances will be launched, and must be consistent with the number of prometheus.ports
|
||||
|
||||
@ -8,76 +8,76 @@ global:
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets: ['internal_ip:19093']
|
||||
- targets: [internal_ip:19093]
|
||||
|
||||
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||
# Load rules once and periodically evaluate them according to the global evaluation_interval.
|
||||
rule_files:
|
||||
- "instance-down-rules.yml"
|
||||
# - "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
- instance-down-rules.yml
|
||||
# - first_rules.yml
|
||||
# - second_rules.yml
|
||||
|
||||
# A scrape configuration containing exactly one endpoint to scrape:
|
||||
# Here it's Prometheus itself.
|
||||
scrape_configs:
|
||||
# The job name is added as a label "job='job_name'"" to any timeseries scraped from this config.
|
||||
# The job name is added as a label job=job_name" to any timeseries scraped from this config.
|
||||
# Monitored information captured by prometheus
|
||||
|
||||
# prometheus fetches application services
|
||||
- job_name: 'node_exporter'
|
||||
- job_name: node_exporter
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20114' ]
|
||||
- job_name: 'openimserver-openim-api'
|
||||
- targets: [ internal_ip:20114 ]
|
||||
- job_name: openimserver-openim-api
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20113' ]
|
||||
- targets: [ internal_ip:20113 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-msggateway'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-msggateway
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20112' ]
|
||||
- targets: [ internal_ip:20112 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-msgtransfer'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-msgtransfer
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20111', 'internal_ip:20110', 'internal_ip:20109', 'internal_ip:20108' ]
|
||||
- targets: [ internal_ip:20111, internal_ip:20110, internal_ip:20109, internal_ip:20108 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-push'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-push
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20107' ]
|
||||
- targets: [ internal_ip:20107 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-auth'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-auth
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20106' ]
|
||||
- targets: [ internal_ip:20106 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-conversation'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-conversation
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20105' ]
|
||||
- targets: [ internal_ip:20105 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-friend'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-friend
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20104' ]
|
||||
- targets: [ internal_ip:20104 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-group'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-group
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20103' ]
|
||||
- targets: [ internal_ip:20103 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-msg'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-msg
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20102' ]
|
||||
- targets: [ internal_ip:20102 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-third'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-third
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20101' ]
|
||||
- targets: [ internal_ip:20101 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
- job_name: 'openimserver-openim-rpc-user'
|
||||
namespace: default
|
||||
- job_name: openimserver-openim-rpc-user
|
||||
static_configs:
|
||||
- targets: [ 'internal_ip:20100' ]
|
||||
- targets: [ internal_ip:20100 ]
|
||||
labels:
|
||||
namespace: 'default'
|
||||
namespace: default
|
||||
@ -1,5 +1,5 @@
|
||||
address: [ localhost:16379 ]
|
||||
username: ''
|
||||
username:
|
||||
password: openIM123
|
||||
clusterMode: false
|
||||
db: 0
|
||||
|
||||
@ -10,5 +10,5 @@ rpcRegisterName:
|
||||
conversation: conversation
|
||||
third: third
|
||||
|
||||
imAdminUserID: [ "imAdmin" ]
|
||||
imAdminUserID: [ imAdmin ]
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
url: "webhook://127.0.0.1:10008/callbackExample"
|
||||
url: webhook://127.0.0.1:10008/callbackExample
|
||||
beforeSendSingleMsg:
|
||||
enable: false
|
||||
timeout: 5
|
||||
|
||||
@ -140,50 +140,50 @@ services:
|
||||
networks:
|
||||
- openim
|
||||
|
||||
prometheus:
|
||||
image: ${PROMETHEUS_IMAGE}
|
||||
container_name: prometheus
|
||||
restart: always
|
||||
volumes:
|
||||
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- ./config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml
|
||||
- ${DATA_DIR}/components/prometheus/data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
ports:
|
||||
- "19091:9090"
|
||||
networks:
|
||||
- openim
|
||||
|
||||
alertmanager:
|
||||
image: ${ALERTMANAGER_IMAGE}
|
||||
container_name: alertmanager
|
||||
restart: always
|
||||
volumes:
|
||||
- ./config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
- ./config/email.tmpl:/etc/alertmanager/email.tmpl
|
||||
ports:
|
||||
- "19093:9093"
|
||||
networks:
|
||||
- openim
|
||||
|
||||
grafana:
|
||||
image: ${GRAFANA_IMAGE}
|
||||
container_name: grafana
|
||||
user: root
|
||||
restart: always
|
||||
environment:
|
||||
- GF_SECURITY_ALLOW_EMBEDDING=true
|
||||
- GF_SESSION_COOKIE_SAMESITE=none
|
||||
- GF_SESSION_COOKIE_SECURE=true
|
||||
- GF_AUTH_ANONYMOUS_ENABLED=true
|
||||
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
|
||||
ports:
|
||||
- "13000:3000"
|
||||
volumes:
|
||||
- ${DATA_DIR:-./}/components/grafana:/var/lib/grafana
|
||||
networks:
|
||||
- openim
|
||||
# prometheus:
|
||||
# image: ${PROMETHEUS_IMAGE}
|
||||
# container_name: prometheus
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - ./config/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
# - ./config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml
|
||||
# - ${DATA_DIR}/components/prometheus/data:/prometheus
|
||||
# command:
|
||||
# - '--config.file=/etc/prometheus/prometheus.yml'
|
||||
# - '--storage.tsdb.path=/prometheus'
|
||||
# ports:
|
||||
# - "19091:9090"
|
||||
# networks:
|
||||
# - openim
|
||||
#
|
||||
# alertmanager:
|
||||
# image: ${ALERTMANAGER_IMAGE}
|
||||
# container_name: alertmanager
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - ./config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
||||
# - ./config/email.tmpl:/etc/alertmanager/email.tmpl
|
||||
# ports:
|
||||
# - "19093:9093"
|
||||
# networks:
|
||||
# - openim
|
||||
#
|
||||
# grafana:
|
||||
# image: ${GRAFANA_IMAGE}
|
||||
# container_name: grafana
|
||||
# user: root
|
||||
# restart: always
|
||||
# environment:
|
||||
# - GF_SECURITY_ALLOW_EMBEDDING=true
|
||||
# - GF_SESSION_COOKIE_SAMESITE=none
|
||||
# - GF_SESSION_COOKIE_SECURE=true
|
||||
# - GF_AUTH_ANONYMOUS_ENABLED=true
|
||||
# - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
|
||||
# ports:
|
||||
# - "13000:3000"
|
||||
# volumes:
|
||||
# - ${DATA_DIR:-./}/components/grafana:/var/lib/grafana
|
||||
# networks:
|
||||
# - openim
|
||||
|
||||
|
||||
|
||||
@ -49,14 +49,14 @@ func NewMessageApi(msgRpcClient *rpcclient.Message, userRpcClient *rpcclient.Use
|
||||
userRpcClient: rpcclient.NewUserRpcClientByUser(userRpcClient), imAdminUserID: imAdminUserID}
|
||||
}
|
||||
|
||||
func (MessageApi) SetOptions(options map[string]bool, value bool) {
|
||||
func (*MessageApi) SetOptions(options map[string]bool, value bool) {
|
||||
datautil.SetSwitchFromOptions(options, constant.IsHistory, value)
|
||||
datautil.SetSwitchFromOptions(options, constant.IsPersistent, value)
|
||||
datautil.SetSwitchFromOptions(options, constant.IsSenderSync, value)
|
||||
datautil.SetSwitchFromOptions(options, constant.IsConversationUpdate, value)
|
||||
}
|
||||
|
||||
func (m MessageApi) newUserSendMsgReq(_ *gin.Context, params *apistruct.SendMsg) *msg.SendMsgReq {
|
||||
func (m *MessageApi) newUserSendMsgReq(_ *gin.Context, params *apistruct.SendMsg) *msg.SendMsgReq {
|
||||
var newContent string
|
||||
options := make(map[string]bool, 5)
|
||||
switch params.ContentType {
|
||||
@ -231,7 +231,7 @@ func (m *MessageApi) SendMessage(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Set the status to successful if the message is sent.
|
||||
var status int = constant.MsgSendSuccessed
|
||||
var status = constant.MsgSendSuccessed
|
||||
|
||||
// Attempt to update the message sending status in the system.
|
||||
_, err = m.Client.SetSendMsgStatus(c, &msg.SetSendMsgStatusReq{
|
||||
|
||||
@ -16,6 +16,7 @@ package msgtransfer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/redis"
|
||||
@ -137,7 +138,7 @@ func (m *MsgTransfer) Start(index int, config *Config) error {
|
||||
return
|
||||
}
|
||||
|
||||
if err := prommetrics.TransferInit(prometheusPort); err != nil && err != http.ErrServerClosed {
|
||||
if err := prommetrics.TransferInit(prometheusPort); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
netErr = errs.WrapMsg(err, "prometheus start error", "prometheusPort", prometheusPort)
|
||||
netDone <- struct{}{}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ package msgtransfer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/IBM/sarama"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
@ -187,7 +188,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key
|
||||
if len(storageMessageList) > 0 {
|
||||
msg := storageMessageList[0]
|
||||
lastSeq, isNewConversation, err := och.msgDatabase.BatchInsertChat2Cache(ctx, conversationID, storageMessageList)
|
||||
if err != nil && errs.Unwrap(err) != redis.Nil {
|
||||
if err != nil && !errors.Is(errs.Unwrap(err), redis.Nil) {
|
||||
log.ZError(ctx, "batch data insert to redis err", err, "storageMsgList", storageMessageList)
|
||||
return
|
||||
}
|
||||
|
||||
@ -91,13 +91,13 @@ func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(ctx context.Cont
|
||||
}
|
||||
}
|
||||
|
||||
func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (*OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (*OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
|
||||
func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(
|
||||
sess sarama.ConsumerGroupSession,
|
||||
claim sarama.ConsumerGroupClaim,
|
||||
) error { // a instance in the consumer group
|
||||
) error { // an instance in the consumer group
|
||||
log.ZDebug(context.Background(), "online new session msg come", "highWaterMarkOffset",
|
||||
claim.HighWaterMarkOffset(), "topic", claim.Topic(), "partition", claim.Partition())
|
||||
for msg := range claim.Messages() {
|
||||
|
||||
@ -19,20 +19,20 @@ type OnlinePusher interface {
|
||||
pushToUserIDs *[]string) []string
|
||||
}
|
||||
|
||||
type emptyOnlinePUsher struct{}
|
||||
type emptyOnlinePusher struct{}
|
||||
|
||||
func newEmptyOnlinePUsher() *emptyOnlinePUsher {
|
||||
return &emptyOnlinePUsher{}
|
||||
func newEmptyOnlinePusher() *emptyOnlinePusher {
|
||||
return &emptyOnlinePusher{}
|
||||
}
|
||||
|
||||
func (emptyOnlinePUsher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
|
||||
func (emptyOnlinePusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
|
||||
pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResults, err error) {
|
||||
log.ZWarn(ctx, "emptyOnlinePUsher GetConnsAndOnlinePush", nil)
|
||||
log.ZWarn(ctx, "emptyOnlinePusher GetConnsAndOnlinePush", nil)
|
||||
return nil, nil
|
||||
}
|
||||
func (u emptyOnlinePUsher) GetOnlinePushFailedUserIDs(ctx context.Context, msg *sdkws.MsgData,
|
||||
func (u emptyOnlinePusher) GetOnlinePushFailedUserIDs(ctx context.Context, msg *sdkws.MsgData,
|
||||
wsResults []*msggateway.SingleMsgToUserResults, pushToUserIDs *[]string) []string {
|
||||
log.ZWarn(ctx, "emptyOnlinePUsher GetOnlinePushFailedUserIDs", nil)
|
||||
log.ZWarn(ctx, "emptyOnlinePusher GetOnlinePushFailedUserIDs", nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ func NewOnlinePusher(disCov discovery.SvcDiscoveryRegistry, config *Config) Onli
|
||||
case "etcd":
|
||||
return NewDefaultAllNode(disCov, config)
|
||||
default:
|
||||
return newEmptyOnlinePUsher()
|
||||
return newEmptyOnlinePusher()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -154,17 +154,17 @@ func (c *ConsumerHandler) Push2User(ctx context.Context, userIDs []string, msg *
|
||||
return nil
|
||||
}
|
||||
}
|
||||
offlinePUshUserID := []string{msg.RecvID}
|
||||
offlinePushUserID := []string{msg.RecvID}
|
||||
|
||||
//receiver offline push
|
||||
if err = c.webhookBeforeOfflinePush(ctx, &c.config.WebhooksConfig.BeforeOfflinePush,
|
||||
offlinePUshUserID, msg, nil); err != nil {
|
||||
offlinePushUserID, msg, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = c.offlinePushMsg(ctx, msg, offlinePUshUserID)
|
||||
err = c.offlinePushMsg(ctx, msg, offlinePushUserID)
|
||||
if err != nil {
|
||||
log.ZWarn(ctx, "offlinePushMsg failed", err, "offlinePUshUserID", offlinePUshUserID, "msg", msg)
|
||||
log.ZWarn(ctx, "offlinePushMsg failed", err, "offlinePushUserID", offlinePushUserID, "msg", msg)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -36,3 +36,26 @@ func TestLoadOpenIMRpcUserConfig(t *testing.T) {
|
||||
//export IMENV_OPENIM_RPC_USER_RPC_PORTS="10110,10111,10112"
|
||||
assert.Equal(t, []int{10110, 10111, 10112}, user.RPC.Ports)
|
||||
}
|
||||
|
||||
func TestLoadNotificationConfig(t *testing.T) {
|
||||
var noti Notification
|
||||
err := LoadConfig("../../../config/notification.yml", "IMENV_NOTIFICATION", ¬i)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "Your friend's profile has been changed", noti.FriendRemarkSet.OfflinePush.Title)
|
||||
}
|
||||
|
||||
func TestLoadOpenIMThirdConfig(t *testing.T) {
|
||||
var third Third
|
||||
err := LoadConfig("../../../config/openim-rpc-third.yml", "IMENV_OPENIM_RPC_THIRD", &third)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "enabled", third.Object.Enable)
|
||||
assert.Equal(t, "https://oss-cn-chengdu.aliyuncs.com", third.Object.Oss.Endpoint)
|
||||
assert.Equal(t, "my_bucket_name", third.Object.Oss.Bucket)
|
||||
assert.Equal(t, "https://my_bucket_name.oss-cn-chengdu.aliyuncs.com", third.Object.Oss.BucketURL)
|
||||
assert.Equal(t, "AKID1234567890", third.Object.Oss.AccessKeyID)
|
||||
assert.Equal(t, "abc123xyz789", third.Object.Oss.AccessKeySecret)
|
||||
assert.Equal(t, "session_token_value", third.Object.Oss.SessionToken) // Uncomment if session token is needed
|
||||
assert.Equal(t, true, third.Object.Oss.PublicRead)
|
||||
|
||||
// Environment: IMENV_OPENIM_RPC_THIRD_OBJECT_ENABLE=enabled;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_ENDPOINT=https://oss-cn-chengdu.aliyuncs.com;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_BUCKET=my_bucket_name;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_BUCKETURL=https://my_bucket_name.oss-cn-chengdu.aliyuncs.com;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_ACCESSKEYID=AKID1234567890;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_ACCESSKEYSECRET=abc123xyz789;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_SESSIONTOKEN=session_token_value;IMENV_OPENIM_RPC_THIRD_OBJECT_OSS_PUBLICREAD=true
|
||||
}
|
||||
|
||||
@ -90,8 +90,8 @@ type CommonMsgDatabase interface {
|
||||
|
||||
// to mq
|
||||
MsgToMQ(ctx context.Context, key string, msg2mq *sdkws.MsgData) error
|
||||
MsgToPushMQ(ctx context.Context, key, conversarionID string, msg2mq *sdkws.MsgData) (int32, int64, error)
|
||||
MsgToMongoMQ(ctx context.Context, key, conversarionID string, msgs []*sdkws.MsgData, lastSeq int64) error
|
||||
MsgToPushMQ(ctx context.Context, key, conversationID string, msg2mq *sdkws.MsgData) (int32, int64, error)
|
||||
MsgToMongoMQ(ctx context.Context, key, conversationID string, msgs []*sdkws.MsgData, lastSeq int64) error
|
||||
|
||||
RangeUserSendCount(ctx context.Context, start time.Time, end time.Time, group bool, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, users []*model.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 []*model.GroupCount, dateCount map[string]int64, err error)
|
||||
|
||||
@ -118,9 +118,9 @@ func (m *MsgMgo) GetMsgBySeqIndexIn1Doc(ctx context.Context, userID, docID strin
|
||||
}
|
||||
|
||||
func (m *MsgMgo) getMsgBySeqIndexIn1Doc(ctx context.Context, userID, docID string, seqs []int64) ([]*model.MsgInfoModel, error) {
|
||||
indexs := make([]int64, 0, len(seqs))
|
||||
indexes := make([]int64, 0, len(seqs))
|
||||
for _, seq := range seqs {
|
||||
indexs = append(indexs, m.model.GetMsgIndex(seq))
|
||||
indexes = append(indexes, m.model.GetMsgIndex(seq))
|
||||
}
|
||||
pipeline := mongo.Pipeline{
|
||||
bson.D{{Key: "$match", Value: bson.D{
|
||||
@ -131,7 +131,7 @@ func (m *MsgMgo) getMsgBySeqIndexIn1Doc(ctx context.Context, userID, docID strin
|
||||
{Key: "doc_id", Value: 1},
|
||||
{Key: "msgs", Value: bson.D{
|
||||
{Key: "$map", Value: bson.D{
|
||||
{Key: "input", Value: indexs},
|
||||
{Key: "input", Value: indexes},
|
||||
{Key: "as", Value: "index"},
|
||||
{Key: "in", Value: bson.D{
|
||||
{Key: "$arrayElemAt", Value: bson.A{"$msgs", "$$index"}},
|
||||
|
||||
@ -92,15 +92,15 @@ type GroupCount struct {
|
||||
Count int64 `bson:"count"`
|
||||
}
|
||||
|
||||
func (MsgDocModel) TableName() string {
|
||||
func (*MsgDocModel) TableName() string {
|
||||
return MsgTableName
|
||||
}
|
||||
|
||||
func (MsgDocModel) GetSingleGocMsgNum() int64 {
|
||||
func (*MsgDocModel) GetSingleGocMsgNum() int64 {
|
||||
return singleGocMsgNum
|
||||
}
|
||||
|
||||
func (MsgDocModel) GetSingleGocMsgNum5000() int64 {
|
||||
func (*MsgDocModel) GetSingleGocMsgNum5000() int64 {
|
||||
return singleGocMsgNum5000
|
||||
}
|
||||
|
||||
@ -108,12 +108,12 @@ func (m *MsgDocModel) IsFull() bool {
|
||||
return m.Msg[len(m.Msg)-1].Msg != nil
|
||||
}
|
||||
|
||||
func (m MsgDocModel) GetDocID(conversationID string, seq int64) string {
|
||||
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 {
|
||||
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])
|
||||
@ -127,15 +127,15 @@ func (m MsgDocModel) GetDocIDSeqsMap(conversationID string, seqs []int64) map[st
|
||||
return t
|
||||
}
|
||||
|
||||
func (MsgDocModel) GetMsgIndex(seq int64) int64 {
|
||||
func (*MsgDocModel) GetMsgIndex(seq int64) int64 {
|
||||
return (seq - 1) % singleGocMsgNum
|
||||
}
|
||||
|
||||
func (MsgDocModel) indexGen(conversationID string, seqSuffix int64) string {
|
||||
func (*MsgDocModel) indexGen(conversationID string, seqSuffix int64) string {
|
||||
return conversationID + ":" + strconv.FormatInt(seqSuffix, 10)
|
||||
}
|
||||
|
||||
func (MsgDocModel) GenExceptionMessageBySeqs(seqs []int64) (exceptionMsg []*sdkws.MsgData) {
|
||||
func (*MsgDocModel) GenExceptionMessageBySeqs(seqs []int64) (exceptionMsg []*sdkws.MsgData) {
|
||||
for _, v := range seqs {
|
||||
msgModel := new(sdkws.MsgData)
|
||||
msgModel.Seq = v
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user