diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index b22ff0210..cf51724de 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -8,7 +8,7 @@ import ( "Open_IM/internal/api/manage" apiThird "Open_IM/internal/api/third" "Open_IM/internal/api/user" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "flag" "github.com/gin-gonic/gin" "strconv" diff --git a/cmd/rpc/open_im_msg/main.go b/cmd/rpc/open_im_msg/main.go index 26ca9e669..68f5c8931 100644 --- a/cmd/rpc/open_im_msg/main.go +++ b/cmd/rpc/open_im_msg/main.go @@ -2,7 +2,7 @@ package main import ( rpcChat "Open_IM/internal/rpc/chat" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "flag" ) diff --git a/internal/api/auth/user_register.go b/internal/api/auth/user_register.go index b270e345f..55f0a477e 100644 --- a/internal/api/auth/user_register.go +++ b/internal/api/auth/user_register.go @@ -2,9 +2,9 @@ package apiAuth import ( pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/auth/user_token.go b/internal/api/auth/user_token.go index f018237f2..1d6036458 100644 --- a/internal/api/auth/user_token.go +++ b/internal/api/auth/user_token.go @@ -2,9 +2,9 @@ package apiAuth import ( pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/chat/newest_seq.go b/internal/api/chat/newest_seq.go index d2131b332..03d0cee32 100644 --- a/internal/api/chat/newest_seq.go +++ b/internal/api/chat/newest_seq.go @@ -2,10 +2,10 @@ package apiChat import ( pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/chat/pull_msg.go b/internal/api/chat/pull_msg.go index 19634a5fa..0e1c85df3 100644 --- a/internal/api/chat/pull_msg.go +++ b/internal/api/chat/pull_msg.go @@ -2,10 +2,10 @@ package apiChat import ( "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common" "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 71042bdca..46264b867 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -2,12 +2,12 @@ package apiChat import ( pbChat "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common" "context" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "github.com/gin-gonic/gin" "net/http" "strings" diff --git a/internal/api/friend/add_blacklist.go b/internal/api/friend/add_blacklist.go index 51c6cab96..e0969faf3 100644 --- a/internal/api/friend/add_blacklist.go +++ b/internal/api/friend/add_blacklist.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/friend/add_friend.go b/internal/api/friend/add_friend.go index 8f80da958..63f8be35b 100644 --- a/internal/api/friend/add_friend.go +++ b/internal/api/friend/add_friend.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/friend/add_friend_response.go b/internal/api/friend/add_friend_response.go index d50e520d6..37e801b3e 100644 --- a/internal/api/friend/add_friend_response.go +++ b/internal/api/friend/add_friend_response.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/friend/delete_friend.go b/internal/api/friend/delete_friend.go index 489efad6c..4bdbedeee 100644 --- a/internal/api/friend/delete_friend.go +++ b/internal/api/friend/delete_friend.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/friend/get_blcaklist.go b/internal/api/friend/get_blcaklist.go index 7d0f5cc76..5e875a5e8 100644 --- a/internal/api/friend/get_blcaklist.go +++ b/internal/api/friend/get_blcaklist.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/friend/get_friend_apply_list.go b/internal/api/friend/get_friend_apply_list.go index 35353d229..d7ca192e4 100644 --- a/internal/api/friend/get_friend_apply_list.go +++ b/internal/api/friend/get_friend_apply_list.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/friend/get_friend_list.go b/internal/api/friend/get_friend_list.go index 7fc656ad1..db1361572 100644 --- a/internal/api/friend/get_friend_list.go +++ b/internal/api/friend/get_friend_list.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/friend/get_friends_info.go b/internal/api/friend/get_friends_info.go index a2e2c21c1..47ee88a10 100644 --- a/internal/api/friend/get_friends_info.go +++ b/internal/api/friend/get_friends_info.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/friend/is_friend.go b/internal/api/friend/is_friend.go index d2c83ac2a..e10c969f3 100644 --- a/internal/api/friend/is_friend.go +++ b/internal/api/friend/is_friend.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/friend/remove_blacklist.go b/internal/api/friend/remove_blacklist.go index 2573064e5..57a018513 100644 --- a/internal/api/friend/remove_blacklist.go +++ b/internal/api/friend/remove_blacklist.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/friend/set_friend_comment.go b/internal/api/friend/set_friend_comment.go index 9ec0683e8..e16f7e598 100644 --- a/internal/api/friend/set_friend_comment.go +++ b/internal/api/friend/set_friend_comment.go @@ -2,9 +2,9 @@ package friend import ( pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/create_group.go b/internal/api/group/create_group.go index 6b35b123f..fd9cc14f7 100644 --- a/internal/api/group/create_group.go +++ b/internal/api/group/create_group.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/get_group_applicationList.go b/internal/api/group/get_group_applicationList.go index 342af7a97..faceb921e 100644 --- a/internal/api/group/get_group_applicationList.go +++ b/internal/api/group/get_group_applicationList.go @@ -1,11 +1,11 @@ package group import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/get_groups_info.go b/internal/api/group/get_groups_info.go index 7ace5c47a..b2825485a 100644 --- a/internal/api/group/get_groups_info.go +++ b/internal/api/group/get_groups_info.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/group.go b/internal/api/group/group.go index c4a26c1d0..e26d235b2 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "fmt" "github.com/gin-gonic/gin" diff --git a/internal/api/group/group_application_response.go b/internal/api/group/group_application_response.go index 3c4408cb2..70dd966eb 100644 --- a/internal/api/group/group_application_response.go +++ b/internal/api/group/group_application_response.go @@ -1,11 +1,11 @@ package group import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/join_group.go b/internal/api/group/join_group.go index 3f739c281..5e85e288e 100644 --- a/internal/api/group/join_group.go +++ b/internal/api/group/join_group.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/quit_group.go b/internal/api/group/quit_group.go index 7daaa4a7e..1caea9d0a 100644 --- a/internal/api/group/quit_group.go +++ b/internal/api/group/quit_group.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/set_group_info.go b/internal/api/group/set_group_info.go index 9a7bea913..03a3f8c43 100644 --- a/internal/api/group/set_group_info.go +++ b/internal/api/group/set_group_info.go @@ -2,9 +2,9 @@ package group import ( pb "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/group/transfer_group_owner.go b/internal/api/group/transfer_group_owner.go index 9a5c2ab4d..f7baaba3f 100644 --- a/internal/api/group/transfer_group_owner.go +++ b/internal/api/group/transfer_group_owner.go @@ -1,11 +1,11 @@ package group import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/group" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index af4e75bce..99ad3e73a 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -8,11 +8,11 @@ package manage import ( pbChat "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common" "context" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go index 4b70d606d..cd43fd59b 100644 --- a/internal/api/manage/management_user.go +++ b/internal/api/manage/management_user.go @@ -8,9 +8,9 @@ package manage import ( pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index 5c6628d02..af68d8fd8 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -1,8 +1,8 @@ package apiThird import ( - "Open_IM/src/common/config" - log2 "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + log2 "Open_IM/pkg/common/log" "github.com/gin-gonic/gin" sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" "net/http" diff --git a/internal/api/user/get_user_info.go b/internal/api/user/get_user_info.go index ed9271a63..4e93787b5 100644 --- a/internal/api/user/get_user_info.go +++ b/internal/api/user/get_user_info.go @@ -2,9 +2,9 @@ package user import ( pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/api/user/update_user_info.go b/internal/api/user/update_user_info.go index c57da9d98..1bcc32117 100644 --- a/internal/api/user/update_user_info.go +++ b/internal/api/user/update_user_info.go @@ -2,9 +2,9 @@ package user import ( pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "github.com/gin-gonic/gin" "net/http" diff --git a/internal/msg_gateway/gate/init.go b/internal/msg_gateway/gate/init.go index 510cdaefc..03f82f3ad 100644 --- a/internal/msg_gateway/gate/init.go +++ b/internal/msg_gateway/gate/init.go @@ -1,8 +1,8 @@ package gate import ( - "Open_IM/src/common/config" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" "github.com/go-playground/validator/v10" "sync" ) diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index 381e9c4fe..ab20158cd 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -1,12 +1,12 @@ package gate import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "encoding/json" "github.com/gorilla/websocket" diff --git a/internal/msg_gateway/gate/rpc_server.go b/internal/msg_gateway/gate/rpc_server.go index 90f807e87..fc43493e3 100644 --- a/internal/msg_gateway/gate/rpc_server.go +++ b/internal/msg_gateway/gate/rpc_server.go @@ -1,12 +1,12 @@ package gate import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbRelay "Open_IM/pkg/proto/relay" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "encoding/json" "fmt" diff --git a/internal/msg_gateway/gate/validate.go b/internal/msg_gateway/gate/validate.go index a7a75f8e8..8c701576e 100644 --- a/internal/msg_gateway/gate/validate.go +++ b/internal/msg_gateway/gate/validate.go @@ -7,8 +7,8 @@ package gate import ( - "Open_IM/src/common/constant" - "Open_IM/src/common/log" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" "github.com/mitchellh/mapstructure" ) diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index ffc14680d..1a0f5a1a2 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -1,9 +1,9 @@ package gate import ( - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/utils" "github.com/gorilla/websocket" "net/http" "time" diff --git a/internal/msg_transfer/logic/db.go b/internal/msg_transfer/logic/db.go index 9b641b7a4..d88d6d452 100644 --- a/internal/msg_transfer/logic/db.go +++ b/internal/msg_transfer/logic/db.go @@ -2,8 +2,8 @@ package logic import ( pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/src/common/db" - "Open_IM/src/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" ) func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error { diff --git a/internal/msg_transfer/logic/history_msg_handler.go b/internal/msg_transfer/logic/history_msg_handler.go index a661f10cf..9833bf05b 100644 --- a/internal/msg_transfer/logic/history_msg_handler.go +++ b/internal/msg_transfer/logic/history_msg_handler.go @@ -1,14 +1,14 @@ package logic import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + kfk "Open_IM/pkg/common/kafka" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbMsg "Open_IM/pkg/proto/chat" pbPush "Open_IM/pkg/proto/push" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - kfk "Open_IM/src/common/kafka" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" diff --git a/internal/msg_transfer/logic/init.go b/internal/msg_transfer/logic/init.go index 03a7d2c33..cce434d99 100644 --- a/internal/msg_transfer/logic/init.go +++ b/internal/msg_transfer/logic/init.go @@ -1,9 +1,9 @@ package logic import ( - "Open_IM/src/common/config" - "Open_IM/src/common/kafka" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/kafka" + "Open_IM/pkg/common/log" ) var ( diff --git a/internal/msg_transfer/logic/persistent_msg_handler.go b/internal/msg_transfer/logic/persistent_msg_handler.go index 2626d6fd4..88039041c 100644 --- a/internal/msg_transfer/logic/persistent_msg_handler.go +++ b/internal/msg_transfer/logic/persistent_msg_handler.go @@ -7,13 +7,13 @@ package logic import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_msg_model" + kfk "Open_IM/pkg/common/kafka" + "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_msg_model" - kfk "Open_IM/src/common/kafka" - "Open_IM/src/common/log" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" "strings" diff --git a/internal/push/logic/init.go b/internal/push/logic/init.go index a7be054b8..be36469b2 100644 --- a/internal/push/logic/init.go +++ b/internal/push/logic/init.go @@ -7,10 +7,10 @@ package logic import ( - "Open_IM/src/common/config" - "Open_IM/src/common/kafka" - "Open_IM/src/common/log" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/kafka" + "Open_IM/pkg/common/log" + "Open_IM/pkg/utils" ) var ( diff --git a/internal/push/logic/push_handler.go b/internal/push/logic/push_handler.go index f558d6316..22382a5b9 100644 --- a/internal/push/logic/push_handler.go +++ b/internal/push/logic/push_handler.go @@ -7,9 +7,9 @@ package logic import ( - "Open_IM/src/common/config" - kfk "Open_IM/src/common/kafka" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + kfk "Open_IM/pkg/common/kafka" + "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" pbRelay "Open_IM/pkg/proto/relay" "github.com/Shopify/sarama" diff --git a/internal/push/logic/push_rpc_server.go b/internal/push/logic/push_rpc_server.go index 3a880ee5e..ca0e93880 100644 --- a/internal/push/logic/push_rpc_server.go +++ b/internal/push/logic/push_rpc_server.go @@ -1,12 +1,12 @@ package logic import ( - "Open_IM/src/common/config" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/push" pbRelay "Open_IM/pkg/proto/relay" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "google.golang.org/grpc" "net" diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 8ee6d1a77..17ac47076 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -9,15 +9,15 @@ package logic import ( rpcChat "Open_IM/internal/rpc/chat" "Open_IM/internal/rpc/user/internal_service" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" pbGroup "Open_IM/pkg/proto/group" pbRelay "Open_IM/pkg/proto/relay" pbGetInfo "Open_IM/pkg/proto/user" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" - "Open_IM/src/utils" + "Open_IM/pkg/utils" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "encoding/json" "fmt" diff --git a/internal/push/logic/tpns.go b/internal/push/logic/tpns.go index 6a5dc1e56..3d737f4a7 100644 --- a/internal/push/logic/tpns.go +++ b/internal/push/logic/tpns.go @@ -5,7 +5,7 @@ import ( "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/auth" "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/common" "Open_IM/internal/push/sdk/tpns-server-sdk-go/go/req" - "Open_IM/src/common/config" + "Open_IM/pkg/common/config" ) var badgeType = -2 diff --git a/internal/rpc/auth/rpcAuth.go b/internal/rpc/auth/rpcAuth.go index 1ff599ef2..414603d1a 100644 --- a/internal/rpc/auth/rpcAuth.go +++ b/internal/rpc/auth/rpcAuth.go @@ -1,11 +1,11 @@ package auth import ( - "Open_IM/src/common/config" - log2 "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + log2 "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "google.golang.org/grpc" "net" "strconv" diff --git a/internal/rpc/auth/user_register.go b/internal/rpc/auth/user_register.go index 62068d91a..3f5de7032 100644 --- a/internal/rpc/auth/user_register.go +++ b/internal/rpc/auth/user_register.go @@ -1,8 +1,8 @@ package auth import ( - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbAuth "Open_IM/pkg/proto/auth" "context" ) diff --git a/internal/rpc/auth/user_token.go b/internal/rpc/auth/user_token.go index 2e1e295bc..73b544d64 100644 --- a/internal/rpc/auth/user_token.go +++ b/internal/rpc/auth/user_token.go @@ -1,10 +1,10 @@ package auth import ( - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/chat/pull_message.go b/internal/rpc/chat/pull_message.go index c5ef5e2d9..941c3a9b1 100644 --- a/internal/rpc/chat/pull_message.go +++ b/internal/rpc/chat/pull_message.go @@ -4,8 +4,8 @@ import ( "context" "github.com/garyburd/redigo/redis" - commonDB "Open_IM/src/common/db" - "Open_IM/src/common/log" + commonDB "Open_IM/pkg/common/db" + "Open_IM/pkg/common/log" "sort" "strings" diff --git a/internal/rpc/chat/rpcChat.go b/internal/rpc/chat/rpcChat.go index eea41a51d..0ea261946 100644 --- a/internal/rpc/chat/rpcChat.go +++ b/internal/rpc/chat/rpcChat.go @@ -1,12 +1,12 @@ package chat import ( - "Open_IM/src/common/config" - "Open_IM/src/common/kafka" - log2 "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/kafka" + log2 "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "google.golang.org/grpc" "net" "strconv" diff --git a/internal/rpc/chat/send_msg.go b/internal/rpc/chat/send_msg.go index c8a420421..87f363a8f 100644 --- a/internal/rpc/chat/send_msg.go +++ b/internal/rpc/chat/send_msg.go @@ -3,14 +3,14 @@ package chat import ( "Open_IM/internal/api/group" "Open_IM/internal/push/content_struct" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - http2 "Open_IM/src/common/http" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + http2 "Open_IM/pkg/common/http" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "encoding/json" "math/rand" diff --git a/internal/rpc/friend/add_blacklist.go b/internal/rpc/friend/add_blacklist.go index e47f62c39..f490a2934 100644 --- a/internal/rpc/friend/add_blacklist.go +++ b/internal/rpc/friend/add_blacklist.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/add_friend.go b/internal/rpc/friend/add_friend.go index cb1c9b3ae..1540f9a8b 100644 --- a/internal/rpc/friend/add_friend.go +++ b/internal/rpc/friend/add_friend.go @@ -3,13 +3,13 @@ package friend import ( "Open_IM/internal/push/content_struct" "Open_IM/internal/push/logic" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/add_friend_response.go b/internal/rpc/friend/add_friend_response.go index dee4e03bb..048110a23 100644 --- a/internal/rpc/friend/add_friend_response.go +++ b/internal/rpc/friend/add_friend_response.go @@ -3,13 +3,13 @@ package friend import ( "Open_IM/internal/push/content_struct" "Open_IM/internal/push/logic" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/delete_friend.go b/internal/rpc/friend/delete_friend.go index 482036195..2b11988b8 100644 --- a/internal/rpc/friend/delete_friend.go +++ b/internal/rpc/friend/delete_friend.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/get_blacklist.go b/internal/rpc/friend/get_blacklist.go index da2fae257..99d57fb25 100644 --- a/internal/rpc/friend/get_blacklist.go +++ b/internal/rpc/friend/get_blacklist.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/get_firends_info.go b/internal/rpc/friend/get_firends_info.go index 1ac7f1acf..5c449d91f 100644 --- a/internal/rpc/friend/get_firends_info.go +++ b/internal/rpc/friend/get_firends_info.go @@ -1,13 +1,13 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "fmt" "google.golang.org/grpc" diff --git a/internal/rpc/friend/get_friend_apply_list.go b/internal/rpc/friend/get_friend_apply_list.go index c1067b77f..556576f71 100644 --- a/internal/rpc/friend/get_friend_apply_list.go +++ b/internal/rpc/friend/get_friend_apply_list.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "fmt" "strconv" diff --git a/internal/rpc/friend/get_friend_list.go b/internal/rpc/friend/get_friend_list.go index cab4d3849..0674cdc53 100644 --- a/internal/rpc/friend/get_friend_list.go +++ b/internal/rpc/friend/get_friend_list.go @@ -1,12 +1,12 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/is_friend.go b/internal/rpc/friend/is_friend.go index 94233b972..3690423e7 100644 --- a/internal/rpc/friend/is_friend.go +++ b/internal/rpc/friend/is_friend.go @@ -1,12 +1,12 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "fmt" ) diff --git a/internal/rpc/friend/is_in_blacklist.go b/internal/rpc/friend/is_in_blacklist.go index a62e9a999..6275f5300 100644 --- a/internal/rpc/friend/is_in_blacklist.go +++ b/internal/rpc/friend/is_in_blacklist.go @@ -1,8 +1,8 @@ package friend import ( - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" "context" "fmt" diff --git a/internal/rpc/friend/remove_blacklist.go b/internal/rpc/friend/remove_blacklist.go index 1091e3a96..af163e86d 100644 --- a/internal/rpc/friend/remove_blacklist.go +++ b/internal/rpc/friend/remove_blacklist.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/friend/set_friend_comment.go b/internal/rpc/friend/set_friend_comment.go index 489bfe50c..8b7331935 100644 --- a/internal/rpc/friend/set_friend_comment.go +++ b/internal/rpc/friend/set_friend_comment.go @@ -1,11 +1,11 @@ package friend import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/group/create_group.go b/internal/rpc/group/create_group.go index 377207608..40f3d3af2 100644 --- a/internal/rpc/group/create_group.go +++ b/internal/rpc/group/create_group.go @@ -3,15 +3,15 @@ package group import ( "Open_IM/internal/push/content_struct" "Open_IM/internal/push/logic" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "google.golang.org/grpc" "net" diff --git a/internal/rpc/group/get_group_applicationList.go b/internal/rpc/group/get_group_applicationList.go index 0a92ac593..a08b32f8e 100644 --- a/internal/rpc/group/get_group_applicationList.go +++ b/internal/rpc/group/get_group_applicationList.go @@ -1,8 +1,8 @@ package group import ( - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" "Open_IM/pkg/proto/group" "context" ) diff --git a/internal/rpc/group/get_groups_info.go b/internal/rpc/group/get_groups_info.go index 7df8d9a28..667e3c84f 100644 --- a/internal/rpc/group/get_groups_info.go +++ b/internal/rpc/group/get_groups_info.go @@ -1,11 +1,11 @@ package group import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 0ad390e8f..7a3f954f9 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -3,16 +3,16 @@ package group import ( "Open_IM/internal/push/content_struct" "Open_IM/internal/push/logic" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" pbChat "Open_IM/pkg/proto/chat" "encoding/json" - imdb "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "fmt" diff --git a/internal/rpc/group/group_application_response.go b/internal/rpc/group/group_application_response.go index 9271525c8..4282de51b 100644 --- a/internal/rpc/group/group_application_response.go +++ b/internal/rpc/group/group_application_response.go @@ -1,9 +1,9 @@ package group import ( - "Open_IM/src/common/db" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" "Open_IM/pkg/proto/group" "context" ) diff --git a/internal/rpc/group/join_group.go b/internal/rpc/group/join_group.go index 7df09bfe4..4b1c88c89 100644 --- a/internal/rpc/group/join_group.go +++ b/internal/rpc/group/join_group.go @@ -1,11 +1,11 @@ package group import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/group/quit_group.go b/internal/rpc/group/quit_group.go index b16f77241..5906832a2 100644 --- a/internal/rpc/group/quit_group.go +++ b/internal/rpc/group/quit_group.go @@ -1,12 +1,12 @@ package group import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/group/set_group_info.go b/internal/rpc/group/set_group_info.go index fa4219022..046f8bc4f 100644 --- a/internal/rpc/group/set_group_info.go +++ b/internal/rpc/group/set_group_info.go @@ -1,12 +1,12 @@ package group import ( - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbGroup "Open_IM/pkg/proto/group" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/group/transfer_group_owner.go b/internal/rpc/group/transfer_group_owner.go index 2a989e557..4595fa1f1 100644 --- a/internal/rpc/group/transfer_group_owner.go +++ b/internal/rpc/group/transfer_group_owner.go @@ -1,8 +1,8 @@ package group import ( - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" "Open_IM/pkg/proto/group" "context" ) diff --git a/internal/rpc/user/get_user_info.go b/internal/rpc/user/get_user_info.go index 45c08e899..6b884c05b 100644 --- a/internal/rpc/user/get_user_info.go +++ b/internal/rpc/user/get_user_info.go @@ -1,12 +1,12 @@ package user import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "google.golang.org/grpc" "net" diff --git a/internal/rpc/user/internal_service/get_user_info_to_client.go b/internal/rpc/user/internal_service/get_user_info_to_client.go index 20a89e64f..4cd0d0d2d 100644 --- a/internal/rpc/user/internal_service/get_user_info_to_client.go +++ b/internal/rpc/user/internal_service/get_user_info_to_client.go @@ -2,8 +2,8 @@ package internal_service import ( pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/common/config" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/grpc-etcdv3/getcdv3" "context" "strings" ) diff --git a/internal/rpc/user/management_user.go b/internal/rpc/user/management_user.go index 53462d69f..f9d5b75a1 100644 --- a/internal/rpc/user/management_user.go +++ b/internal/rpc/user/management_user.go @@ -7,11 +7,11 @@ package user import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" ) diff --git a/internal/rpc/user/update_user_info.go b/internal/rpc/user/update_user_info.go index a0715accb..bd60c7742 100644 --- a/internal/rpc/user/update_user_info.go +++ b/internal/rpc/user/update_user_info.go @@ -2,15 +2,15 @@ package user import ( "Open_IM/internal/push/logic" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db/mysql_model/im_mysql_model" - "Open_IM/src/common/log" - "Open_IM/src/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" pbFriend "Open_IM/pkg/proto/friend" pbUser "Open_IM/pkg/proto/user" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "context" "strings" ) diff --git a/src/common/config/config.go b/pkg/common/config/config.go similarity index 100% rename from src/common/config/config.go rename to pkg/common/config/config.go diff --git a/src/common/config/error.go b/pkg/common/config/error.go similarity index 100% rename from src/common/config/error.go rename to pkg/common/config/error.go diff --git a/src/common/constant/constant.go b/pkg/common/constant/constant.go similarity index 100% rename from src/common/constant/constant.go rename to pkg/common/constant/constant.go diff --git a/src/common/db/model.go b/pkg/common/db/model.go similarity index 98% rename from src/common/db/model.go rename to pkg/common/db/model.go index f34b4c305..a8a790576 100644 --- a/src/common/db/model.go +++ b/pkg/common/db/model.go @@ -1,7 +1,7 @@ package db import ( - "Open_IM/src/common/config" + "Open_IM/pkg/common/config" "github.com/garyburd/redigo/redis" "gopkg.in/mgo.v2" "time" diff --git a/src/common/db/mongoModel.go b/pkg/common/db/mongoModel.go similarity index 98% rename from src/common/db/mongoModel.go rename to pkg/common/db/mongoModel.go index ea532afba..f75843a4c 100644 --- a/src/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -2,8 +2,8 @@ package db import ( pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" "errors" "github.com/golang/protobuf/proto" "gopkg.in/mgo.v2/bson" diff --git a/src/common/db/mysql.go b/pkg/common/db/mysql.go similarity index 99% rename from src/common/db/mysql.go rename to pkg/common/db/mysql.go index a7a163686..05006ffab 100644 --- a/src/common/db/mysql.go +++ b/pkg/common/db/mysql.go @@ -1,8 +1,8 @@ package db import ( - "Open_IM/src/common/config" - "Open_IM/src/common/log" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" "fmt" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" diff --git a/src/common/db/mysql_model/im_mysql_model/friend_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go similarity index 98% rename from src/common/db/mysql_model/im_mysql_model/friend_model.go rename to pkg/common/db/mysql_model/im_mysql_model/friend_model.go index 5a1378465..ce029a0bb 100644 --- a/src/common/db/mysql_model/im_mysql_model/friend_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go @@ -1,7 +1,7 @@ package im_mysql_model import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" _ "github.com/jinzhu/gorm/dialects/mysql" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/friend_request_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go similarity index 98% rename from src/common/db/mysql_model/im_mysql_model/friend_request_model.go rename to pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go index 5125b62bd..1a7308cb9 100644 --- a/src/common/db/mysql_model/im_mysql_model/friend_request_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go @@ -1,7 +1,7 @@ package im_mysql_model import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/group_member_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go similarity index 99% rename from src/common/db/mysql_model/im_mysql_model/group_member_model.go rename to pkg/common/db/mysql_model/im_mysql_model/group_member_model.go index 19a3cd2c4..60ad86e85 100644 --- a/src/common/db/mysql_model/im_mysql_model/group_member_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go @@ -1,7 +1,7 @@ package im_mysql_model import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/group_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_model.go similarity index 99% rename from src/common/db/mysql_model/im_mysql_model/group_model.go rename to pkg/common/db/mysql_model/im_mysql_model/group_model.go index 971779cf2..436260f68 100644 --- a/src/common/db/mysql_model/im_mysql_model/group_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_model.go @@ -2,8 +2,8 @@ package im_mysql_model import ( "Open_IM/pkg/proto/group" - "Open_IM/src/common/db" - "Open_IM/src/common/log" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common/log" "errors" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/group_request_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go similarity index 98% rename from src/common/db/mysql_model/im_mysql_model/group_request_model.go rename to pkg/common/db/mysql_model/im_mysql_model/group_request_model.go index 6451ed863..da793d331 100644 --- a/src/common/db/mysql_model/im_mysql_model/group_request_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go @@ -1,7 +1,7 @@ package im_mysql_model import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/model_struct.go b/pkg/common/db/mysql_model/im_mysql_model/model_struct.go similarity index 100% rename from src/common/db/mysql_model/im_mysql_model/model_struct.go rename to pkg/common/db/mysql_model/im_mysql_model/model_struct.go diff --git a/src/common/db/mysql_model/im_mysql_model/user_black_list_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go similarity index 98% rename from src/common/db/mysql_model/im_mysql_model/user_black_list_model.go rename to pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go index 9d2e54f9d..907b0f223 100644 --- a/src/common/db/mysql_model/im_mysql_model/user_black_list_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go @@ -1,7 +1,7 @@ package im_mysql_model import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go similarity index 97% rename from src/common/db/mysql_model/im_mysql_model/user_model.go rename to pkg/common/db/mysql_model/im_mysql_model/user_model.go index 54f9df3d2..ad0430c3a 100644 --- a/src/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -1,10 +1,10 @@ package im_mysql_model import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db" pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/src/common/config" - "Open_IM/src/common/db" - "Open_IM/src/utils" + "Open_IM/pkg/utils" _ "github.com/jinzhu/gorm/dialects/mysql" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go similarity index 97% rename from src/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go rename to pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go index 5809dacba..73defd89d 100644 --- a/src/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go +++ b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go @@ -7,9 +7,9 @@ package im_mysql_msg_model import ( + "Open_IM/pkg/common/db" pbMsg "Open_IM/pkg/proto/chat" - "Open_IM/src/common/db" - "Open_IM/src/utils" + "Open_IM/pkg/utils" "database/sql" "time" ) diff --git a/src/common/db/mysql_model/im_mysql_msg_model/hash_code.go b/pkg/common/db/mysql_model/im_mysql_msg_model/hash_code.go similarity index 94% rename from src/common/db/mysql_model/im_mysql_msg_model/hash_code.go rename to pkg/common/db/mysql_model/im_mysql_msg_model/hash_code.go index b349e7787..a631462ce 100644 --- a/src/common/db/mysql_model/im_mysql_msg_model/hash_code.go +++ b/pkg/common/db/mysql_model/im_mysql_msg_model/hash_code.go @@ -1,8 +1,8 @@ package im_mysql_msg_model import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db" "hash/crc32" "strconv" ) diff --git a/src/common/db/mysql_model/im_mysql_msg_model/receive_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/receive_model.go similarity index 100% rename from src/common/db/mysql_model/im_mysql_msg_model/receive_model.go rename to pkg/common/db/mysql_model/im_mysql_msg_model/receive_model.go diff --git a/src/common/db/redisModel.go b/pkg/common/db/redisModel.go similarity index 98% rename from src/common/db/redisModel.go rename to pkg/common/db/redisModel.go index f86dbb638..7e7028b39 100644 --- a/src/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -1,7 +1,7 @@ package db import ( - log2 "Open_IM/src/common/log" + log2 "Open_IM/pkg/common/log" "github.com/garyburd/redigo/redis" ) diff --git a/src/common/http/http_client.go b/pkg/common/http/http_client.go similarity index 100% rename from src/common/http/http_client.go rename to pkg/common/http/http_client.go diff --git a/src/common/kafka/consumer.go b/pkg/common/kafka/consumer.go similarity index 100% rename from src/common/kafka/consumer.go rename to pkg/common/kafka/consumer.go diff --git a/src/common/kafka/consumer_group.go b/pkg/common/kafka/consumer_group.go similarity index 100% rename from src/common/kafka/consumer_group.go rename to pkg/common/kafka/consumer_group.go diff --git a/src/common/kafka/producer.go b/pkg/common/kafka/producer.go similarity index 97% rename from src/common/kafka/producer.go rename to pkg/common/kafka/producer.go index 2d9299b60..c82df975f 100644 --- a/src/common/kafka/producer.go +++ b/pkg/common/kafka/producer.go @@ -1,7 +1,7 @@ package kafka import ( - log2 "Open_IM/src/common/log" + log2 "Open_IM/pkg/common/log" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" ) diff --git a/src/common/multi_terminal_login/multi_terminal_login.go b/pkg/common/multi_terminal_login/multi_terminal_login.go similarity index 95% rename from src/common/multi_terminal_login/multi_terminal_login.go rename to pkg/common/multi_terminal_login/multi_terminal_login.go index 278dbd398..e65e473d4 100644 --- a/src/common/multi_terminal_login/multi_terminal_login.go +++ b/pkg/common/multi_terminal_login/multi_terminal_login.go @@ -4,10 +4,10 @@ import ( "Open_IM/internal/push/content_struct" "Open_IM/internal/push/logic" pbChat "Open_IM/pkg/proto/chat" - "Open_IM/src/common/config" - "Open_IM/src/common/constant" - "Open_IM/src/common/db" - "Open_IM/src/utils" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" + "Open_IM/pkg/common" ) func MultiTerminalLoginChecker(uid, token string, platformID int32) error { diff --git a/src/grpc-etcdv3/getcdv3/pool.go b/pkg/grpc-etcdv3/getcdv3/pool.go similarity index 100% rename from src/grpc-etcdv3/getcdv3/pool.go rename to pkg/grpc-etcdv3/getcdv3/pool.go diff --git a/src/grpc-etcdv3/getcdv3/register.go b/pkg/grpc-etcdv3/getcdv3/register.go similarity index 100% rename from src/grpc-etcdv3/getcdv3/register.go rename to pkg/grpc-etcdv3/getcdv3/register.go diff --git a/src/grpc-etcdv3/getcdv3/resolver.go b/pkg/grpc-etcdv3/getcdv3/resolver.go similarity index 100% rename from src/grpc-etcdv3/getcdv3/resolver.go rename to pkg/grpc-etcdv3/getcdv3/resolver.go diff --git a/src/utils/cors_middleware.go b/pkg/utils/cors_middleware.go similarity index 100% rename from src/utils/cors_middleware.go rename to pkg/utils/cors_middleware.go diff --git a/src/utils/file.go b/pkg/utils/file.go similarity index 100% rename from src/utils/file.go rename to pkg/utils/file.go diff --git a/src/utils/get_server_ip.go b/pkg/utils/get_server_ip.go similarity index 96% rename from src/utils/get_server_ip.go rename to pkg/utils/get_server_ip.go index 21092ffa1..f5978b79c 100644 --- a/src/utils/get_server_ip.go +++ b/pkg/utils/get_server_ip.go @@ -1,7 +1,7 @@ package utils import ( - "Open_IM/src/common/config" + "Open_IM/pkg/common/config" "net" ) diff --git a/src/utils/image.go b/pkg/utils/image.go similarity index 100% rename from src/utils/image.go rename to pkg/utils/image.go diff --git a/src/utils/jwt_token.go b/pkg/utils/jwt_token.go similarity index 99% rename from src/utils/jwt_token.go rename to pkg/utils/jwt_token.go index 264da2483..604ee2400 100644 --- a/src/utils/jwt_token.go +++ b/pkg/utils/jwt_token.go @@ -1,8 +1,8 @@ package utils import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db" "errors" "github.com/dgrijalva/jwt-go" "time" diff --git a/src/utils/map.go b/pkg/utils/map.go similarity index 100% rename from src/utils/map.go rename to pkg/utils/map.go diff --git a/src/utils/md5.go b/pkg/utils/md5.go similarity index 100% rename from src/utils/md5.go rename to pkg/utils/md5.go diff --git a/src/utils/platform_number_id_to_name.go b/pkg/utils/platform_number_id_to_name.go similarity index 100% rename from src/utils/platform_number_id_to_name.go rename to pkg/utils/platform_number_id_to_name.go diff --git a/src/utils/strings.go b/pkg/utils/strings.go similarity index 100% rename from src/utils/strings.go rename to pkg/utils/strings.go diff --git a/src/utils/time_format.go b/pkg/utils/time_format.go similarity index 100% rename from src/utils/time_format.go rename to pkg/utils/time_format.go diff --git a/src/common/log/es_hk.go b/src/common/log/es_hk.go deleted file mode 100644 index c54130968..000000000 --- a/src/common/log/es_hk.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -** description("将日志发送到elasticsearch的hook"). -** copyright('tuoyun,www.tuoyun.net'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/3/26 17:05). - */ -package log - -import ( - "Open_IM/src/common/config" - "context" - "fmt" - elasticV7 "github.com/olivere/elastic/v7" - "github.com/sirupsen/logrus" - "log" - "os" - "strings" - "time" -) - -//esHook 自定义的ES hook -type esHook struct { - moduleName string - client *elasticV7.Client -} - -//newEsHook 初始化 -func newEsHook(moduleName string) *esHook { - //https://github.com/sohlich/elogrus - //client, err := elastic.NewClient(elastic.SetURL("http://localhost:9200")) - //if err != nil { - // log.Panic(err) - //} - //hook, err := elogrus.NewAsyncElasticHook(client, "localhost", logrus.DebugLevel, "mylog") - //if err != nil { - // log.Panic(err) - //} - es, err := elasticV7.NewClient( - elasticV7.SetURL(config.Config.Log.ElasticSearchAddr...), - elasticV7.SetBasicAuth(config.Config.Log.ElasticSearchUser, config.Config.Log.ElasticSearchPassword), - elasticV7.SetSniff(false), - elasticV7.SetHealthcheckInterval(60*time.Second), - elasticV7.SetErrorLog(log.New(os.Stderr, "ES:", log.LstdFlags)), - ) - - if err != nil { - log.Fatal("failed to create Elastic V7 Client: ", err) - } - - //info, code, err := es.Ping(logConfig.ElasticSearch.EsAddr[0]).Do(context.Background()) - //if err != nil { - // panic(err) - //} - //fmt.Printf("Elasticsearch returned with code %d and version %s\n", code, info.Version.Number) - // - //esversion, err := es.ElasticsearchVersion(logConfig.ElasticSearch.EsAddr[0]) - //if err != nil { - // panic(err) - //} - //fmt.Printf("Elasticsearch version %s\n", esversion) - return &esHook{client: es, moduleName: moduleName} -} - -//Fire log hook interface 方法 -func (hook *esHook) Fire(entry *logrus.Entry) error { - doc := newEsLog(entry) - go hook.sendEs(doc) - return nil -} - -//Levels log hook interface 方法,此hook影响的日志 -func (hook *esHook) Levels() []logrus.Level { - return logrus.AllLevels -} - -//sendEs 异步发送日志到es -func (hook *esHook) sendEs(doc appLogDocModel) { - defer func() { - if r := recover(); r != nil { - fmt.Println("send entry to es failed: ", r) - } - }() - _, err := hook.client.Index().Index(hook.moduleName).Type(doc.indexName()).BodyJson(doc).Do(context.Background()) - if err != nil { - log.Println(err) - } - -} - -//appLogDocModel es model -type appLogDocModel map[string]interface{} - -func newEsLog(e *logrus.Entry) appLogDocModel { - ins := make(map[string]interface{}) - ins["level"] = strings.ToUpper(e.Level.String()) - ins["time"] = e.Time.Format("2006-01-02 15:04:05") - for kk, vv := range e.Data { - ins[kk] = vv - } - ins["tipInfo"] = e.Message - - return ins -} - -// indexName es index name 时间分割 -func (m *appLogDocModel) indexName() string { - return time.Now().Format("2006-01-02") -} diff --git a/src/common/log/file_line_hk.go b/src/common/log/file_line_hk.go deleted file mode 100644 index e6b690eb7..000000000 --- a/src/common/log/file_line_hk.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -** description("得到调用文件名字和行号的hook"). -** copyright('tuoyun,www.tuoyun.net'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/3/16 11:26). - */ -package log - -import ( - "fmt" - "github.com/sirupsen/logrus" - "runtime" - "strings" -) - -type fileHook struct{} - -func newFileHook() *fileHook { - return &fileHook{} -} - -func (f *fileHook) Levels() []logrus.Level { - return logrus.AllLevels -} - -func (f *fileHook) Fire(entry *logrus.Entry) error { - entry.Data["FilePath"] = findCaller(5) - return nil -} - -func findCaller(skip int) string { - file := "" - line := 0 - for i := 0; i < 10; i++ { - file, line = getCaller(skip + i) - if !strings.HasPrefix(file, "log") { - break - } - } - return fmt.Sprintf("%s:%d", file, line) -} - -func getCaller(skip int) (string, int) { - _, file, line, ok := runtime.Caller(skip) - if !ok { - return "", 0 - } - - n := 0 - for i := len(file) - 1; i > 0; i-- { - if file[i] == '/' { - n++ - if n >= 2 { - file = file[i+1:] - break - } - } - } - return file, line -} diff --git a/src/common/log/logrus.go b/src/common/log/logrus.go deleted file mode 100644 index 48c781c68..000000000 --- a/src/common/log/logrus.go +++ /dev/null @@ -1,167 +0,0 @@ -package log - -import ( - "Open_IM/src/common/config" - "fmt" - nested "github.com/antonfisher/nested-logrus-formatter" - rotatelogs "github.com/lestrrat-go/file-rotatelogs" - "github.com/rifflock/lfshook" - "github.com/sirupsen/logrus" - "os" - "time" -) - -var logger *Logger - -type Logger struct { - *logrus.Logger - Pid int -} - -func init() { - logger = loggerInit("") - -} -func NewPrivateLog(moduleName string) { - logger = loggerInit(moduleName) -} - -func loggerInit(moduleName string) *Logger { - var logger = logrus.New() - //All logs will be printed - logger.SetLevel(logrus.TraceLevel) - //Log Style Setting - logger.SetFormatter(&nested.Formatter{ - TimestampFormat: "2006-01-02 15:04:05.000", - HideKeys: false, - FieldsOrder: []string{"PID"}, - }) - //File name and line number display hook - logger.AddHook(newFileHook()) - - //Send logs to elasticsearch hook - if config.Config.Log.ElasticSearchSwitch == true { - logger.AddHook(newEsHook(moduleName)) - } - //Log file segmentation hook - hook := NewLfsHook(time.Duration(config.Config.Log.RotationTime)*time.Hour, config.Config.Log.RemainRotationCount, moduleName) - logger.AddHook(hook) - return &Logger{ - logger, - os.Getpid(), - } -} -func NewLfsHook(rotationTime time.Duration, maxRemainNum uint, moduleName string) logrus.Hook { - lfsHook := lfshook.NewHook(lfshook.WriterMap{ - logrus.DebugLevel: initRotateLogs(rotationTime, maxRemainNum, "debug", moduleName), - logrus.InfoLevel: initRotateLogs(rotationTime, maxRemainNum, "info", moduleName), - logrus.WarnLevel: initRotateLogs(rotationTime, maxRemainNum, "warn", moduleName), - logrus.ErrorLevel: initRotateLogs(rotationTime, maxRemainNum, "error", moduleName), - }, &nested.Formatter{ - TimestampFormat: "2006-01-02 15:04:05.000", - HideKeys: false, - FieldsOrder: []string{"PID"}, - }) - return lfsHook -} -func initRotateLogs(rotationTime time.Duration, maxRemainNum uint, level string, moduleName string) *rotatelogs.RotateLogs { - writer, err := rotatelogs.New( - config.Config.Log.StorageLocation+moduleName+"/"+level+"."+"%Y-%m-%d_%H-%M-%S", - rotatelogs.WithRotationTime(rotationTime), - rotatelogs.WithRotationCount(maxRemainNum), - ) - if err != nil { - panic(err) - } else { - return writer - } -} - -func Info(token, OperationID, format string, args ...interface{}) { - if token == "" && OperationID == "" { - logger.WithFields(logrus.Fields{}).Infof(format, args...) - } else { - logger.WithFields(logrus.Fields{ - "token": token, - "OperationID": OperationID, - }).Infof(format, args...) - } -} - -func Error(token, OperationID, format string, args ...interface{}) { - if token == "" && OperationID == "" { - logger.WithFields(logrus.Fields{}).Errorf(format, args...) - } else { - logger.WithFields(logrus.Fields{ - "token": token, - "OperationID": OperationID, - }).Errorf(format, args...) - } -} - -func Debug(token, OperationID, format string, args ...interface{}) { - if token == "" && OperationID == "" { - logger.WithFields(logrus.Fields{}).Debugf(format, args...) - } else { - logger.WithFields(logrus.Fields{ - "token": token, - "OperationID": OperationID, - }).Debugf(format, args...) - } -} - -func Warning(token, OperationID, format string, args ...interface{}) { - if token == "" && OperationID == "" { - logger.WithFields(logrus.Fields{}).Warningf(format, args...) - } else { - logger.WithFields(logrus.Fields{ - "token": token, - "OperationID": OperationID, - }).Warningf(format, args...) - } -} - -func InfoByArgs(format string, args ...interface{}) { - logger.WithFields(logrus.Fields{}).Infof(format, args) -} - -func ErrorByArgs(format string, args ...interface{}) { - logger.WithFields(logrus.Fields{}).Errorf(format, args...) -} - -//Print log information in k, v format, -//kv is best to appear in pairs. tipInfo is the log prompt information for printing, -//and kv is the key and value for printing. -func InfoByKv(tipInfo, OperationID string, args ...interface{}) { - fields := make(logrus.Fields) - argsHandle(OperationID, fields, args) - logger.WithFields(fields).Info(tipInfo) -} -func ErrorByKv(tipInfo, OperationID string, args ...interface{}) { - fields := make(logrus.Fields) - argsHandle(OperationID, fields, args) - logger.WithFields(fields).Error(tipInfo) -} -func DebugByKv(tipInfo, OperationID string, args ...interface{}) { - fields := make(logrus.Fields) - argsHandle(OperationID, fields, args) - logger.WithFields(fields).Debug(tipInfo) -} -func WarnByKv(tipInfo, OperationID string, args ...interface{}) { - fields := make(logrus.Fields) - argsHandle(OperationID, fields, args) - logger.WithFields(fields).Warn(tipInfo) -} - -//internal method -func argsHandle(OperationID string, fields logrus.Fields, args []interface{}) { - for i := 0; i < len(args); i += 2 { - if i+1 < len(args) { - fields[fmt.Sprintf("%v", args[i])] = args[i+1] - } else { - fields[fmt.Sprintf("%v", args[i])] = "" - } - } - fields["operationID"] = OperationID - fields["PID"] = logger.Pid -} diff --git a/src/common/log/time_format.go b/src/common/log/time_format.go deleted file mode 100644 index 4ae1c56ef..000000000 --- a/src/common/log/time_format.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -** description(""). -** copyright('tuoyun,www.tuoyun.net'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/2/22 11:52). - */ -package log - -import ( - "strconv" - "time" -) - -const ( - TimeOffset = 8 * 3600 //8个小时的偏移量 - HalfOffset = 12 * 3600 //半天的小时偏移量 -) - -//获取当前的时间戳 -func GetCurrentTimestamp() int64 { - return time.Now().Unix() -} - -//获取当天0点的时间戳 -func GetCurDayZeroTimestamp() int64 { - timeStr := time.Now().Format("2006-01-02") - t, _ := time.Parse("2006-01-02", timeStr) - return t.Unix() - TimeOffset -} - -//获取当天12点的时间戳 -func GetCurDayHalfTimestamp() int64 { - return GetCurDayZeroTimestamp() + HalfOffset - -} - -//获取当天0点格式化时间,格式为"2006-01-02_00-00-00" -func GetCurDayZeroTimeFormat() string { - return time.Unix(GetCurDayZeroTimestamp(), 0).Format("2006-01-02_15-04-05") -} - -//获取当天12点格式化时间,格式为"2006-01-02_12-00-00" -func GetCurDayHalfTimeFormat() string { - return time.Unix(GetCurDayZeroTimestamp()+HalfOffset, 0).Format("2006-01-02_15-04-05") -} -func GetTimeStampByFormat(datetime string) string { - timeLayout := "2006-01-02 15:04:05" //转化所需模板 - loc, _ := time.LoadLocation("Local") //获取时区 - tmp, _ := time.ParseInLocation(timeLayout, datetime, loc) - timestamp := tmp.Unix() //转化为时间戳 类型是int64 - return strconv.FormatInt(timestamp, 10) -} - -func TimeStringFormatTimeUnix(timeFormat string, timeSrc string) int64 { - tm, _ := time.Parse(timeFormat, timeSrc) - return tm.Unix() -} diff --git a/src/timed_task/open_im_timed_task.go b/src/timed_task/open_im_timed_task.go index f6cd87a67..1119ce577 100644 --- a/src/timed_task/open_im_timed_task.go +++ b/src/timed_task/open_im_timed_task.go @@ -1,8 +1,8 @@ package main import ( - "Open_IM/src/common/config" - "Open_IM/src/common/db" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/db" "fmt" "time" ) diff --git a/src/timed_task/timed_task/timed_task.go b/src/timed_task/timed_task/timed_task.go index a2626dd6e..bda907ea7 100644 --- a/src/timed_task/timed_task/timed_task.go +++ b/src/timed_task/timed_task/timed_task.go @@ -1,7 +1,7 @@ package timed_task import ( - "Open_IM/src/common/db" + "Open_IM/pkg/common/db" "time" )