diff --git a/pkg/common/db/model.go b/pkg/common/db/model.go index 61912b670..8a43bdcba 100644 --- a/pkg/common/db/model.go +++ b/pkg/common/db/model.go @@ -2,18 +2,21 @@ package db import ( "Open_IM/pkg/common/config" - "go.mongodb.org/mongo-driver/x/bsonx" "strings" + "go.mongodb.org/mongo-driver/x/bsonx" + //"Open_IM/pkg/common/log" "Open_IM/pkg/utils" "fmt" + go_redis "github.com/go-redis/redis/v8" "go.mongodb.org/mongo-driver/mongo/options" - "gopkg.in/mgo.v2" "time" + "gopkg.in/mgo.v2" + "context" //"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" @@ -56,10 +59,10 @@ func init() { uri = config.Config.Mongo.DBUri } else { if config.Config.Mongo.DBPassword != "" && config.Config.Mongo.DBUserName != "" { - uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, config.Config.Mongo.DBAddress, + uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, config.Config.Mongo.DBAddress, config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) } else { - uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d", + uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", config.Config.Mongo.DBAddress, config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize) } diff --git a/script/win_build_all_service.cmd b/script/win_build_all_service.cmd new file mode 100644 index 000000000..9ec7313ae --- /dev/null +++ b/script/win_build_all_service.cmd @@ -0,0 +1,22 @@ +SET ROOT=%cd% +mkdir %ROOT%\..\bin\ +cd ..\cmd\open_im_api\ && go build -ldflags="-w -s" && move open_im_api.exe %ROOT%\..\bin\ +cd ..\..\cmd\open_im_cms_api\ && go build -ldflags="-w -s" && move open_im_cms_api.exe %ROOT%\..\bin\ +cd ..\..\cmd\open_im_demo\ && go build -ldflags="-w -s" && move open_im_demo.exe %ROOT%\..\bin\ +cd ..\..\cmd\open_im_msg_gateway\ && go build -ldflags="-w -s" && move open_im_msg_gateway.exe %ROOT%\..\bin\ +cd ..\..\cmd\open_im_msg_transfer\ && go build -ldflags="-w -s" && move open_im_msg_transfer.exe %ROOT%\..\bin\ +cd ..\..\cmd\open_im_push\ && go build -ldflags="-w -s" && move open_im_push.exe %ROOT%\..\bin\ +cd ..\..\cmd\rpc\open_im_admin_cms\&& go build -ldflags="-w -s" && move open_im_admin_cms.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_auth\&& go build -ldflags="-w -s" && move open_im_auth.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_cache\&& go build -ldflags="-w -s" && move open_im_cache.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_conversation\&& go build -ldflags="-w -s" && move open_im_conversation.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_friend\&& go build -ldflags="-w -s" && move open_im_friend.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_group\&& go build -ldflags="-w -s" && move open_im_group.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_message_cms\&& go build -ldflags="-w -s" && move open_im_message_cms.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_msg\&& go build -ldflags="-w -s" && move open_im_msg.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_office\&& go build -ldflags="-w -s" && move open_im_office.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_organization\&& go build -ldflags="-w -s" && move open_im_organization.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_statistics\&& go build -ldflags="-w -s" && move open_im_statistics.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\rpc\open_im_user\&& go build -ldflags="-w -s" && move open_im_user.exe %ROOT%\..\bin\ +cd ..\..\..\cmd\Open-IM-SDK-Core\ws_wrapper\cmd\&& go build -ldflags="-w -s" open_im_sdk_server.go && move open_im_sdk_server.exe %ROOT%\..\bin\ +cd %ROOT% \ No newline at end of file diff --git a/script/win_start_all_service.cmd b/script/win_start_all_service.cmd new file mode 100644 index 000000000..e7b1c819e --- /dev/null +++ b/script/win_start_all_service.cmd @@ -0,0 +1,22 @@ +SET ROOT=%cd% +cd %ROOT%\..\bin\ +start cmd /C .\open_im_api.exe -port 10002 +start cmd /C .\open_im_cms_api.exe -port 10006 +start cmd /C .\open_im_user.exe -port 10110 +start cmd /C .\open_im_friend.exe -port 10120 +start cmd /C .\open_im_group.exe -port 10150 +start cmd /C .\open_im_auth.exe -port 10160 +start cmd /C .\open_im_admin_cms.exe -port 10200 +start cmd /C .\open_im_message_cms.exe -port 10190 +start cmd /C .\open_im_statistics.exe -port 10180 +start cmd /C .\open_im_msg.exe -port 10130 +start cmd /C .\open_im_office.exe -port 10210 +start cmd /C .\open_im_organization.exe -port 10220 +start cmd /C .\open_im_conversation.exe -port 10230 +start cmd /C .\open_im_cache.exe -port 10240 +start cmd /C .\open_im_push.exe -port 10170 +start cmd /C .\open_im_msg_transfer.exe +start cmd /C .\open_im_sdk_server.exe -openIM_api_port 10002 -openIM_ws_port 10001 -sdk_ws_port 10003 -openIM_log_level 6 +start cmd /C .\open_im_msg_gateway.exe -rpc_port 10140 -ws_port 10001 +start cmd /C .\open_im_demo.exe -port 10004 +cd %ROOT% \ No newline at end of file