Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Dec 12, 2023
2 parents 297b326 + 3871eeb commit c8d43a6
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 41 deletions.
1 change: 1 addition & 0 deletions internal/api/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"

"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"

Expand Down
3 changes: 2 additions & 1 deletion internal/push/push_rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package push

import (
"context"
"github.com/OpenIMSDK/tools/utils"
"sync"

"github.com/OpenIMSDK/tools/utils"

"google.golang.org/grpc"

"github.com/OpenIMSDK/protocol/constant"
Expand Down
2 changes: 2 additions & 0 deletions internal/rpc/friend/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ package friend

import (
"context"

pbfriend "github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/utils"

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/http"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/friend/friend.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package friend

import (
"context"

"github.com/OpenIMSDK/tools/tx"

"github.com/OpenIMSDK/protocol/sdkws"
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/group/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package group

import (
"context"
"github.com/OpenIMSDK/tools/log"
"time"

"github.com/OpenIMSDK/tools/log"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/wrapperspb"
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/group/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ package group
import (
"context"
"fmt"
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
"math/big"
"math/rand"
"strconv"
"strings"
"time"

"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"

pbconversation "github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/protocol/wrapperspb"
"github.com/OpenIMSDK/tools/tx"
Expand Down
8 changes: 5 additions & 3 deletions internal/rpc/msg/as_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ package msg

import (
"context"

utils2 "github.com/OpenIMSDK/tools/utils"

"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/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"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) {
Expand Down Expand Up @@ -173,7 +175,7 @@ func (m *msgServer) MarkConversationAsRead(
m.conversationAndGetRecvID(conversation, req.UserID), seqs, hasReadSeq); err != nil {
return nil, err
}

} else if conversation.ConversationType == constant.SuperGroupChatType ||
conversation.ConversationType == constant.NotificationChatType {
if req.HasReadSeq > hasReadSeq {
Expand Down Expand Up @@ -222,4 +224,4 @@ func (m *msgServer) sendMarkAsReadNotification(
log.ZWarn(ctx, "send has read Receipt err", err)
}
return nil
}
}
2 changes: 2 additions & 0 deletions internal/rpc/msg/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package msg

import (
"context"

"github.com/OpenIMSDK/protocol/sdkws"
"google.golang.org/protobuf/proto"

Expand All @@ -24,6 +25,7 @@ import (
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"

cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"

"github.com/openimsdk/open-im-server/v3/pkg/common/config"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/user/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package user

import (
"context"

pbuser "github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/utils"

Expand Down
36 changes: 18 additions & 18 deletions pkg/apistruct/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ package apistruct

type PictureBaseInfo struct {
UUID string `mapstructure:"uuid"`
Type string `mapstructure:"type" validate:"required"`
Type string `mapstructure:"type" validate:"required"`
Size int64 `mapstructure:"size"`
Width int32 `mapstructure:"width" validate:"required"`
Width int32 `mapstructure:"width" validate:"required"`
Height int32 `mapstructure:"height" validate:"required"`
Url string `mapstructure:"url" validate:"required"`
Url string `mapstructure:"url" validate:"required"`
}

type PictureElem struct {
Expand All @@ -34,38 +34,38 @@ type SoundElem struct {
SoundPath string `mapstructure:"soundPath"`
SourceURL string `mapstructure:"sourceUrl" validate:"required"`
DataSize int64 `mapstructure:"dataSize"`
Duration int64 `mapstructure:"duration" validate:"required,min=1"`
Duration int64 `mapstructure:"duration" validate:"required,min=1"`
}
type VideoElem struct {
VideoPath string `mapstructure:"videoPath" `
VideoPath string `mapstructure:"videoPath"`
VideoUUID string `mapstructure:"videoUUID"`
VideoURL string `mapstructure:"videoUrl" validate:"required"`
VideoType string `mapstructure:"videoType" validate:"required"`
VideoSize int64 `mapstructure:"videoSize" validate:"required"`
Duration int64 `mapstructure:"duration" validate:"required"`
VideoURL string `mapstructure:"videoUrl" validate:"required"`
VideoType string `mapstructure:"videoType" validate:"required"`
VideoSize int64 `mapstructure:"videoSize" validate:"required"`
Duration int64 `mapstructure:"duration" validate:"required"`
SnapshotPath string `mapstructure:"snapshotPath"`
SnapshotUUID string `mapstructure:"snapshotUUID"`
SnapshotSize int64 `mapstructure:"snapshotSize"`
SnapshotURL string `mapstructure:"snapshotUrl" validate:"required"`
SnapshotWidth int32 `mapstructure:"snapshotWidth" validate:"required"`
SnapshotURL string `mapstructure:"snapshotUrl" validate:"required"`
SnapshotWidth int32 `mapstructure:"snapshotWidth" validate:"required"`
SnapshotHeight int32 `mapstructure:"snapshotHeight" validate:"required"`
}
type FileElem struct {
FilePath string `mapstructure:"filePath" `
FilePath string `mapstructure:"filePath"`
UUID string `mapstructure:"uuid"`
SourceURL string `mapstructure:"sourceUrl" validate:"required"`
FileName string `mapstructure:"fileName" validate:"required"`
FileSize int64 `mapstructure:"fileSize" validate:"required"`
FileName string `mapstructure:"fileName" validate:"required"`
FileSize int64 `mapstructure:"fileSize" validate:"required"`
}
type AtElem struct {
Text string `mapstructure:"text"`
AtUserList []string `mapstructure:"atUserList" validate:"required,max=1000"`
IsAtSelf bool `mapstructure:"isAtSelf"`
}
type LocationElem struct {
Description string `mapstructure:"description" `
Longitude float64 `mapstructure:"longitude" validate:"required"`
Latitude float64 `mapstructure:"latitude" validate:"required"`
Description string `mapstructure:"description"`
Longitude float64 `mapstructure:"longitude" validate:"required"`
Latitude float64 `mapstructure:"latitude" validate:"required"`
}
type CustomElem struct {
Data string `mapstructure:"data" validate:"required"`
Expand All @@ -87,7 +87,7 @@ type OANotificationElem struct {
NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"`
Text string `mapstructure:"text" json:"text" validate:"required"`
Url string `mapstructure:"url" json:"url"`
MixType int32 `mapstructure:"mixType" json:"mixType" validate:"required"`
MixType int32 `mapstructure:"mixType" json:"mixType" validate:"required"`
PictureElem *PictureElem `mapstructure:"pictureElem" json:"pictureElem"`
SoundElem *SoundElem `mapstructure:"soundElem" json:"soundElem"`
VideoElem *VideoElem `mapstructure:"videoElem" json:"videoElem"`
Expand Down
1 change: 1 addition & 0 deletions pkg/common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package config

import (
"bytes"

"github.com/OpenIMSDK/tools/discoveryregistry"
"gopkg.in/yaml.v3"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/common/convert/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
package convert

import (
"github.com/OpenIMSDK/protocol/sdkws"
"time"

"github.com/OpenIMSDK/protocol/sdkws"

relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
)

Expand Down
3 changes: 2 additions & 1 deletion tools/up35/pkg/convert.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package pkg

import (
"time"

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"
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"
"time"
)

type convert struct{}
Expand Down
6 changes: 4 additions & 2 deletions tools/up35/pkg/internal/rtc/mongo/mgo/meeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package mgo

import (
"context"
"time"

"github.com/OpenIMSDK/tools/mgoutil"
"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/mongo"
"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) {
Expand Down
13 changes: 10 additions & 3 deletions tools/up35/pkg/internal/rtc/mongo/mgo/meeting_invitation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package mgo

import (
"context"
"time"

"github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination"
"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/mongo"
"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) {
Expand Down Expand Up @@ -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) {
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 {
Expand Down
4 changes: 3 additions & 1 deletion tools/up35/pkg/internal/rtc/mongo/mgo/meeting_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package mgo

import (
"context"

"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/mongo"

"github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
)

func NewMeetingRecord(db *mongo.Database) (table.MeetingRecordInterface, error) {
Expand Down
6 changes: 4 additions & 2 deletions tools/up35/pkg/internal/rtc/mongo/mgo/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package mgo

import (
"context"
"time"

"github.com/OpenIMSDK/tools/mgoutil"
"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/mongo"
"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) {
Expand Down
6 changes: 4 additions & 2 deletions tools/up35/pkg/internal/rtc/mongo/mgo/signal_invitation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package mgo

import (
"context"
"time"

"github.com/OpenIMSDK/tools/mgoutil"
"github.com/OpenIMSDK/tools/pagination"
"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/mongo"
"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) {
Expand Down
3 changes: 2 additions & 1 deletion tools/up35/pkg/internal/rtc/mongo/table/meeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package table

import (
"context"
"github.com/OpenIMSDK/tools/pagination"
"time"

"github.com/OpenIMSDK/tools/pagination"
)

type MeetingInfo struct {
Expand Down
3 changes: 2 additions & 1 deletion tools/up35/pkg/internal/rtc/mongo/table/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package table

import (
"context"
"time"

"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/pagination"
"github.com/redis/go-redis/v9"
"go.mongodb.org/mongo-driver/mongo"
"time"
)

type SignalModel struct {
Expand Down
2 changes: 1 addition & 1 deletion tools/up35/pkg/internal/rtc/mysql/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type SignalModel struct {
SessionType int32 `gorm:"column:sesstion_type"`
InitiateTime time.Time `gorm:"column:initiate_time"`
EndTime time.Time `gorm:"column:end_time"`
FileURL string `gorm:"column:file_url" json:"-"`
FileURL string `gorm:"column:file_url" json:"-"`

Title string `gorm:"column:title;size:128"`
Desc string `gorm:"column:desc;size:1024"`
Expand Down
3 changes: 2 additions & 1 deletion tools/up35/pkg/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"
"errors"
"fmt"
"gopkg.in/yaml.v3"
"log"
"os"
"reflect"
"strconv"

"gopkg.in/yaml.v3"

"github.com/go-sql-driver/mysql"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
Expand Down
Loading

0 comments on commit c8d43a6

Please sign in to comment.