From d12d571c2b5f5e2c0030c54733de7bf7a2388e1c Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Tue, 18 Jan 2022 09:25:41 +0800 Subject: [PATCH] Refactor code --- config/config.yaml | 147 +++++++++++++++++++++++++++---- internal/api/chat/pull_msg.go | 2 +- internal/api/chat/send_msg.go | 2 +- internal/rpc/msg/pull_message.go | 2 +- pkg/common/config/config.go | 2 +- pkg/common/db/mongoModel.go | 2 +- pkg/common/utils/utils.go | 1 - 7 files changed, 133 insertions(+), 25 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index b8ab770c2..359ecaa20 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -85,9 +85,9 @@ credential: rpcport: openImUserPort: [ 10100 ] openImFriendPort: [ 10200 ] - openImOfflineMessagePort: [ 10300] + openImOfflineMessagePort: [ 10300 ] openImOnlineRelayPort: [ 10400 ] - openImGroupPort: [ 10500 ] + openImGroupPort: [ 10500 ] openImAuthPort: [ 10600 ] openImPushPort: [ 10700 ] c2c: @@ -144,8 +144,8 @@ push: pushUrl: "https://api.jpush.cn/v3/push" pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end" manager: - appManagerUid: ["openIM123456","openIM654321"] - secrets: ["openIM1","openIM2"] + appManagerUid: [ "openIM123456","openIM654321" ] + secrets: [ "openIM1","openIM2" ] secret: tuoyun @@ -176,6 +176,7 @@ iOSPush: badgeCount: true notification: + groupCreated: conversation: reliabilityLevel: 1 @@ -188,8 +189,7 @@ notification: defaultTips: tips: "create the group" # xx create the group - - groupInfoChanged: + groupInfoSet: conversation: reliabilityLevel: 1 unreadCount: false @@ -201,9 +201,105 @@ notification: defaultTips: tips: "group info changed by" # group info changed by xx + joinGroupApplication: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + memberQuit: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx - FriendApplicationAdded: + groupApplicationAccepted: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + groupApplicationRejected: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + groupOwnerTransferred: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberKicked: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberInvited: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberEnter: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + #############################friend################################# + + friendApplicationAdded: conversation: reliabilityLevel: 2 unreadCount: false @@ -215,7 +311,7 @@ notification: defaultTips: tips: "I applies to add you as a friend" # - FriendApplicationApproved: + friendApplicationApproved: conversation: reliabilityLevel: 2 unreadCount: false @@ -228,7 +324,7 @@ notification: tips: "I applies to add your friend application" # - FriendApplicationRejected: + friendApplicationRejected: conversation: reliabilityLevel: 2 unreadCount: false @@ -244,7 +340,7 @@ notification: - FriendAdded: + friendAdded: conversation: reliabilityLevel: 3 unreadCount: true @@ -258,7 +354,7 @@ notification: - FriendDeleted: + friendDeleted: conversation: reliabilityLevel: 2 unreadCount: false @@ -271,7 +367,7 @@ notification: tips: "Deleted a friend" # - FriendInfoChanged: + friendInfoChanged: conversation: reliabilityLevel: 2 unreadCount: false @@ -285,7 +381,7 @@ notification: - BlackAdded: + blackAdded: conversation: reliabilityLevel: 2 unreadCount: false @@ -298,7 +394,7 @@ notification: tips: "Blocked a user" # - BlackDeleted: + blackDeleted: conversation: reliabilityLevel: 2 unreadCount: false @@ -310,7 +406,20 @@ notification: defaultTips: tips: "Remove a blocked user" -" # xx applied to add you as a friend + #####################user######################### + userInfoUpdated: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Remove a blocked user" + desc: "Remove a blocked user" + ext: "Remove a blocked user" + defaultTips: + tips: "Remove a blocked user" + + " # xx applied to add you as a friend @@ -327,9 +436,9 @@ demo: superCode: 666666 mail: title: "openIM" - senderMail: "1765567899@qq.com" - senderAuthorizationCode: "1gxyausfoevlzbfag" - smtpAddr: "smtp.qq.com" - smtpPort: 25 +senderMail: "1765567899@qq.com" +senderAuthorizationCode: "1gxyausfoevlzbfag" +smtpAddr: "smtp.qq.com" +smtpPort: 25 diff --git a/internal/api/chat/pull_msg.go b/internal/api/chat/pull_msg.go index 881612681..56903f5cc 100644 --- a/internal/api/chat/pull_msg.go +++ b/internal/api/chat/pull_msg.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/chat" - "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/chat/send_msg.go b/internal/api/chat/send_msg.go index 3909ac125..a28dcd1ce 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" - "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "context" "Open_IM/pkg/grpc-etcdv3/getcdv3" diff --git a/internal/rpc/msg/pull_message.go b/internal/rpc/msg/pull_message.go index 46d0ad78a..af619182b 100644 --- a/internal/rpc/msg/pull_message.go +++ b/internal/rpc/msg/pull_message.go @@ -6,7 +6,7 @@ import ( commonDB "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" - "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "sort" "strings" diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 2e6870557..3f5cccd5d 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -260,7 +260,7 @@ type config struct { OfflinePush POfflinePush `yaml:"offlinePush"` DefaultTips PDefaultTips `yaml:"defaultTips"` } - FriendRemarkSet struct { + FriendInfoChanged struct { Conversation PConversation `yaml:"conversation"` OfflinePush POfflinePush `yaml:"offlinePush"` DefaultTips PDefaultTips `yaml:"defaultTips"` diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index bb8650309..128815031 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -5,7 +5,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/pkg/proto/sdk_ws" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "errors" "github.com/garyburd/redigo/redis" "github.com/golang/protobuf/proto" diff --git a/pkg/common/utils/utils.go b/pkg/common/utils/utils.go index e299fefc2..2fbcf1930 100644 --- a/pkg/common/utils/utils.go +++ b/pkg/common/utils/utils.go @@ -3,7 +3,6 @@ package utils import ( db "Open_IM/pkg/common/db" imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils"