feat: add openim docker

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong (cubxxw) 2023-12-14 11:39:54 +08:00
parent a42a44e0a3
commit ad47590e13
36 changed files with 113 additions and 77 deletions

View File

@ -27,6 +27,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10" "github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"

View File

@ -16,9 +16,10 @@ package push
import ( import (
"context" "context"
"github.com/OpenIMSDK/tools/utils"
"sync" "sync"
"github.com/OpenIMSDK/tools/utils"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/constant"

View File

@ -16,8 +16,10 @@ package friend
import ( import (
"context" "context"
pbfriend "github.com/OpenIMSDK/protocol/friend" pbfriend "github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/http" "github.com/openimsdk/open-im-server/v3/pkg/common/http"

View File

@ -16,6 +16,7 @@ package friend
import ( import (
"context" "context"
"github.com/OpenIMSDK/tools/tx" "github.com/OpenIMSDK/tools/tx"
"github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/protocol/sdkws"

View File

@ -16,9 +16,10 @@ package group
import ( import (
"context" "context"
"github.com/OpenIMSDK/tools/log"
"time" "time"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/group" "github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/wrapperspb" "github.com/OpenIMSDK/protocol/wrapperspb"

View File

@ -17,13 +17,14 @@ package group
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
"math/big" "math/big"
"math/rand" "math/rand"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
pbconversation "github.com/OpenIMSDK/protocol/conversation" pbconversation "github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/protocol/wrapperspb" "github.com/OpenIMSDK/protocol/wrapperspb"
"github.com/OpenIMSDK/tools/tx" "github.com/OpenIMSDK/tools/tx"

View File

@ -16,16 +16,18 @@ package msg
import ( import (
"context" "context"
utils2 "github.com/OpenIMSDK/tools/utils" utils2 "github.com/OpenIMSDK/tools/utils"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
"github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msg" "github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/log"
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
) )
func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (resp *msg.GetConversationsHasReadAndMaxSeqResp, err error) { func (m *msgServer) GetConversationsHasReadAndMaxSeq(ctx context.Context, req *msg.GetConversationsHasReadAndMaxSeqReq) (resp *msg.GetConversationsHasReadAndMaxSeqResp, err error) {

View File

@ -16,6 +16,7 @@ package msg
import ( import (
"context" "context"
"github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/protocol/sdkws"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
@ -24,6 +25,7 @@ import (
"github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext" "github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"
cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"

View File

@ -16,6 +16,7 @@ package user
import ( import (
"context" "context"
pbuser "github.com/OpenIMSDK/protocol/user" pbuser "github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"

View File

@ -37,7 +37,7 @@ type SoundElem struct {
Duration int64 `mapstructure:"duration" validate:"required,min=1"` Duration int64 `mapstructure:"duration" validate:"required,min=1"`
} }
type VideoElem struct { type VideoElem struct {
VideoPath string `mapstructure:"videoPath" ` VideoPath string `mapstructure:"videoPath"`
VideoUUID string `mapstructure:"videoUUID"` VideoUUID string `mapstructure:"videoUUID"`
VideoURL string `mapstructure:"videoUrl" validate:"required"` VideoURL string `mapstructure:"videoUrl" validate:"required"`
VideoType string `mapstructure:"videoType" validate:"required"` VideoType string `mapstructure:"videoType" validate:"required"`
@ -51,7 +51,7 @@ type VideoElem struct {
SnapshotHeight int32 `mapstructure:"snapshotHeight" validate:"required"` SnapshotHeight int32 `mapstructure:"snapshotHeight" validate:"required"`
} }
type FileElem struct { type FileElem struct {
FilePath string `mapstructure:"filePath" ` FilePath string `mapstructure:"filePath"`
UUID string `mapstructure:"uuid"` UUID string `mapstructure:"uuid"`
SourceURL string `mapstructure:"sourceUrl" validate:"required"` SourceURL string `mapstructure:"sourceUrl" validate:"required"`
FileName string `mapstructure:"fileName" validate:"required"` FileName string `mapstructure:"fileName" validate:"required"`
@ -63,7 +63,7 @@ type AtElem struct {
IsAtSelf bool `mapstructure:"isAtSelf"` IsAtSelf bool `mapstructure:"isAtSelf"`
} }
type LocationElem struct { type LocationElem struct {
Description string `mapstructure:"description" ` Description string `mapstructure:"description"`
Longitude float64 `mapstructure:"longitude" validate:"required"` Longitude float64 `mapstructure:"longitude" validate:"required"`
Latitude float64 `mapstructure:"latitude" validate:"required"` Latitude float64 `mapstructure:"latitude" validate:"required"`
} }

View File

@ -16,6 +16,7 @@ package config
import ( import (
"bytes" "bytes"
"github.com/OpenIMSDK/tools/discoveryregistry" "github.com/OpenIMSDK/tools/discoveryregistry"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )

View File

@ -35,7 +35,7 @@ const (
DefaultFolderPath = "../config/" DefaultFolderPath = "../config/"
) )
// return absolude path join ../config/, this is k8s container config path // return absolude path join ../config/, this is k8s container config path.
func GetDefaultConfigPath() string { func GetDefaultConfigPath() string {
b, err := filepath.Abs(os.Args[0]) b, err := filepath.Abs(os.Args[0])
if err != nil { if err != nil {
@ -45,7 +45,7 @@ func GetDefaultConfigPath() string {
return filepath.Join(filepath.Dir(b), "../config/") return filepath.Join(filepath.Dir(b), "../config/")
} }
// getProjectRoot returns the absolute path of the project root directory // getProjectRoot returns the absolute path of the project root directory.
func GetProjectRoot() string { func GetProjectRoot() string {
b, _ := filepath.Abs(os.Args[0]) b, _ := filepath.Abs(os.Args[0])

View File

@ -15,9 +15,10 @@
package convert package convert
import ( import (
"github.com/OpenIMSDK/protocol/sdkws"
"time" "time"
"github.com/OpenIMSDK/protocol/sdkws"
relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
) )

View File

@ -39,7 +39,7 @@ const (
groupMemberIDsKey = "GROUP_MEMBER_IDS:" groupMemberIDsKey = "GROUP_MEMBER_IDS:"
groupMembersHashKey = "GROUP_MEMBERS_HASH2:" groupMembersHashKey = "GROUP_MEMBERS_HASH2:"
groupMemberInfoKey = "GROUP_MEMBER_INFO:" groupMemberInfoKey = "GROUP_MEMBER_INFO:"
//groupOwnerInfoKey = "GROUP_OWNER_INFO:" //groupOwnerInfoKey = "GROUP_OWNER_INFO:".
joinedGroupsKey = "JOIN_GROUPS_KEY:" joinedGroupsKey = "JOIN_GROUPS_KEY:"
groupMemberNumKey = "GROUP_MEMBER_NUM_CACHE:" groupMemberNumKey = "GROUP_MEMBER_NUM_CACHE:"
groupRoleLevelMemberIDsKey = "GROUP_ROLE_LEVEL_MEMBER_IDS:" groupRoleLevelMemberIDsKey = "GROUP_ROLE_LEVEL_MEMBER_IDS:"

View File

@ -77,7 +77,7 @@ func (cli *K8sDR) CloseConn(conn *grpc.ClientConn) {
conn.Close() conn.Close()
} }
// do not use this method for call rpc // do not use this method for call rpc.
func (cli *K8sDR) GetClientLocalConns() map[string][]*grpc.ClientConn { func (cli *K8sDR) GetClientLocalConns() map[string][]*grpc.ClientConn {
fmt.Println("should not call this function!!!!!!!!!!!!!!!!!!!!!!!!!") fmt.Println("should not call this function!!!!!!!!!!!!!!!!!!!!!!!!!")

View File

@ -8,6 +8,7 @@ import (
"github.com/OpenIMSDK/tools/discoveryregistry" "github.com/OpenIMSDK/tools/discoveryregistry"
openkeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper" openkeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/log"
"github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/config"
) )

View File

@ -12,8 +12,9 @@ import (
"github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext" "github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
) )
const ( const (

View File

@ -4,7 +4,7 @@ import ginProm "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
/* /*
labels := prometheus.Labels{"label_one": "any", "label_two": "value"} labels := prometheus.Labels{"label_one": "any", "label_two": "value"}
ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc() ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc().
*/ */
var ( var (
ApiCustomCnt = &ginProm.Metric{ ApiCustomCnt = &ginProm.Metric{

View File

@ -15,7 +15,7 @@ package version
// When releasing a new Kubernetes version, this file is updated by // When releasing a new Kubernetes version, this file is updated by
// build/mark_new_version.sh to reflect the new version, and then a // build/mark_new_version.sh to reflect the new version, and then a
// git annotated tag (using format vX.Y where X == Major version and Y // git annotated tag (using format vX.Y where X == Major version and Y
// == Minor version) is created to point to the commit that updates // == Minor version) is created to point to the commit that updates.
var ( var (
// TODO: Deprecate gitMajor and gitMinor, use only gitVersion // TODO: Deprecate gitMajor and gitMinor, use only gitVersion
// instead. First step in deprecation, keep the fields but make // instead. First step in deprecation, keep the fields but make

View File

@ -25,7 +25,7 @@ func Get() Info {
} }
} }
// GetClientVersion returns the git version of the OpenIM client repository // GetClientVersion returns the git version of the OpenIM client repository.
func GetClientVersion() (*OpenIMClientVersion, error) { func GetClientVersion() (*OpenIMClientVersion, error) {
clientVersion, err := getClientVersion() clientVersion, err := getClientVersion()
if err != nil { if err != nil {
@ -52,7 +52,7 @@ func getClientVersion() (string, error) {
return ref.Hash().String(), nil return ref.Hash().String(), nil
} }
// GetSingleVersion returns single version of sealer // GetSingleVersion returns single version of sealer.
func GetSingleVersion() string { func GetSingleVersion() string {
return gitVersion return gitVersion
} }

View File

@ -9,7 +9,7 @@ import (
"net/http" "net/http"
) )
// API endpoints and other constants // API endpoints and other constants.
const ( const (
APIHost = "http://127.0.0.1:10002" APIHost = "http://127.0.0.1:10002"
UserTokenURL = APIHost + "/auth/user_token" UserTokenURL = APIHost + "/auth/user_token"
@ -18,27 +18,27 @@ const (
OperationID = "1646445464564" OperationID = "1646445464564"
) )
// UserTokenRequest represents a request to get a user token // UserTokenRequest represents a request to get a user token.
type UserTokenRequest struct { type UserTokenRequest struct {
Secret string `json:"secret"` Secret string `json:"secret"`
PlatformID int `json:"platformID"` PlatformID int `json:"platformID"`
UserID string `json:"userID"` UserID string `json:"userID"`
} }
// UserTokenResponse represents a response containing a user token // UserTokenResponse represents a response containing a user token.
type UserTokenResponse struct { type UserTokenResponse struct {
Token string `json:"token"` Token string `json:"token"`
ErrCode int `json:"errCode"` ErrCode int `json:"errCode"`
} }
// User represents user data for registration // User represents user data for registration.
type User struct { type User struct {
UserID string `json:"userID"` UserID string `json:"userID"`
Nickname string `json:"nickname"` Nickname string `json:"nickname"`
FaceURL string `json:"faceURL"` FaceURL string `json:"faceURL"`
} }
// UserRegisterRequest represents a request to register a user // UserRegisterRequest represents a request to register a user.
type UserRegisterRequest struct { type UserRegisterRequest struct {
Secret string `json:"secret"` Secret string `json:"secret"`
Users []User `json:"users"` Users []User `json:"users"`
@ -58,7 +58,7 @@ func main() {
} }
} }
// GetUserToken requests a user token from the API // GetUserToken requests a user token from the API.
func GetUserToken(userID string) (string, error) { func GetUserToken(userID string) (string, error) {
reqBody := UserTokenRequest{ reqBody := UserTokenRequest{
Secret: SecretKey, Secret: SecretKey,
@ -88,7 +88,7 @@ func GetUserToken(userID string) (string, error) {
return tokenResp.Token, nil return tokenResp.Token, nil
} }
// RegisterUser registers a new user using the API // RegisterUser registers a new user using the API.
func RegisterUser(token, userID, nickname, faceURL string) error { func RegisterUser(token, userID, nickname, faceURL string) error {
user := User{ user := User{
UserID: userID, UserID: userID,

View File

@ -7,18 +7,18 @@ import (
"github.com/openimsdk/open-im-server/v3/test/e2e/framework/config" "github.com/openimsdk/open-im-server/v3/test/e2e/framework/config"
) )
// UserInfoRequest represents a request to get or update user information // UserInfoRequest represents a request to get or update user information.
type UserInfoRequest struct { type UserInfoRequest struct {
UserIDs []string `json:"userIDs,omitempty"` UserIDs []string `json:"userIDs,omitempty"`
UserInfo *gettoken.User `json:"userInfo,omitempty"` UserInfo *gettoken.User `json:"userInfo,omitempty"`
} }
// GetUsersOnlineStatusRequest represents a request to get users' online status // GetUsersOnlineStatusRequest represents a request to get users' online status.
type GetUsersOnlineStatusRequest struct { type GetUsersOnlineStatusRequest struct {
UserIDs []string `json:"userIDs"` UserIDs []string `json:"userIDs"`
} }
// GetUsersInfo retrieves detailed information for a list of user IDs // GetUsersInfo retrieves detailed information for a list of user IDs.
func GetUsersInfo(token string, userIDs []string) error { func GetUsersInfo(token string, userIDs []string) error {
url := fmt.Sprintf("http://%s:%s/user/get_users_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/user/get_users_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
@ -29,7 +29,7 @@ func GetUsersInfo(token string, userIDs []string) error {
return sendPostRequestWithToken(url, token, requestBody) return sendPostRequestWithToken(url, token, requestBody)
} }
// UpdateUserInfo updates the information for a user // UpdateUserInfo updates the information for a user.
func UpdateUserInfo(token, userID, nickname, faceURL string) error { func UpdateUserInfo(token, userID, nickname, faceURL string) error {
url := fmt.Sprintf("http://%s:%s/user/update_user_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/user/update_user_info", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
@ -44,7 +44,7 @@ func UpdateUserInfo(token, userID, nickname, faceURL string) error {
return sendPostRequestWithToken(url, token, requestBody) return sendPostRequestWithToken(url, token, requestBody)
} }
// GetUsersOnlineStatus retrieves the online status for a list of user IDs // GetUsersOnlineStatus retrieves the online status for a list of user IDs.
func GetUsersOnlineStatus(token string, userIDs []string) error { func GetUsersOnlineStatus(token string, userIDs []string) error {
url := fmt.Sprintf("http://%s:%s/user/get_users_online_status", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/user/get_users_online_status", config.LoadConfig().APIHost, config.LoadConfig().APIPort)

View File

@ -11,29 +11,29 @@ import (
"github.com/openimsdk/open-im-server/v3/test/e2e/framework/config" "github.com/openimsdk/open-im-server/v3/test/e2e/framework/config"
) )
// ForceLogoutRequest represents a request to force a user logout // ForceLogoutRequest represents a request to force a user logout.
type ForceLogoutRequest struct { type ForceLogoutRequest struct {
PlatformID int `json:"platformID"` PlatformID int `json:"platformID"`
UserID string `json:"userID"` UserID string `json:"userID"`
} }
// CheckUserAccountRequest represents a request to check a user account // CheckUserAccountRequest represents a request to check a user account.
type CheckUserAccountRequest struct { type CheckUserAccountRequest struct {
CheckUserIDs []string `json:"checkUserIDs"` CheckUserIDs []string `json:"checkUserIDs"`
} }
// GetUsersRequest represents a request to get a list of users // GetUsersRequest represents a request to get a list of users.
type GetUsersRequest struct { type GetUsersRequest struct {
Pagination Pagination `json:"pagination"` Pagination Pagination `json:"pagination"`
} }
// Pagination specifies the page number and number of items per page // Pagination specifies the page number and number of items per page.
type Pagination struct { type Pagination struct {
PageNumber int `json:"pageNumber"` PageNumber int `json:"pageNumber"`
ShowNumber int `json:"showNumber"` ShowNumber int `json:"showNumber"`
} }
// ForceLogout forces a user to log out // ForceLogout forces a user to log out.
func ForceLogout(token, userID string, platformID int) error { func ForceLogout(token, userID string, platformID int) error {
url := fmt.Sprintf("http://%s:%s/auth/force_logout", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/auth/force_logout", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
@ -45,7 +45,7 @@ func ForceLogout(token, userID string, platformID int) error {
return sendPostRequestWithToken(url, token, requestBody) return sendPostRequestWithToken(url, token, requestBody)
} }
// CheckUserAccount checks if the user accounts exist // CheckUserAccount checks if the user accounts exist.
func CheckUserAccount(token string, userIDs []string) error { func CheckUserAccount(token string, userIDs []string) error {
url := fmt.Sprintf("http://%s:%s/user/account_check", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/user/account_check", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
@ -56,7 +56,7 @@ func CheckUserAccount(token string, userIDs []string) error {
return sendPostRequestWithToken(url, token, requestBody) return sendPostRequestWithToken(url, token, requestBody)
} }
// GetUsers retrieves a list of users with pagination // GetUsers retrieves a list of users with pagination.
func GetUsers(token string, pageNumber, showNumber int) error { func GetUsers(token string, pageNumber, showNumber int) error {
url := fmt.Sprintf("http://%s:%s/user/account_check", config.LoadConfig().APIHost, config.LoadConfig().APIPort) url := fmt.Sprintf("http://%s:%s/user/account_check", config.LoadConfig().APIHost, config.LoadConfig().APIPort)
@ -70,7 +70,7 @@ func GetUsers(token string, pageNumber, showNumber int) error {
return sendPostRequestWithToken(url, token, requestBody) return sendPostRequestWithToken(url, token, requestBody)
} }
// sendPostRequestWithToken sends a POST request with a token in the header // sendPostRequestWithToken sends a POST request with a token in the header.
func sendPostRequestWithToken(url, token string, body any) error { func sendPostRequestWithToken(url, token string, body any) error {
reqBytes, err := json.Marshal(body) reqBytes, err := json.Marshal(body)
if err != nil { if err != nil {

View File

@ -10,7 +10,7 @@ import (
) )
var ( var (
// The default template version // The default template version.
defaultTemplateVersion = "v1.3.0" defaultTemplateVersion = "v1.3.0"
) )
@ -84,7 +84,7 @@ func main() {
select {} select {}
} }
// getLatestVersion fetches the latest version number from a given URL // getLatestVersion fetches the latest version number from a given URL.
func getLatestVersion(url string) (string, error) { func getLatestVersion(url string) (string, error) {
resp, err := http.Get(url) resp, err := http.Get(url)
if err != nil { if err != nil {
@ -102,7 +102,7 @@ func getLatestVersion(url string) (string, error) {
return latestVersion, nil return latestVersion, nil
} }
// downloadAndExtract downloads a file from a URL and extracts it to a destination directory // downloadAndExtract downloads a file from a URL and extracts it to a destination directory.
func downloadAndExtract(url, destDir string) error { func downloadAndExtract(url, destDir string) error {
resp, err := http.Get(url) resp, err := http.Get(url)
if err != nil { if err != nil {
@ -141,7 +141,7 @@ func downloadAndExtract(url, destDir string) error {
return cmd.Run() return cmd.Run()
} }
// startProcess starts a process and prints any errors encountered // startProcess starts a process and prints any errors encountered.
func startProcess(cmdPath string) { func startProcess(cmdPath string) {
cmd := exec.Command(cmdPath) cmd := exec.Command(cmdPath)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout

View File

@ -1,11 +1,12 @@
package pkg package pkg
import ( import (
"time"
mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3" mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
mongoModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table" mongoModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
mysqlModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql" mysqlModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql"
"time"
) )
type convert struct{} type convert struct{}

View File

@ -2,13 +2,15 @@ package mgo
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/tools/mgoutil" "github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination" "github.com/OpenIMSDK/tools/pagination"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"time"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
) )
func NewMeeting(db *mongo.Database) (table.MeetingInterface, error) { func NewMeeting(db *mongo.Database) (table.MeetingInterface, error) {

View File

@ -2,14 +2,16 @@ package mgo
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/tools/mgoutil" "github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination" "github.com/OpenIMSDK/tools/pagination"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"time"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
) )
func NewMeetingInvitation(db *mongo.Database) (table.MeetingInvitationInterface, error) { func NewMeetingInvitation(db *mongo.Database) (table.MeetingInvitationInterface, error) {
@ -55,7 +57,12 @@ func (x *meetingInvitation) CreateMeetingInvitationInfo(ctx context.Context, roo
func (x *meetingInvitation) GetUserInvitedMeetingIDs(ctx context.Context, userID string) (meetingIDs []string, err error) { func (x *meetingInvitation) GetUserInvitedMeetingIDs(ctx context.Context, userID string) (meetingIDs []string, err error) {
fiveDaysAgo := time.Now().AddDate(0, 0, -5) fiveDaysAgo := time.Now().AddDate(0, 0, -5)
return mgoutil.Find[string](ctx, x.coll, bson.M{"user_id": userID, "create_time": bson.M{"$gte": fiveDaysAgo}}, options.Find().SetSort(bson.M{"create_time": -1}).SetProjection(bson.M{"_id": 0, "room_id": 1})) return mgoutil.Find[string](
ctx,
x.coll,
bson.M{"user_id": userID, "create_time": bson.M{"$gte": fiveDaysAgo}},
options.Find().SetSort(bson.M{"create_time": -1}).SetProjection(bson.M{"_id": 0, "room_id": 1}),
)
} }
func (x *meetingInvitation) Delete(ctx context.Context, roomIDs []string) error { func (x *meetingInvitation) Delete(ctx context.Context, roomIDs []string) error {

View File

@ -2,10 +2,12 @@ package mgo
import ( import (
"context" "context"
"github.com/OpenIMSDK/tools/mgoutil" "github.com/OpenIMSDK/tools/mgoutil"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
) )
func NewMeetingRecord(db *mongo.Database) (table.MeetingRecordInterface, error) { func NewMeetingRecord(db *mongo.Database) (table.MeetingRecordInterface, error) {

View File

@ -2,13 +2,15 @@ package mgo
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/tools/mgoutil" "github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination" "github.com/OpenIMSDK/tools/pagination"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"time"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
) )
func NewSignal(db *mongo.Database) (table.SignalInterface, error) { func NewSignal(db *mongo.Database) (table.SignalInterface, error) {

View File

@ -2,14 +2,16 @@ package mgo
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/tools/mgoutil" "github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination" "github.com/OpenIMSDK/tools/pagination"
"github.com/OpenIMSDK/tools/utils" "github.com/OpenIMSDK/tools/utils"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"time"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
) )
func NewSignalInvitation(db *mongo.Database) (table.SignalInvitationInterface, error) { func NewSignalInvitation(db *mongo.Database) (table.SignalInvitationInterface, error) {

View File

@ -2,8 +2,9 @@ package table
import ( import (
"context" "context"
"github.com/OpenIMSDK/tools/pagination"
"time" "time"
"github.com/OpenIMSDK/tools/pagination"
) )
type MeetingInfo struct { type MeetingInfo struct {

View File

@ -2,11 +2,12 @@ package table
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/pagination" "github.com/OpenIMSDK/tools/pagination"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"time"
) )
type SignalModel struct { type SignalModel struct {

View File

@ -4,12 +4,13 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"gopkg.in/yaml.v3"
"log" "log"
"os" "os"
"reflect" "reflect"
"strconv" "strconv"
"gopkg.in/yaml.v3"
"github.com/go-sql-driver/mysql" "github.com/go-sql-driver/mysql"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"

View File

@ -2,9 +2,10 @@ package main
import ( import (
"flag" "flag"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg"
"log" "log"
"os" "os"
"github.com/openimsdk/open-im-server/v3/tools/up35/pkg"
) )
func main() { func main() {