Merge branch 'tuoyun'

# Conflicts:
#	cmd/open_im_api/main.go
#	config/config.yaml
#	go.sum
#	pkg/common/config/config.go
#	pkg/common/db/model.go
This commit is contained in:
Gordon
2022-03-29 10:58:01 +08:00
75 changed files with 10892 additions and 5192 deletions
+79 -13
View File
@@ -32,17 +32,83 @@ type SetReceiveMessageOptResp struct {
ConversationOptResultList []*OptResult `json:"data"`
}
//type Conversation struct {
// OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"`
// ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"`
// ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"`
// UserID string `gorm:"column:user_id;type:char(64)" json:"userID"`
// GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"`
// RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"`
// UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"`
// DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
// IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
// AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
// Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
//}
type Conversation struct {
OwnerUserID string `json:"ownerUserID" binding:"required"`
ConversationID string `json:"conversationID"`
ConversationType int32 `json:"conversationType"`
UserID string `json:"userID"`
GroupID string `json:"groupID"`
RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"`
UnreadCount int32 `json:"unreadCount" binding:"omitempty"`
DraftTextTime int64 `json:"draftTextTime"`
IsPinned bool `json:"isPinned" binding:"omitempty"`
IsPrivateChat bool `json:"isPrivateChat"`
AttachedInfo string `json:"attachedInfo"`
Ex string `json:"ex"`
}
type SetConversationReq struct {
Conversation
OperationID string `json:"operationID" binding:"required"`
}
type SetConversationResp struct {
CommResp
}
type BatchSetConversationsReq struct {
Conversations []Conversation `json:"conversations" binding:"required"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type BatchSetConversationsResp struct {
CommResp
Data struct {
Success []string `json:"success"`
Failed []string `json:"failed"`
} `json:"data"`
}
type GetConversationReq struct {
ConversationID string `json:"conversationID" binding:"required"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetConversationResp struct {
CommResp
Conversation Conversation `json:"data"`
}
type GetAllConversationsReq struct {
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetAllConversationsResp struct {
CommResp
Conversations []Conversation `json:"data"`
}
type GetConversationsReq struct {
ConversationIDs []string `json:"conversationIDs" binding:"required"`
OwnerUserID string `json:"ownerUserID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetConversationsResp struct {
CommResp
Conversations []Conversation `json:"data"`
}
type SetRecvMsgOptReq struct {
OwnerUserID string `json:"ownerUserID" binding:"required"`
ConversationID string `json:"conversationID"`
RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"`
OperationID string `json:"operationID" binding:"required"`
}
type SetRecvMsgOptResp struct {
CommResp
}
+8
View File
@@ -177,3 +177,11 @@ type TransferGroupOwnerReq struct {
type TransferGroupOwnerResp struct {
CommResp
}
type DismissGroupReq struct {
GroupID string `json:"groupID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type DismissGroupResp struct {
CommResp
}
+16 -4
View File
@@ -6,8 +6,20 @@ type MinioStorageCredentialReq struct {
type MiniostorageCredentialResp struct {
SecretAccessKey string `json:"secretAccessKey"`
AccessKeyID string `json:"accessKeyID"`
SessionToken string `json:"sessionToken"`
BucketName string `json:"bucketName"`
StsEndpointURL string `json:"stsEndpointURL"`
AccessKeyID string `json:"accessKeyID"`
SessionToken string `json:"sessionToken"`
BucketName string `json:"bucketName"`
StsEndpointURL string `json:"stsEndpointURL"`
}
type MinioUploadFileReq struct {
OperationID string `form:"operationID" binding:"required"`
FileType int `form:"fileType" binding:"required"`
}
type MinioUploadFileResp struct {
URL string `json:"URL"`
NewName string `json:"newName"`
SnapshotURL string `json:"snapshotURL,omitempty"`
SnapshotNewName string `json:"snapshotName,omitempty"`
}
+12
View File
@@ -0,0 +1,12 @@
package base_info
type DelMsgReq struct {
OpUserID string `json:"opUserID,omitempty"`
UserID string `json:"userID,omitempty"`
SeqList []uint32 `json:"seqList,omitempty"`
OperationID string `json:"operationID,omitempty"`
}
type DelMsgResp struct {
CommResp
}
+74
View File
@@ -0,0 +1,74 @@
package base_info
import (
pbOffice "Open_IM/pkg/proto/office"
)
type GetUserTagsReq struct {
OperationID string `json:"operationID"`
}
type GetUserTagsResp struct {
CommResp
Data struct {
Tags []*pbOffice.Tag `json:"tags"`
} `json:"data"`
}
type CreateTagReq struct {
TagName string `json:"tagName" binding:"required"`
UserIDList []string `json:"userIDList" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type CreateTagResp struct {
CommResp
}
type DeleteTagReq struct {
TagID string `json:"tagID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type DeleteTagResp struct {
CommResp
}
type SetTagReq struct {
TagID string `json:"tagID" binding:"required"`
NewName string `json:"newName"`
IncreaseUserIDList []string `json:"increaseUserIDList"`
ReduceUserIDList []string `json:"reduceUserIDList"`
OperationID string `json:"operationID" binding:"required"`
}
type SetTagResp struct {
CommResp
}
type SendMsg2TagReq struct {
TagID string `json:"tagID" binding:"required"`
SenderPlatformID int32 `json:"senderPlatformID" binding:"required"`
Content string `json:"content" binding:"required"`
ContentType int32 `json:"contentType" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type SendMsg2TagResp struct {
CommResp
}
type GetTagSendLogsReq struct {
PageNumber int32 `json:"pageNumber" binding:"required"`
ShowNumber int32 `json:"showNumber" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
}
type GetTagSendLogsResp struct {
CommResp
Data struct {
Logs []*pbOffice.TagSendLog `json:"logs"`
CurrentPage int32 `json:"currentPage"`
ShowNumber int32 `json:"showNumber"`
} `json:"data"`
}
+3 -5
View File
@@ -17,10 +17,8 @@ type CommonCallbackReq struct {
}
type CommonCallbackResp struct {
ActionCode int `json:"actionCode"`
ErrCode int `json:"errCode"`
ErrMsg string `json:"errMsg"`
ActionCode int `json:"actionCode"`
ErrCode int `json:"errCode"`
ErrMsg string `json:"errMsg"`
OperationID string `json:"operationID"`
}
+12 -3
View File
@@ -22,7 +22,7 @@ var Config config
type callBackConfig struct {
Enable bool `yaml:"enable"`
CallbackTimeOut int `yaml:"callbackTimeOut"`
CallbackFailedContinue bool `CallbackFailedContinue`
CallbackFailedContinue bool `yaml:"callbackFailedContinue"`
}
type config struct {
@@ -64,6 +64,7 @@ type config struct {
SecretAccessKey string `yaml:"secretAccessKey"`
} `yaml:"minio"`
}
Mysql struct {
DBAddress []string `yaml:"dbMysqlAddress"`
DBUserName string `yaml:"dbMysqlUserName"`
@@ -114,6 +115,7 @@ type config struct {
OpenImAuthName string `yaml:"openImAuthName"`
OpenImMessageCMSName string `yaml:"openImMessageCMSName"`
OpenImAdminCMSName string `yaml:"openImAdminCMSName"`
OpenImOfficeName string `yaml:"openImOfficeName"`
}
Etcd struct {
EtcdSchema string `yaml:"etcdSchema"`
@@ -184,8 +186,8 @@ type config struct {
AccessSecret string `yaml:"accessSecret"`
AccessExpire int64 `yaml:"accessExpire"`
}
MessageJudge struct {
IsJudgeFriend bool `yaml:"isJudgeFriend"`
MessageVerify struct {
FriendVerify bool `yaml:"friendVerify"`
}
IOSPush struct {
PushSound string `yaml:"pushSound"`
@@ -261,6 +263,13 @@ type config struct {
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"memberEnter"`
GroupDismissed struct {
Conversation PConversation `yaml:"conversation"`
OfflinePush POfflinePush `yaml:"offlinePush"`
DefaultTips PDefaultTips `yaml:"defaultTips"`
} `yaml:"groupDismissed"`
////////////////////////user///////////////////////
UserInfoUpdated struct {
Conversation PConversation `yaml:"conversation"`
+31 -10
View File
@@ -64,6 +64,7 @@ const (
ConversationNotNotification = 1308
ConversationDefault = 0
UserNotificationEnd = 1399
OANotification = 1400
GroupNotificationBegin = 1500
@@ -77,7 +78,16 @@ const (
MemberKickedNotification = 1508
MemberInvitedNotification = 1509
MemberEnterNotification = 1510
NotificationEnd = 2000
GroupDismissedNotification = 1511
SignalingNotificationBegin = 1600
SignalingNotification = 1601
SignalingNotificationEnd = 1699
NotificationEnd = 2000
//status
MsgNormal = 1
MsgDeleted = 4
//MsgFrom
UserMsgType = 100
@@ -86,6 +96,8 @@ const (
//SessionType
SingleChatType = 1
GroupChatType = 2
NotificationChatType = 4
//token
NormalToken = 0
InValidToken = 1
@@ -113,17 +125,21 @@ const (
ReceiveNotNotifyMessage = 2
//OptionsKey
IsHistory = "history"
IsPersistent = "persistent"
IsOfflinePush = "offlinePush"
IsUnreadCount = "unreadCount"
IsConversationUpdate = "conversationUpdate"
IsSenderSync = "senderSync"
IsHistory = "history"
IsPersistent = "persistent"
IsOfflinePush = "offlinePush"
IsUnreadCount = "unreadCount"
IsConversationUpdate = "conversationUpdate"
IsSenderSync = "senderSync"
IsNotPrivate = "notPrivate"
IsSenderConversationUpdate = "senderConversationUpdate"
//GroupStatus
GroupOk = 0
GroupBanChat = 1
GroupDisband = 2
GroupOk = 0
GroupBanChat = 1
GroupStatusDismissed = 2
GroupStatusMuted = 3
GroupBaned = 3
GroupBanPrivateChat = 4
@@ -151,6 +167,11 @@ const (
//callback callbackHandleCode
CallbackHandleSuccess = 0
CallbackHandleFailed = 1
// minioUpload
OtherType = 1
VideoType = 2
ImageType = 3
)
var ContentType2PushContent = map[int64]string{
+10 -9
View File
@@ -9,7 +9,7 @@ type ErrInfo struct {
}
var (
OK = ErrInfo{0, ""}
OK = ErrInfo{0, ""}
ErrServer = ErrInfo{500, "server error"}
// ErrMysql = ErrInfo{100, ""}
@@ -47,10 +47,11 @@ var (
ErrTokenMalformed = ErrInfo{703, TokenMalformedMsg.Error()}
ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYetMsg.Error()}
ErrTokenUnknown = ErrInfo{705, TokenUnknownMsg.Error()}
ErrTokenKicked = ErrInfo{706, TokenUserKickedMsg.Error()}
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
ErrArgs = ErrInfo{ErrCode: 8003, ErrMsg: ArgsMsg.Error()}
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
ErrArgs = ErrInfo{ErrCode: 8003, ErrMsg: ArgsMsg.Error()}
ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
)
@@ -61,11 +62,11 @@ var (
TokenNotValidYetMsg = errors.New("token not active yet")
TokenMalformedMsg = errors.New("that's not even a token")
TokenUnknownMsg = errors.New("couldn't handle this token")
AccessMsg = errors.New("no permission")
DBMsg = errors.New("db failed")
ArgsMsg = errors.New("args failed")
CallBackMsg = errors.New("callback failed")
TokenUserKickedMsg = errors.New("user has been kicked")
AccessMsg = errors.New("no permission")
DBMsg = errors.New("db failed")
ArgsMsg = errors.New("args failed")
CallBackMsg = errors.New("callback failed")
ThirdPartyMsg = errors.New("third party error")
)
+3 -4
View File
@@ -17,15 +17,14 @@ import (
//"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
// "go.mongodb.org/mongo-driver/mongo/options"
)
var DB DataBases
type DataBases struct {
MysqlDB mysqlDB
mgoSession *mgo.Session
redisPool *redis.Pool
MysqlDB mysqlDB
mgoSession *mgo.Session
redisPool *redis.Pool
mongoClient *mongo.Client
}
+6
View File
@@ -108,6 +108,7 @@ type GroupMember struct {
JoinTime time.Time `gorm:"column:join_time"`
JoinSource int32 `gorm:"column:join_source"`
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
MuteEndTime time.Time `gorm:"column:mute_end_time"`
Ex string `gorm:"column:ex;size:1024"`
}
@@ -213,6 +214,11 @@ type Conversation struct {
UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"`
DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"`
AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
}
func (Conversation) TableName() string {
return "conversations"
}
+205 -9
View File
@@ -2,12 +2,19 @@ package db
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
officePb "Open_IM/pkg/proto/office"
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
"errors"
"fmt"
"github.com/gogo/protobuf/sortkeys"
"go.mongodb.org/mongo-driver/mongo/options"
"math/rand"
//"github.com/garyburd/redigo/redis"
"github.com/golang/protobuf/proto"
"gopkg.in/mgo.v2/bson"
@@ -18,6 +25,8 @@ import (
const cChat = "msg"
const cGroup = "group"
const cTag = "tag"
const cSendLog = "send_log"
const singleGocMsgNum = 5000
type MsgInfo struct {
@@ -69,6 +78,47 @@ func (d *DataBases) GetMinSeqFromMongo2(uid string) (MinSeq uint32, err error) {
return 1, nil
}
// deleteMsgByLogic
func (d *DataBases) DelMsgLogic(uid string, seqList []uint32, operationID string) error {
sortkeys.Uint32s(seqList)
seqMsgs, err := d.GetMsgBySeqListMongo2(uid, seqList, operationID)
if err != nil {
return utils.Wrap(err, "")
}
for _, seqMsg := range seqMsgs {
log.NewDebug(operationID, utils.GetSelfFuncName(), *seqMsg)
seqMsg.Status = constant.MsgDeleted
if err = d.ReplaceMsgBySeq(uid, seqMsg, operationID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "ReplaceMsgListBySeq error", err.Error())
}
}
return nil
}
func (d *DataBases) ReplaceMsgBySeq(uid string, msg *open_im_sdk.MsgData, operationID string) error {
log.NewInfo(operationID, utils.GetSelfFuncName(), uid, *msg)
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
uid = getSeqUid(uid, msg.Seq)
seqIndex := getMsgIndex(msg.Seq)
s := fmt.Sprintf("msg.%d.msg", seqIndex)
log.NewDebug(operationID, utils.GetSelfFuncName(), seqIndex, s)
bytes, err := proto.Marshal(msg)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "proto marshal", err.Error())
return utils.Wrap(err, "")
}
updateResult, err := c.UpdateOne(
ctx, bson.M{"uid": uid},
bson.M{"$set": bson.M{s: bytes}})
log.NewInfo(operationID, utils.GetSelfFuncName(), updateResult)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "UpdateOne", err.Error())
return utils.Wrap(err, "")
}
return nil
}
func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) {
log.NewInfo(operationID, utils.GetSelfFuncName(), uid, seqList)
var hasSeqList []uint32
@@ -125,7 +175,6 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID st
return seqMsg, nil
}
func (d *DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) {
var hasSeqList []uint32
singleCount := 0
@@ -178,7 +227,6 @@ func (d *DataBases) GetMsgBySeqListMongo2(uid string, seqList []uint32, operatio
return seqMsg, nil
}
func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk.MsgData) {
for _, v := range seqList {
msg := new(open_im_sdk.MsgData)
@@ -199,7 +247,7 @@ func (d *DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgD
sMsg := MsgInfo{}
sMsg.SendTime = sendTime
if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil {
return utils.Wrap(err,"")
return utils.Wrap(err, "")
}
err = c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": sMsg}}).Err()
log.NewDebug(operationID, "get mgoSession cost time", getCurrentTimestampByMill()-newTime)
@@ -207,11 +255,11 @@ func (d *DataBases) SaveUserChatMongo2(uid string, sendTime int64, m *pbMsg.MsgD
sChat := UserChat{}
sChat.UID = seqUid
sChat.Msg = append(sChat.Msg, sMsg)
if _, err = c.InsertOne(ctx, &sChat) ; err != nil{
if _, err = c.InsertOne(ctx, &sChat); err != nil {
log.NewDebug(operationID, "InsertOne failed", filter)
return utils.Wrap(err, "")
}
}else{
} else {
log.NewDebug(operationID, "FindOneAndUpdate ok", filter)
}
@@ -258,7 +306,6 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToD
return nil
}
func (d *DataBases) DelUserChat(uid string) error {
return nil
//session := d.mgoSession.Clone()
@@ -277,7 +324,6 @@ func (d *DataBases) DelUserChat(uid string) error {
//return nil
}
func (d *DataBases) DelUserChatMongo2(uid string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
@@ -290,8 +336,6 @@ func (d *DataBases) DelUserChatMongo2(uid string) error {
return nil
}
func (d *DataBases) MgoUserCount() (int, error) {
return 0, nil
//session := d.mgoSession.Clone()
@@ -391,13 +435,165 @@ func (d *DataBases) DelGroupMember(groupID, uid string) error {
//return nil
}
type Tag struct {
UserID string `bson:"user_id"`
TagID string `bson:"tag_id"`
TagName string `bson:"tag_name"`
UserList []string `bson:"user_list"`
}
func (d *DataBases) GetUserTags(userID string) ([]Tag, error) {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
var tags []Tag
cursor, err := c.Find(ctx, bson.M{"user_id": userID})
if err != nil {
return tags, err
}
if err = cursor.All(ctx, &tags); err != nil {
return tags, err
}
return tags, nil
}
func (d *DataBases) CreateTag(userID, tagName string, userList []string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
tagID := generateTagID(tagName, userID)
tag := Tag{
UserID: userID,
TagID: tagID,
TagName: tagName,
UserList: userList,
}
_, err := c.InsertOne(ctx, tag)
return err
}
func (d *DataBases) DeleteTag(userID, tagID string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
_, err := c.DeleteOne(ctx, bson.M{"user_id": userID, "tag_id": tagID})
return err
}
func (d *DataBases) SetTag(userID, tagID, newName string, increaseUserIDList []string, reduceUserIDList []string) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
var tag Tag
if err := c.FindOne(ctx, bson.M{"tag_id": tagID, "user_id": userID}).Decode(&tag); err != nil {
return err
}
if newName != "" {
_, err := c.UpdateOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}, bson.M{"$set": bson.M{"tag_name": newName}})
if err != nil {
return err
}
}
tag.UserList = append(tag.UserList, increaseUserIDList...)
tag.UserList = utils.RemoveUserIDRepByMap(tag.UserList)
for _, v := range reduceUserIDList {
for i2, v2 := range tag.UserList {
if v == v2 {
tag.UserList[i2] = ""
}
}
}
var newUserList []string
for _, v := range tag.UserList {
if v != "" {
newUserList = append(newUserList, v)
}
}
_, err := c.UpdateOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}, bson.M{"$set": bson.M{"user_list": newUserList}})
if err != nil {
return err
}
return nil
}
func (d *DataBases) GetUserIDListByTagID(userID, tagID string) ([]string, error) {
var tag Tag
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
_ = c.FindOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}).Decode(&tag)
return tag.UserList, nil
}
type TagUser struct {
UserID string `bson:"user_id"`
UserName string `bson:"user_name"`
}
type TagSendLog struct {
TagID string `bson:"tag_id"`
TagName string `bson:"tag_name"`
SendID string `bson:"send_id"`
SenderPlatformID int32 `bson:"sender_platform_id"`
Content string `bson:"content"`
ContentType int32 `bson:"content_type"`
SendTime int64 `bson:"send_time"`
}
func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
var tag Tag
_ = c.FindOne(ctx, bson.M{"user_id": sendReq.SendID, "tag_id": sendReq.TagID}).Decode(&tag)
c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
tagSendLog := TagSendLog{
TagID: sendReq.TagID,
TagName: tag.TagName,
SendID: sendReq.SendID,
SenderPlatformID: sendReq.SenderPlatformID,
Content: sendReq.Content,
ContentType: sendReq.ContentType,
SendTime: time.Now().Unix(),
}
_, err := c.InsertOne(ctx, tagSendLog)
return err
}
func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) ([]TagSendLog, error) {
var tagSendLogs []TagSendLog
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort(bson.M{"send_time": -1})
cursor, err := c.Find(ctx, bson.M{"send_id": userID}, findOpts)
if err != nil {
return tagSendLogs, err
}
err = cursor.All(ctx, &tagSendLogs)
if err != nil {
return tagSendLogs, err
}
return tagSendLogs, nil
}
func generateTagID(tagName, userID string) string {
return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()))
}
func getCurrentTimestampByMill() int64 {
return time.Now().UnixNano() / 1e6
}
func getSeqUid(uid string, seq uint32) string {
seqSuffix := seq / singleGocMsgNum
return indexGen(uid, seqSuffix)
}
func getMsgIndex(seq uint32) int {
seqSuffix := seq / singleGocMsgNum
var index uint32
if seqSuffix == 0 {
index = (seq - seqSuffix*5000) - 1
} else {
index = seq - seqSuffix*singleGocMsgNum
}
return int(index)
}
func isContainInt32(target uint32, List []uint32) bool {
for _, element := range List {
@@ -30,6 +30,9 @@ func InsertIntoGroupMember(toInsertInfo db.GroupMember) error {
if toInsertInfo.RoleLevel == 0 {
toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers
}
if toInsertInfo.MuteEndTime.Unix() == 0 {
toInsertInfo.MuteEndTime = time.Unix(0, 0)
}
err = dbConn.Table("group_members").Create(toInsertInfo).Error
if err != nil {
return err
@@ -103,6 +106,18 @@ func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error {
return nil
}
func DeleteGroupMemberByGroupID(groupID string) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
err = dbConn.Table("group_members").Where("group_id=? ", groupID).Delete(db.GroupMember{}).Error
if err != nil {
return err
}
return nil
}
func UpdateGroupMemberInfo(groupMemberInfo db.GroupMember) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
@@ -255,6 +270,14 @@ func GetGroupMembersCount(groupId, userName string) (int32, error) {
return count, nil
}
func UpdateGroupMemberInfoDefaultZero(groupMemberInfo db.GroupMember, args map[string]interface{}) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
return dbConn.Model(groupMemberInfo).Updates(args).Error
}
//
//func SelectGroupList(groupID string) ([]string, error) {
// var groupUserID string
@@ -57,7 +57,6 @@ func SetGroupInfo(groupInfo db.Group) error {
if err != nil {
return err
}
dbConn.LogMode(true)
err = dbConn.Table("groups").Where("group_id=?", groupInfo.GroupID).Update(&groupInfo).Error
return err
}
@@ -68,7 +67,7 @@ func GetGroupsByName(groupName string, pageNumber, showNumber int32) ([]db.Group
if err != nil {
return groups, err
}
dbConn.LogMode(true)
err = dbConn.Table("groups").Where(fmt.Sprintf(" name like '%%%s%%' ", groupName)).Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&groups).Error
return groups, err
}
@@ -79,7 +78,7 @@ func GetGroups(pageNumber, showNumber int) ([]db.Group, error) {
if err != nil {
return groups, err
}
dbConn.LogMode(true)
if err = dbConn.Table("groups").Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&groups).Error; err != nil {
return groups, err
}
@@ -102,7 +101,7 @@ func DeleteGroup(groupId string) error {
if err != nil {
return err
}
dbConn.LogMode(true)
var group db.Group
var groupMembers []db.GroupMember
if err := dbConn.Table("groups").Where("group_id=?", groupId).Delete(&group).Error; err != nil {
@@ -119,7 +118,6 @@ func OperateGroupRole(userId, groupId string, roleLevel int32) (string, string,
if err != nil {
return "", "", err
}
dbConn.LogMode(true)
groupMember := db.GroupMember{
UserID: userId,
GroupID: groupId,
@@ -182,7 +180,7 @@ func GetGroupsCountNum(group db.Group) (int32, error) {
if err != nil {
return 0, err
}
dbConn.LogMode(true)
var count int32
if err := dbConn.Table("groups").Where(fmt.Sprintf(" name like '%%%s%%' ", group.GroupName)).Count(&count).Error; err != nil {
return 0, err
@@ -198,7 +196,7 @@ func GetGroupById(groupId string) (db.Group, error) {
if err != nil {
return group, err
}
dbConn.LogMode(true)
if err := dbConn.Table("groups").Find(&group).Error; err != nil {
return group, err
}
@@ -211,9 +209,17 @@ func GetGroupMaster(groupId string) (db.GroupMember, error) {
if err != nil {
return groupMember, err
}
dbConn.LogMode(true)
if err := dbConn.Table("group_members").Where("role_level=? and group_id=?", constant.GroupOwner, groupId).Find(&groupMember).Error; err != nil {
return groupMember, err
}
return groupMember, nil
}
func UpdateGroupInfoDefaultZero(groupInfo db.Group, args map[string]interface{}) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
return dbConn.Model(groupInfo).Updates(args).Error
}
@@ -2,6 +2,8 @@ package im_mysql_model
import (
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"fmt"
)
@@ -30,7 +32,6 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
if chatLog.SendTime.Unix() > 0 {
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
}
err = db.Find(&chatLogs).Error
return chatLogs, err
}
@@ -58,6 +59,7 @@ func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
db = db.Where("recv_id = ?", chatLog.RecvID)
}
if chatLog.SendTime.Unix() > 0 {
log.NewDebug("", utils.GetSelfFuncName(), chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
}
@@ -4,6 +4,7 @@ import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"fmt"
"time"
@@ -73,6 +74,19 @@ func GetUserByUserID(userID string) (*db.User, error) {
return &user, nil
}
func GetUserNameByUserID(userID string) (string, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return "", err
}
var user db.User
err = dbConn.Table("users").Select("name").Where("user_id=?", userID).First(&user).Error
if err != nil {
return "", err
}
return user.Nickname, nil
}
func UpdateUserInfo(user db.User) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
@@ -291,3 +305,75 @@ func GetBlockUsersNumCount() (int32, error) {
}
return count, nil
}
func SetConversation(conversation db.Conversation) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
dbConn.LogMode(true)
newConversation := conversation
if dbConn.Model(&db.Conversation{}).Find(&newConversation).RowsAffected == 0 {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "not exist in db, create")
return dbConn.Model(&db.Conversation{}).Create(conversation).Error
// if exist, then update record
} else {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "exist in db, update")
//force update
return dbConn.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID).
Update(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt, "is_pinned": conversation.IsPinned, "is_private_chat": conversation.IsPrivateChat}).Error
}
}
func SetRecvMsgOpt(conversation db.Conversation) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
}
dbConn.LogMode(true)
newConversation := conversation
if dbConn.Model(&db.Conversation{}).Find(&newConversation).RowsAffected == 0 {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "not exist in db, create")
return dbConn.Model(&db.Conversation{}).Create(conversation).Error
// if exist, then update record
} else {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "exist in db, update")
//force update
return dbConn.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID).
Update(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt}).Error
}
}
func GetUserAllConversations(ownerUserID string) ([]db.Conversation, error) {
var conversations []db.Conversation
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return conversations, err
}
dbConn.LogMode(true)
err = dbConn.Model(&db.Conversation{}).Where("owner_user_id=?", ownerUserID).Find(&conversations).Error
return conversations, err
}
func GetConversation(OwnerUserID, conversationID string) (db.Conversation, error) {
var conversation db.Conversation
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return conversation, err
}
err = dbConn.Model(&db.Conversation{
OwnerUserID: OwnerUserID,
ConversationID: conversationID,
}).Find(&conversation).Error
return conversation, err
}
func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conversation, error) {
var conversations []db.Conversation
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return conversations, err
}
err = dbConn.Model(&db.Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error
return conversations, err
}
+4 -2
View File
@@ -111,12 +111,14 @@ func (d *DataBases) DeleteTokenByUidPid(userID string, platformID int32, fields
_, err := d.Exec("HDEL", key, redis.Args{}.Add().AddFlat(fields)...)
return err
}
func (d *DataBases) SetSingleConversationMsgOpt(userID, conversationID string, opt int) error {
func (d *DataBases) SetSingleConversationRecvMsgOpt(userID, conversationID string, opt int32) error {
key := conversationReceiveMessageOpt + userID
_, err := d.Exec("HSet", key, conversationID, opt)
return err
}
func (d *DataBases) GetSingleConversationMsgOpt(userID, conversationID string) (int, error) {
func (d *DataBases) GetSingleConversationRecvMsgOpt(userID, conversationID string) (int, error) {
key := conversationReceiveMessageOpt + userID
return redis.Int(d.Exec("HGet", key, conversationID))
}
+18 -2
View File
@@ -129,9 +129,10 @@ func CheckAccess(OpUserID string, OwnerUserID string) bool {
return false
}
func GetUserIDFromToken(token string) (bool, string) {
func GetUserIDFromToken(token string, operationID string) (bool, string) {
claims, err := ParseToken(token)
if err != nil {
log.Error(operationID, "ParseToken failed, ", err.Error(), token)
return false, ""
}
return true, claims.UID
@@ -162,7 +163,7 @@ func ParseToken(tokensString string) (claims *Claims, err error) {
case constant.InValidToken:
return nil, &constant.ErrTokenInvalid
case constant.KickedToken:
return nil, &constant.ErrTokenInvalid
return nil, &constant.ErrTokenKicked
case constant.ExpiredToken:
return nil, &constant.ErrTokenExpired
default:
@@ -201,6 +202,21 @@ func VerifyToken(token, uid string) (bool, error) {
if claims.UID != uid {
return false, &constant.ErrTokenUnknown
}
log.NewDebug("", claims.UID, claims.Platform)
return true, nil
}
func WsVerifyToken(token, uid string, platformID string) (bool, error, string) {
claims, err := ParseToken(token)
if err != nil {
return false, err, "parse token err"
}
if claims.UID != uid {
return false, &constant.ErrTokenUnknown, "uid is not same to token uid"
}
if claims.Platform != constant.PlatformIDToName(utils.StringToInt32(platformID)) {
return false, &constant.ErrTokenUnknown, "platform is not same to token platform"
}
log.NewDebug("", claims.UID, claims.Platform)
return true, nil, ""
}
+1
View File
@@ -118,6 +118,7 @@ func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src *db.Group
dst.AppMangerLevel = 1
}
dst.JoinTime = int32(src.JoinTime.Unix())
dst.MuteEndTime = uint32(src.JoinTime.Unix())
return nil
}
+12 -2
View File
@@ -78,15 +78,25 @@ func RegisterEtcd(schema, etcdAddr, myHost string, myPort int, serviceName strin
log.Debug("", "KeepAlive kresp ok", pv)
} else {
log.Error("", "KeepAlive kresp failed", pv)
t := time.NewTicker(time.Duration(ttl) * time.Second)
t := time.NewTicker(time.Duration(ttl/2) * time.Second)
for {
select {
case <-t.C:
}
ctx, _ := context.WithCancel(context.Background())
resp, err := cli.Grant(ctx, int64(ttl))
if err != nil {
log.Error("", "Grant failed ", err.Error())
continue
}
if _, err := cli.Put(ctx, serviceKey, serviceValue, clientv3.WithLease(resp.ID)); err != nil {
log.Error("", "etcd Put failed ", err.Error(), serviceKey, serviceValue, resp.ID)
continue
} else {
log.Info("", "etcd Put ok", serviceKey, serviceValue, resp.ID)
}
log.Info("", "etcd Put ok", serviceKey, serviceValue, resp.ID)
}
}
}
+75 -41
View File
@@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} }
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToMQ) ProtoMessage() {}
func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{0}
return fileDescriptor_chat_83f286704599d5b1, []int{0}
}
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
@@ -90,7 +90,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} }
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
func (*MsgDataToDB) ProtoMessage() {}
func (*MsgDataToDB) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{1}
return fileDescriptor_chat_83f286704599d5b1, []int{1}
}
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
@@ -137,7 +137,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} }
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*PushMsgDataToMQ) ProtoMessage() {}
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{2}
return fileDescriptor_chat_83f286704599d5b1, []int{2}
}
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
@@ -210,7 +210,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{3}
return fileDescriptor_chat_83f286704599d5b1, []int{3}
}
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@@ -258,7 +258,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{4}
return fileDescriptor_chat_83f286704599d5b1, []int{4}
}
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@@ -319,7 +319,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
func (*SendMsgReq) ProtoMessage() {}
func (*SendMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{5}
return fileDescriptor_chat_83f286704599d5b1, []int{5}
}
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
@@ -375,7 +375,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
func (*SendMsgResp) ProtoMessage() {}
func (*SendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_a5e95d84ecbd21a3, []int{6}
return fileDescriptor_chat_83f286704599d5b1, []int{6}
}
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
@@ -454,6 +454,7 @@ type ChatClient interface {
GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error)
PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error)
SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error)
DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error)
}
type chatClient struct {
@@ -491,12 +492,22 @@ func (c *chatClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.C
return out, nil
}
func (c *chatClient) DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error) {
out := new(sdk_ws.DelMsgListResp)
err := grpc.Invoke(ctx, "/pbChat.Chat/DelMsgList", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Chat service
type ChatServer interface {
GetMaxAndMinSeq(context.Context, *GetMaxAndMinSeqReq) (*GetMaxAndMinSeqResp, error)
PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error)
SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error)
DelMsgList(context.Context, *sdk_ws.DelMsgListReq) (*sdk_ws.DelMsgListResp, error)
}
func RegisterChatServer(s *grpc.Server, srv ChatServer) {
@@ -557,6 +568,24 @@ func _Chat_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
func _Chat_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(sdk_ws.DelMsgListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).DelMsgList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/DelMsgList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).DelMsgList(ctx, req.(*sdk_ws.DelMsgListReq))
}
return interceptor(ctx, in, info, handler)
}
var _Chat_serviceDesc = grpc.ServiceDesc{
ServiceName: "pbChat.Chat",
HandlerType: (*ChatServer)(nil),
@@ -573,44 +602,49 @@ var _Chat_serviceDesc = grpc.ServiceDesc{
MethodName: "SendMsg",
Handler: _Chat_SendMsg_Handler,
},
{
MethodName: "DelMsgList",
Handler: _Chat_DelMsgList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "chat/chat.proto",
}
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_a5e95d84ecbd21a3) }
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_83f286704599d5b1) }
var fileDescriptor_chat_a5e95d84ecbd21a3 = []byte{
// 489 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x6f, 0xd3, 0x4e,
0x10, 0x95, 0xd3, 0x26, 0xf9, 0x65, 0xf2, 0xab, 0x22, 0x6d, 0x2b, 0x64, 0x99, 0x8b, 0xf1, 0x29,
0x02, 0xc9, 0x96, 0x02, 0x37, 0x4e, 0xa4, 0xae, 0x50, 0x10, 0x4b, 0x8b, 0x13, 0x2e, 0x5c, 0xa2,
0x6d, 0x3d, 0x72, 0xac, 0x24, 0xf6, 0x66, 0xc7, 0x21, 0x05, 0x3e, 0x03, 0x9f, 0x81, 0x8f, 0xc9,
0x15, 0x79, 0xd7, 0x69, 0x9d, 0xa6, 0x88, 0x9c, 0xb8, 0x58, 0x7a, 0x6f, 0xc6, 0x6f, 0xde, 0xdb,
0x7f, 0xd0, 0xbb, 0x99, 0x89, 0x22, 0x28, 0x3f, 0xbe, 0x54, 0x79, 0x91, 0xb3, 0x96, 0xbc, 0x3e,
0x9f, 0x89, 0xc2, 0x79, 0x76, 0x29, 0x31, 0x9b, 0x8e, 0x78, 0x20, 0xe7, 0x49, 0xa0, 0x4b, 0x01,
0xc5, 0xf3, 0xe9, 0x86, 0x82, 0x0d, 0x99, 0x56, 0xef, 0x3b, 0x74, 0x39, 0x25, 0xa1, 0x28, 0xc4,
0x24, 0xe7, 0x1f, 0xd9, 0x19, 0x34, 0x8b, 0x7c, 0x8e, 0x99, 0x6d, 0xb9, 0x56, 0xbf, 0x13, 0x19,
0xc0, 0x5c, 0xe8, 0xe6, 0x12, 0x95, 0x28, 0xd2, 0x3c, 0x1b, 0x85, 0x76, 0x43, 0xd7, 0xea, 0x14,
0x7b, 0x05, 0xed, 0xa5, 0x91, 0xb1, 0x8f, 0x5c, 0xab, 0xdf, 0x1d, 0x38, 0x3e, 0xa1, 0xfa, 0x82,
0x6a, 0x2a, 0x64, 0x3a, 0x95, 0x42, 0x89, 0x25, 0xf9, 0xd5, 0xa0, 0x68, 0xdb, 0xea, 0x61, 0x6d,
0x78, 0x38, 0xac, 0x8b, 0x58, 0x07, 0x8b, 0xfc, 0xdd, 0x9c, 0xf7, 0xc3, 0x82, 0xde, 0xd5, 0x9a,
0x66, 0xf5, 0xa0, 0x2e, 0x74, 0x2f, 0x6b, 0x7f, 0x99, 0xb8, 0x75, 0xaa, 0xee, 0xa6, 0x71, 0xb8,
0x1b, 0x0f, 0xfe, 0x97, 0x6b, 0x9a, 0x4d, 0xf2, 0x4f, 0x84, 0x6a, 0x14, 0xea, 0xd5, 0xe8, 0x44,
0x3b, 0x9c, 0xf7, 0x01, 0xd8, 0x5b, 0x2c, 0xb8, 0xb8, 0x7d, 0x93, 0xc5, 0x3c, 0xcd, 0xc6, 0xb8,
0x8a, 0x70, 0xc5, 0x9e, 0x40, 0xab, 0xfa, 0xc7, 0x98, 0xa9, 0xd0, 0x43, 0xa7, 0x8d, 0x3d, 0xa7,
0xde, 0x06, 0x4e, 0xf7, 0xf4, 0x48, 0x32, 0x1b, 0xda, 0x17, 0x4a, 0x9d, 0xe7, 0x31, 0x6a, 0xc5,
0x66, 0xb4, 0x85, 0xe5, 0xa8, 0x0b, 0xa5, 0x38, 0x25, 0x95, 0x5a, 0x85, 0x4a, 0x9e, 0x8b, 0xdb,
0x31, 0xae, 0xb4, 0xed, 0x93, 0xa8, 0x42, 0x9a, 0xd7, 0xba, 0xf6, 0x71, 0xc5, 0x6b, 0xe4, 0x7d,
0x03, 0x18, 0x63, 0x16, 0x73, 0x4a, 0xca, 0x00, 0xff, 0xf6, 0xec, 0xfc, 0xb4, 0xa0, 0x7b, 0x37,
0xdc, 0xa4, 0xc5, 0xdd, 0xb4, 0x78, 0x9f, 0x16, 0x77, 0xd2, 0x1a, 0x54, 0x3a, 0x33, 0x73, 0x38,
0x25, 0xa3, 0x50, 0x47, 0xeb, 0x44, 0x75, 0xaa, 0xec, 0xb8, 0x59, 0xa4, 0x98, 0x15, 0xa6, 0xa3,
0x69, 0x3a, 0x6a, 0x14, 0x73, 0xe0, 0x3f, 0xc2, 0x2c, 0x9e, 0xa4, 0x4b, 0xb4, 0x5b, 0xae, 0xd5,
0x3f, 0x8a, 0xee, 0xf0, 0xe0, 0x97, 0x05, 0xc7, 0xe5, 0x35, 0x64, 0xef, 0xa0, 0xf7, 0x60, 0x7f,
0x98, 0xe3, 0x9b, 0x2b, 0xea, 0xef, 0x1f, 0x04, 0xe7, 0xe9, 0x1f, 0x6b, 0x24, 0x59, 0x0e, 0x67,
0x57, 0xeb, 0xc5, 0x82, 0x23, 0x91, 0x48, 0x70, 0xf8, 0x75, 0x8c, 0xab, 0xf7, 0x29, 0x15, 0xec,
0xf9, 0x23, 0x6b, 0xf6, 0x58, 0x63, 0x39, 0xe0, 0xc5, 0xc1, 0xbd, 0x24, 0xd9, 0x00, 0xda, 0xd5,
0x32, 0x33, 0xb6, 0x35, 0x76, 0xbf, 0xe9, 0xce, 0xe9, 0x1e, 0x47, 0x72, 0xd8, 0xfb, 0x7c, 0xe2,
0xeb, 0xf7, 0xe8, 0xb5, 0x29, 0x5e, 0xb7, 0xf4, 0x63, 0xf3, 0xf2, 0x77, 0x00, 0x00, 0x00, 0xff,
0xff, 0xe8, 0xa6, 0x3e, 0x67, 0xaa, 0x04, 0x00, 0x00,
var fileDescriptor_chat_83f286704599d5b1 = []byte{
// 507 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xcd, 0x6e, 0xda, 0x40,
0x10, 0x96, 0x49, 0x80, 0x32, 0x34, 0x42, 0xda, 0x44, 0x95, 0xe5, 0x5e, 0x1c, 0x9f, 0x50, 0x2b,
0x19, 0x89, 0xf6, 0xd6, 0x53, 0x89, 0xa3, 0x8a, 0xaa, 0xdb, 0x24, 0x86, 0x5e, 0x7a, 0x41, 0x9b,
0x30, 0x32, 0x16, 0x60, 0x2f, 0x3b, 0xa6, 0xa4, 0xed, 0x33, 0xf4, 0x19, 0xfa, 0x3e, 0x7d, 0xaa,
0xca, 0xbb, 0x26, 0x98, 0x40, 0x15, 0x4e, 0xbd, 0x58, 0x9a, 0x6f, 0x3e, 0x7f, 0x3f, 0xeb, 0x1f,
0x68, 0xdd, 0x4d, 0x44, 0xd6, 0xc9, 0x2f, 0xbe, 0x54, 0x69, 0x96, 0xb2, 0x9a, 0xbc, 0xbd, 0x98,
0x88, 0xcc, 0x39, 0xbf, 0x92, 0x98, 0x8c, 0xfa, 0xbc, 0x23, 0xa7, 0x51, 0x47, 0xaf, 0x3a, 0x34,
0x9e, 0x8e, 0x56, 0xd4, 0x59, 0x91, 0xa1, 0x7a, 0x3f, 0xa1, 0xc9, 0x29, 0x0a, 0x44, 0x26, 0x86,
0x29, 0xbf, 0x61, 0x67, 0x50, 0xcd, 0xd2, 0x29, 0x26, 0xb6, 0xe5, 0x5a, 0xed, 0x46, 0x68, 0x06,
0xe6, 0x42, 0x33, 0x95, 0xa8, 0x44, 0x16, 0xa7, 0x49, 0x3f, 0xb0, 0x2b, 0x7a, 0x57, 0x86, 0xd8,
0x5b, 0xa8, 0xcf, 0x8d, 0x8c, 0x7d, 0xe4, 0x5a, 0xed, 0x66, 0xd7, 0xf1, 0x09, 0xd5, 0x37, 0x54,
0x23, 0x21, 0xe3, 0x91, 0x14, 0x4a, 0xcc, 0xc9, 0x2f, 0x8c, 0xc2, 0x35, 0xd5, 0xc3, 0x92, 0x79,
0xd0, 0x2b, 0x8b, 0x58, 0x07, 0x8b, 0x3c, 0x1d, 0xce, 0xfb, 0x65, 0x41, 0xeb, 0x7a, 0x49, 0x93,
0x72, 0x51, 0x17, 0x9a, 0x57, 0xa5, 0xbb, 0x4c, 0xdd, 0x32, 0x54, 0x4e, 0x53, 0x39, 0x3c, 0x8d,
0x07, 0xcf, 0xe5, 0x92, 0x26, 0xc3, 0xf4, 0x0b, 0xa1, 0xea, 0x07, 0xfa, 0x34, 0x1a, 0xe1, 0x16,
0xe6, 0x7d, 0x06, 0xf6, 0x01, 0x33, 0x2e, 0xee, 0xdf, 0x27, 0x63, 0x1e, 0x27, 0x03, 0x5c, 0x84,
0xb8, 0x60, 0x2f, 0xa0, 0x56, 0xdc, 0x63, 0xc2, 0x14, 0xd3, 0xe3, 0xa4, 0x95, 0x9d, 0xa4, 0xde,
0x0a, 0x4e, 0x77, 0xf4, 0x48, 0x32, 0x1b, 0xea, 0x97, 0x4a, 0x5d, 0xa4, 0x63, 0xd4, 0x8a, 0xd5,
0x70, 0x3d, 0xe6, 0x56, 0x97, 0x4a, 0x71, 0x8a, 0x0a, 0xb5, 0x62, 0xca, 0x71, 0x2e, 0xee, 0x07,
0xb8, 0xd0, 0xb1, 0x4f, 0xc2, 0x62, 0xd2, 0xb8, 0xd6, 0xb5, 0x8f, 0x0b, 0x5c, 0x4f, 0xde, 0x0f,
0x80, 0x01, 0x26, 0x63, 0x4e, 0x51, 0x5e, 0xe0, 0xff, 0xbe, 0x3b, 0xbf, 0x2d, 0x68, 0x3e, 0x98,
0x9b, 0xb6, 0xb8, 0xdd, 0x16, 0x37, 0x6d, 0x71, 0xab, 0xad, 0x99, 0xf2, 0x64, 0xc6, 0x87, 0x53,
0xd4, 0x0f, 0x74, 0xb5, 0x46, 0x58, 0x86, 0x72, 0xc6, 0xdd, 0x2c, 0xc6, 0x24, 0x33, 0x8c, 0xaa,
0x61, 0x94, 0x20, 0xe6, 0xc0, 0x33, 0xc2, 0x64, 0x3c, 0x8c, 0xe7, 0x68, 0xd7, 0x5c, 0xab, 0x7d,
0x14, 0x3e, 0xcc, 0xdd, 0x3f, 0x15, 0x38, 0xce, 0x3f, 0x43, 0xf6, 0x11, 0x5a, 0x8f, 0x9e, 0x0f,
0x73, 0x7c, 0xf3, 0x89, 0xfa, 0xbb, 0x2f, 0x82, 0xf3, 0xf2, 0x9f, 0x3b, 0x92, 0x2c, 0x85, 0xb3,
0xeb, 0xe5, 0x6c, 0xc6, 0x91, 0x48, 0x44, 0xd8, 0xfb, 0x3e, 0xc0, 0xc5, 0xa7, 0x98, 0x32, 0xf6,
0x6a, 0xcf, 0x99, 0xed, 0x23, 0xe6, 0x06, 0xaf, 0x0f, 0xe6, 0x92, 0x64, 0x5d, 0xa8, 0x17, 0xc7,
0xcc, 0xd8, 0x3a, 0xd8, 0xe6, 0xa1, 0x3b, 0xa7, 0x3b, 0x18, 0x49, 0x76, 0x03, 0x10, 0xe0, 0x8c,
0x53, 0xa4, 0xa3, 0xb9, 0x7b, 0xec, 0x36, 0xeb, 0x5c, 0xe4, 0xfc, 0x09, 0x06, 0xc9, 0x5e, 0xeb,
0xeb, 0x89, 0xaf, 0x7f, 0x71, 0xef, 0x8c, 0xdf, 0x6d, 0x4d, 0xff, 0xbf, 0xde, 0xfc, 0x0d, 0x00,
0x00, 0xff, 0xff, 0x6f, 0x9d, 0x6f, 0xa0, 0xfd, 0x04, 0x00, 0x00,
}
+8 -2
View File
@@ -1,7 +1,9 @@
syntax = "proto3";
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
package pbChat;//The package name to which the proto file belongs
option go_package = "./chat;pbChat";//The generated go pb file is in the current directory, and the package name is pbChat
option go_package = "./chat;pbChat";
package pbChat;
message MsgDataToMQ{
string token =1;
@@ -69,8 +71,12 @@ message SendMsgResp {
int64 sendTime = 6;
}
service Chat {
rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp);
rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp);
rpc SendMsg(SendMsgReq) returns(SendMsgResp);
rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp);
}
+2755 -3811
View File
File diff suppressed because it is too large Load Diff
+68
View File
@@ -318,6 +318,68 @@ message AddGroupMembersCMSResp {
repeated string failed = 2;
}
message DismissGroupReq{
string opUserID = 1; //group or app manager
string operationID = 2;
string groupID = 3;
}
message DismissGroupResp{
CommonResp commonResp = 1;
}
message MuteGroupMemberReq{
string opUserID = 1; //group or app manager
string operationID = 2;
string groupID = 3;
string userID = 4;
uint32 mutedSeconds = 5;
}
message MuteGroupMemberResp{
CommonResp commonResp = 1;
}
message CancelMuteGroupMemberReq{
string opUserID = 1; //group or app manager
string operationID = 2;
string groupID = 3;
string userID = 4;
}
message CancelMuteGroupMemberResp{
CommonResp commonResp = 1;
}
message MuteGroupReq{
string opUserID = 1; //group or app manager
string operationID = 2;
string groupID = 3;
}
message MuteGroupResp{
CommonResp commonResp = 1;
}
message CancelMuteGroupReq{
string opUserID = 1; //group or app manager
string operationID = 2;
string groupID = 3;
}
message CancelMuteGroupResp{
CommonResp commonResp = 1;
}
service group{
rpc createGroup(CreateGroupReq) returns(CreateGroupResp);
@@ -345,6 +407,12 @@ service group{
rpc GetGroupMembersCMS(GetGroupMembersCMSReq) returns(GetGroupMembersCMSResp);
rpc RemoveGroupMembersCMS(RemoveGroupMembersCMSReq) returns(RemoveGroupMembersCMSResp);
rpc AddGroupMembersCMS(AddGroupMembersCMSReq) returns(AddGroupMembersCMSResp);
rpc DismissGroup(DismissGroupReq) returns(DismissGroupResp);
rpc MuteGroupMember(MuteGroupMemberReq) returns(MuteGroupMemberResp);
rpc CancelMuteGroupMember(CancelMuteGroupMemberReq) returns(CancelMuteGroupMemberResp);
rpc MuteGroup(MuteGroupReq) returns(MuteGroupResp);
rpc CancelMuteGroup(CancelMuteGroupReq) returns(CancelMuteGroupResp);
}
File diff suppressed because it is too large Load Diff
+107
View File
@@ -0,0 +1,107 @@
syntax = "proto3";
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
option go_package = "./office;office";
package office;
message CommonResp{
int32 errCode = 1;
string errMsg = 2;
}
message TagUser {
string userID = 1;
string userName = 2;
}
message Tag {
string tagID = 1;
string tagName = 2;
repeated TagUser userList = 3;
}
message GetUserTagsReq{
string userID = 1;
string operationID = 2;
}
message GetUserTagsResp{
CommonResp commonResp = 1;
repeated Tag tags = 2;
}
message CreateTagReq {
string tagName = 1;
string userID = 2;
repeated string userIDList = 3;
string operationID = 4;
}
message CreateTagResp {
CommonResp commonResp = 1;
}
message DeleteTagReq {
string userID = 1;
string tagID = 2;
string operationID = 3;
}
message DeleteTagResp {
CommonResp commonResp = 1;
}
message SetTagReq {
string userID = 1;
string tagID = 2;
string newName = 3;
repeated string increaseUserIDList = 4;
repeated string reduceUserIDList = 5;
string operationID = 6;
}
message SetTagResp {
CommonResp commonResp = 1;
}
message SendMsg2TagReq {
string tagID = 1;
string sendID = 2;
int32 senderPlatformID = 3;
string content = 4;
int32 contentType = 5;
string operationID = 6;
}
message SendMsg2TagResp {
CommonResp commonResp = 1;
}
message GetTagSendLogsReq {
server_api_params.RequestPagination Pagination = 1;
string userID = 2;
string operationID = 3;
}
message TagSendLog {
string tagID = 1;
string tagName = 2;
int32 contentType = 3;
string content = 4;
int64 sendTime = 5;
}
message GetTagSendLogsResp {
CommonResp commonResp = 1;
server_api_params.ResponsePagination Pagination = 2;
repeated TagSendLog tagSendLogs = 3;
}
service OfficeService {
rpc GetUserTags(GetUserTagsReq) returns(GetUserTagsResp);
rpc CreateTag(CreateTagReq) returns(CreateTagResp);
rpc DeleteTag(DeleteTagReq) returns(DeleteTagResp);
rpc SetTag(SetTagReq) returns(SetTagResp);
rpc SendMsg2Tag(SendMsg2TagReq) returns(SendMsg2TagResp);
rpc GetTagSendLogs(GetTagSendLogsReq) returns(GetTagSendLogsResp);
}
+1 -1
View File
@@ -7,9 +7,9 @@ all_proto=(
friend/friend.proto
group/group.proto
user/user.proto
rtc/rtc.proto
chat/chat.proto
push/push.proto
relay/relay.proto
sdk_ws/ws.proto
)
+935
View File
@@ -0,0 +1,935 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.15.5
// source: rtc.proto
package proto
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CommonResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ErrCode int32 `protobuf:"varint,1,opt,name=errCode,proto3" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg,proto3" json:"errMsg,omitempty"`
}
func (x *CommonResp) Reset() {
*x = CommonResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CommonResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CommonResp) ProtoMessage() {}
func (x *CommonResp) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead.
func (*CommonResp) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{0}
}
func (x *CommonResp) GetErrCode() int32 {
if x != nil {
return x.ErrCode
}
return 0
}
func (x *CommonResp) GetErrMsg() string {
if x != nil {
return x.ErrMsg
}
return ""
}
type GroupInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID,omitempty"`
GroupName string `protobuf:"bytes,2,opt,name=groupName,proto3" json:"groupName,omitempty"`
Notification string `protobuf:"bytes,3,opt,name=notification,proto3" json:"notification,omitempty"`
Introduction string `protobuf:"bytes,4,opt,name=introduction,proto3" json:"introduction,omitempty"`
FaceURL string `protobuf:"bytes,5,opt,name=faceURL,proto3" json:"faceURL,omitempty"`
OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID,proto3" json:"ownerUserID,omitempty"`
CreateTime uint32 `protobuf:"varint,7,opt,name=createTime,proto3" json:"createTime,omitempty"`
MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount,proto3" json:"memberCount,omitempty"`
Ex string `protobuf:"bytes,9,opt,name=ex,proto3" json:"ex,omitempty"`
Status int32 `protobuf:"varint,10,opt,name=status,proto3" json:"status,omitempty"`
CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID,proto3" json:"creatorUserID,omitempty"`
GroupType int32 `protobuf:"varint,12,opt,name=groupType,proto3" json:"groupType,omitempty"`
}
func (x *GroupInfo) Reset() {
*x = GroupInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GroupInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroupInfo) ProtoMessage() {}
func (x *GroupInfo) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroupInfo.ProtoReflect.Descriptor instead.
func (*GroupInfo) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{1}
}
func (x *GroupInfo) GetGroupID() string {
if x != nil {
return x.GroupID
}
return ""
}
func (x *GroupInfo) GetGroupName() string {
if x != nil {
return x.GroupName
}
return ""
}
func (x *GroupInfo) GetNotification() string {
if x != nil {
return x.Notification
}
return ""
}
func (x *GroupInfo) GetIntroduction() string {
if x != nil {
return x.Introduction
}
return ""
}
func (x *GroupInfo) GetFaceURL() string {
if x != nil {
return x.FaceURL
}
return ""
}
func (x *GroupInfo) GetOwnerUserID() string {
if x != nil {
return x.OwnerUserID
}
return ""
}
func (x *GroupInfo) GetCreateTime() uint32 {
if x != nil {
return x.CreateTime
}
return 0
}
func (x *GroupInfo) GetMemberCount() uint32 {
if x != nil {
return x.MemberCount
}
return 0
}
func (x *GroupInfo) GetEx() string {
if x != nil {
return x.Ex
}
return ""
}
func (x *GroupInfo) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *GroupInfo) GetCreatorUserID() string {
if x != nil {
return x.CreatorUserID
}
return ""
}
func (x *GroupInfo) GetGroupType() int32 {
if x != nil {
return x.GroupType
}
return 0
}
type GroupMemberFullInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID,omitempty"`
UserID string `protobuf:"bytes,2,opt,name=userID,proto3" json:"userID,omitempty"`
RoleLevel int32 `protobuf:"varint,3,opt,name=roleLevel,proto3" json:"roleLevel,omitempty"`
JoinTime int32 `protobuf:"varint,4,opt,name=joinTime,proto3" json:"joinTime,omitempty"`
Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname,omitempty"`
FaceURL string `protobuf:"bytes,6,opt,name=faceURL,proto3" json:"faceURL,omitempty"`
AppMangerLevel int32 `protobuf:"varint,7,opt,name=appMangerLevel,proto3" json:"appMangerLevel,omitempty"` //if >0
JoinSource int32 `protobuf:"varint,8,opt,name=joinSource,proto3" json:"joinSource,omitempty"`
OperatorUserID string `protobuf:"bytes,9,opt,name=operatorUserID,proto3" json:"operatorUserID,omitempty"`
Ex string `protobuf:"bytes,10,opt,name=ex,proto3" json:"ex,omitempty"`
}
func (x *GroupMemberFullInfo) Reset() {
*x = GroupMemberFullInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GroupMemberFullInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroupMemberFullInfo) ProtoMessage() {}
func (x *GroupMemberFullInfo) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroupMemberFullInfo.ProtoReflect.Descriptor instead.
func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{2}
}
func (x *GroupMemberFullInfo) GetGroupID() string {
if x != nil {
return x.GroupID
}
return ""
}
func (x *GroupMemberFullInfo) GetUserID() string {
if x != nil {
return x.UserID
}
return ""
}
func (x *GroupMemberFullInfo) GetRoleLevel() int32 {
if x != nil {
return x.RoleLevel
}
return 0
}
func (x *GroupMemberFullInfo) GetJoinTime() int32 {
if x != nil {
return x.JoinTime
}
return 0
}
func (x *GroupMemberFullInfo) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *GroupMemberFullInfo) GetFaceURL() string {
if x != nil {
return x.FaceURL
}
return ""
}
func (x *GroupMemberFullInfo) GetAppMangerLevel() int32 {
if x != nil {
return x.AppMangerLevel
}
return 0
}
func (x *GroupMemberFullInfo) GetJoinSource() int32 {
if x != nil {
return x.JoinSource
}
return 0
}
func (x *GroupMemberFullInfo) GetOperatorUserID() string {
if x != nil {
return x.OperatorUserID
}
return ""
}
func (x *GroupMemberFullInfo) GetEx() string {
if x != nil {
return x.Ex
}
return ""
}
type ParticipantMetaData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GroupInfo *GroupInfo `protobuf:"bytes,1,opt,name=groupInfo,proto3" json:"groupInfo,omitempty"`
GroupMemberInfo *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=groupMemberInfo,proto3" json:"groupMemberInfo,omitempty"`
UserInfo *PublicUserInfo `protobuf:"bytes,3,opt,name=userInfo,proto3" json:"userInfo,omitempty"`
}
func (x *ParticipantMetaData) Reset() {
*x = ParticipantMetaData{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ParticipantMetaData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ParticipantMetaData) ProtoMessage() {}
func (x *ParticipantMetaData) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ParticipantMetaData.ProtoReflect.Descriptor instead.
func (*ParticipantMetaData) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{3}
}
func (x *ParticipantMetaData) GetGroupInfo() *GroupInfo {
if x != nil {
return x.GroupInfo
}
return nil
}
func (x *ParticipantMetaData) GetGroupMemberInfo() *GroupMemberFullInfo {
if x != nil {
return x.GroupMemberInfo
}
return nil
}
func (x *ParticipantMetaData) GetUserInfo() *PublicUserInfo {
if x != nil {
return x.UserInfo
}
return nil
}
type PublicUserInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"`
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"`
FaceURL string `protobuf:"bytes,3,opt,name=faceURL,proto3" json:"faceURL,omitempty"`
Gender int32 `protobuf:"varint,4,opt,name=gender,proto3" json:"gender,omitempty"`
Ex string `protobuf:"bytes,5,opt,name=ex,proto3" json:"ex,omitempty"`
}
func (x *PublicUserInfo) Reset() {
*x = PublicUserInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PublicUserInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PublicUserInfo) ProtoMessage() {}
func (x *PublicUserInfo) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PublicUserInfo.ProtoReflect.Descriptor instead.
func (*PublicUserInfo) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{4}
}
func (x *PublicUserInfo) GetUserID() string {
if x != nil {
return x.UserID
}
return ""
}
func (x *PublicUserInfo) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *PublicUserInfo) GetFaceURL() string {
if x != nil {
return x.FaceURL
}
return ""
}
func (x *PublicUserInfo) GetGender() int32 {
if x != nil {
return x.Gender
}
return 0
}
func (x *PublicUserInfo) GetEx() string {
if x != nil {
return x.Ex
}
return ""
}
type GetJoinTokenReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
MetaData *ParticipantMetaData `protobuf:"bytes,3,opt,name=metaData,proto3" json:"metaData,omitempty"`
OperationID string `protobuf:"bytes,4,opt,name=operationID,proto3" json:"operationID,omitempty"`
}
func (x *GetJoinTokenReq) Reset() {
*x = GetJoinTokenReq{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJoinTokenReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJoinTokenReq) ProtoMessage() {}
func (x *GetJoinTokenReq) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJoinTokenReq.ProtoReflect.Descriptor instead.
func (*GetJoinTokenReq) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{5}
}
func (x *GetJoinTokenReq) GetRoom() string {
if x != nil {
return x.Room
}
return ""
}
func (x *GetJoinTokenReq) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *GetJoinTokenReq) GetMetaData() *ParticipantMetaData {
if x != nil {
return x.MetaData
}
return nil
}
func (x *GetJoinTokenReq) GetOperationID() string {
if x != nil {
return x.OperationID
}
return ""
}
type GetJoinTokenResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp,proto3" json:"CommonResp,omitempty"`
Jwt string `protobuf:"bytes,2,opt,name=jwt,proto3" json:"jwt,omitempty"`
LiveURL string `protobuf:"bytes,3,opt,name=liveURL,proto3" json:"liveURL,omitempty"`
}
func (x *GetJoinTokenResp) Reset() {
*x = GetJoinTokenResp{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJoinTokenResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJoinTokenResp) ProtoMessage() {}
func (x *GetJoinTokenResp) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJoinTokenResp.ProtoReflect.Descriptor instead.
func (*GetJoinTokenResp) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{6}
}
func (x *GetJoinTokenResp) GetCommonResp() *CommonResp {
if x != nil {
return x.CommonResp
}
return nil
}
func (x *GetJoinTokenResp) GetJwt() string {
if x != nil {
return x.Jwt
}
return ""
}
func (x *GetJoinTokenResp) GetLiveURL() string {
if x != nil {
return x.LiveURL
}
return ""
}
var File_rtc_proto protoreflect.FileDescriptor
var file_rtc_proto_rawDesc = []byte{
0x0a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x72, 0x74, 0x63,
0x22, 0x3e, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18,
0x0a, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d,
0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67,
0x22, 0xf5, 0x02, 0x0a, 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18,
0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75,
0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x6f,
0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6e, 0x6f,
0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e,
0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18,
0x0a, 0x07, 0x66, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x66, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x77, 0x6e, 0x65,
0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f,
0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x65,
0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x0b, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02,
0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x55,
0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x72, 0x65,
0x61, 0x74, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x67,
0x72, 0x6f, 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x22, 0xb7, 0x02, 0x0a, 0x13, 0x47, 0x72, 0x6f,
0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x46, 0x75, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c,
0x12, 0x1a, 0x0a, 0x08, 0x6a, 0x6f, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x6a, 0x6f, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x61, 0x63, 0x65,
0x55, 0x52, 0x4c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x66, 0x61, 0x63, 0x65, 0x55,
0x52, 0x4c, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x70, 0x70, 0x4d, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x4c,
0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x61, 0x70, 0x70, 0x4d,
0x61, 0x6e, 0x67, 0x65, 0x72, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x6a, 0x6f,
0x69, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
0x6a, 0x6f, 0x69, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x6f, 0x70,
0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x09, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x55, 0x73, 0x65, 0x72,
0x49, 0x44, 0x12, 0x0e, 0x0a, 0x02, 0x65, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x65, 0x78, 0x22, 0xb8, 0x01, 0x0a, 0x13, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
0x6e, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x09, 0x67, 0x72,
0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x72, 0x74, 0x63, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x67,
0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x42, 0x0a, 0x0f, 0x67, 0x72, 0x6f, 0x75,
0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x18, 0x2e, 0x72, 0x74, 0x63, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d,
0x62, 0x65, 0x72, 0x46, 0x75, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x67, 0x72, 0x6f,
0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2f, 0x0a, 0x08,
0x75, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
0x2e, 0x72, 0x74, 0x63, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x55, 0x73, 0x65, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x86, 0x01,
0x0a, 0x0e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x66, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x16,
0x0a, 0x06, 0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x67, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x65, 0x78, 0x22, 0x99, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4a, 0x6f,
0x69, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x1a,
0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x08, 0x6d, 0x65,
0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x72,
0x74, 0x63, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d, 0x65,
0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61,
0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x22, 0x6f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x52, 0x65, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x74, 0x63,
0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x43, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x74, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x76,
0x65, 0x55, 0x52, 0x4c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x69, 0x76, 0x65,
0x55, 0x52, 0x4c, 0x32, 0x49, 0x0a, 0x0a, 0x52, 0x74, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x12, 0x14, 0x2e, 0x72, 0x74, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x54,
0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x72, 0x74, 0x63, 0x2e, 0x47, 0x65,
0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0b,
0x5a, 0x09, 0x2e, 0x2f, 0x72, 0x74, 0x63, 0x3b, 0x72, 0x74, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_rtc_proto_rawDescOnce sync.Once
file_rtc_proto_rawDescData = file_rtc_proto_rawDesc
)
func file_rtc_proto_rawDescGZIP() []byte {
file_rtc_proto_rawDescOnce.Do(func() {
file_rtc_proto_rawDescData = protoimpl.X.CompressGZIP(file_rtc_proto_rawDescData)
})
return file_rtc_proto_rawDescData
}
var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_rtc_proto_goTypes = []interface{}{
(*CommonResp)(nil), // 0: rtc.CommonResp
(*GroupInfo)(nil), // 1: rtc.GroupInfo
(*GroupMemberFullInfo)(nil), // 2: rtc.GroupMemberFullInfo
(*ParticipantMetaData)(nil), // 3: rtc.ParticipantMetaData
(*PublicUserInfo)(nil), // 4: rtc.PublicUserInfo
(*GetJoinTokenReq)(nil), // 5: rtc.GetJoinTokenReq
(*GetJoinTokenResp)(nil), // 6: rtc.GetJoinTokenResp
}
var file_rtc_proto_depIdxs = []int32{
1, // 0: rtc.ParticipantMetaData.groupInfo:type_name -> rtc.GroupInfo
2, // 1: rtc.ParticipantMetaData.groupMemberInfo:type_name -> rtc.GroupMemberFullInfo
4, // 2: rtc.ParticipantMetaData.userInfo:type_name -> rtc.PublicUserInfo
3, // 3: rtc.GetJoinTokenReq.metaData:type_name -> rtc.ParticipantMetaData
0, // 4: rtc.GetJoinTokenResp.CommonResp:type_name -> rtc.CommonResp
5, // 5: rtc.RtcService.GetJoinToken:input_type -> rtc.GetJoinTokenReq
6, // 6: rtc.RtcService.GetJoinToken:output_type -> rtc.GetJoinTokenResp
6, // [6:7] is the sub-list for method output_type
5, // [5:6] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_rtc_proto_init() }
func file_rtc_proto_init() {
if File_rtc_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_rtc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommonResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GroupInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GroupMemberFullInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ParticipantMetaData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PublicUserInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJoinTokenReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJoinTokenResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rtc_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_rtc_proto_goTypes,
DependencyIndexes: file_rtc_proto_depIdxs,
MessageInfos: file_rtc_proto_msgTypes,
}.Build()
File_rtc_proto = out.File
file_rtc_proto_rawDesc = nil
file_rtc_proto_goTypes = nil
file_rtc_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// RtcServiceClient is the client API for RtcService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type RtcServiceClient interface {
GetJoinToken(ctx context.Context, in *GetJoinTokenReq, opts ...grpc.CallOption) (*GetJoinTokenResp, error)
}
type rtcServiceClient struct {
cc grpc.ClientConnInterface
}
func NewRtcServiceClient(cc grpc.ClientConnInterface) RtcServiceClient {
return &rtcServiceClient{cc}
}
func (c *rtcServiceClient) GetJoinToken(ctx context.Context, in *GetJoinTokenReq, opts ...grpc.CallOption) (*GetJoinTokenResp, error) {
out := new(GetJoinTokenResp)
err := c.cc.Invoke(ctx, "/rtc.RtcService/GetJoinToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RtcServiceServer is the server API for RtcService service.
type RtcServiceServer interface {
GetJoinToken(context.Context, *GetJoinTokenReq) (*GetJoinTokenResp, error)
}
// UnimplementedRtcServiceServer can be embedded to have forward compatible implementations.
type UnimplementedRtcServiceServer struct {
}
func (*UnimplementedRtcServiceServer) GetJoinToken(context.Context, *GetJoinTokenReq) (*GetJoinTokenResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetJoinToken not implemented")
}
func RegisterRtcServiceServer(s *grpc.Server, srv RtcServiceServer) {
s.RegisterService(&_RtcService_serviceDesc, srv)
}
func _RtcService_GetJoinToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetJoinTokenReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RtcServiceServer).GetJoinToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/rtc.RtcService/GetJoinToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RtcServiceServer).GetJoinToken(ctx, req.(*GetJoinTokenReq))
}
return interceptor(ctx, in, info, handler)
}
var _RtcService_serviceDesc = grpc.ServiceDesc{
ServiceName: "rtc.RtcService",
HandlerType: (*RtcServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetJoinToken",
Handler: _RtcService_GetJoinToken_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "rtc.proto",
}
+69
View File
@@ -0,0 +1,69 @@
syntax = "proto3";
option go_package = "./rtc;rtc";
package rtc;
message CommonResp{
int32 errCode = 1;
string errMsg = 2;
}
message GroupInfo{
string groupID = 1;
string groupName = 2;
string notification = 3;
string introduction = 4;
string faceURL = 5;
string ownerUserID = 6;
uint32 createTime = 7;
uint32 memberCount = 8;
string ex = 9;
int32 status = 10;
string creatorUserID = 11;
int32 groupType = 12;
}
message GroupMemberFullInfo {
string groupID = 1 ;
string userID = 2 ;
int32 roleLevel = 3;
int32 joinTime = 4;
string nickname = 5;
string faceURL = 6;
int32 appMangerLevel = 7; //if >0
int32 joinSource = 8;
string operatorUserID = 9;
string ex = 10;
}
message ParticipantMetaData{
GroupInfo groupInfo = 1;
GroupMemberFullInfo groupMemberInfo = 2;
PublicUserInfo userInfo = 3;
}
message PublicUserInfo{
string userID = 1;
string nickname = 2;
string faceURL = 3;
int32 gender = 4;
string ex = 5;
}
message GetJoinTokenReq{
string room = 1;
string identity = 2;
ParticipantMetaData metaData = 3;
string operationID = 4;
}
message GetJoinTokenResp{
CommonResp CommonResp = 1;
string jwt = 2;
string liveURL = 3;
}
service RtcService {
rpc GetJoinToken(GetJoinTokenReq) returns(GetJoinTokenResp);
}
+1719 -170
View File
File diff suppressed because it is too large Load Diff
+54 -21
View File
@@ -1,7 +1,6 @@
syntax = "proto3";
option go_package = "./sdk_ws;server_api_params";
package server_api_params;//The package name to which the proto file belongs
//option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk
package server_api_params;
////////////////////////////////base///////////////////////////////
@@ -33,6 +32,7 @@ message GroupMemberFullInfo {
int32 joinSource = 8;
string operatorUserID = 9;
string ex = 10;
uint32 muteEndTime = 11;
}
message PublicUserInfo{
@@ -255,14 +255,11 @@ message MemberEnterTips{
int64 operationTime = 3;
}
message GroupDismissedTips{
GroupInfo group = 1;
GroupMemberFullInfo opUser = 2;
int64 operationTime = 3;
}
//////////////////////friend/////////////////////
@@ -380,11 +377,25 @@ message InvitationInfo {
repeated string inviteeUserIDList = 2;
string customData = 3;
string groupID = 4;
string roomID = 5;
int32 timeout = 6;
string mediaType = 7;
int32 platformID = 8;
int32 sessionType = 9;
}
message ParticipantMetaData{
GroupInfo groupInfo = 1;
GroupMemberFullInfo groupMemberInfo = 2;
PublicUserInfo userInfo = 3;
}
message SignalInviteReq {
InvitationInfo invitation = 1;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
ParticipantMetaData participant = 4;
}
message SignalInviteReply {
@@ -394,7 +405,10 @@ message SignalInviteReply {
}
message SignalInviteInGroupReq {
InvitationInfo invitation = 1;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
ParticipantMetaData participant = 4;
}
message SignalInviteInGroupReply {
@@ -404,8 +418,10 @@ message SignalInviteInGroupReply {
}
message SignalCancelReq {
string inviterUserID = 1;
SignalInviteReq invitation = 2;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
ParticipantMetaData participant = 4;
}
message SignalCancelReply {
@@ -413,8 +429,11 @@ message SignalCancelReply {
}
message SignalAcceptReq {
string inviteeUserID = 1;
SignalInviteReq invitation = 2;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
ParticipantMetaData participant = 4;
int32 opUserPlatformID = 5;
}
message SignalAcceptReply {
@@ -424,8 +443,9 @@ message SignalAcceptReply {
}
message SignalHungUpReq {
string UserID = 1;
SignalInviteReq invitation = 2;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
}
message SignalHungUpReply {
@@ -434,8 +454,11 @@ message SignalHungUpReply {
message SignalRejectReq {
string inviteeUserID = 1;
SignalInviteReq invitation = 2;
string opUserID = 1;
InvitationInfo invitation = 2;
OfflinePushInfo offlinePushInfo = 3;
ParticipantMetaData participant = 4;
int32 opUserPlatformID = 5;
}
message SignalRejectReply {
@@ -443,6 +466,16 @@ message SignalRejectReply {
}
message DelMsgListReq{
string opUserID = 1;
string userID = 2;
repeated uint32 seqList = 3;
string operationID = 4;
}
message DelMsgListResp{
int32 errCode = 1;
string errMsg = 2;
}
+1435 -769
View File
File diff suppressed because it is too large Load Diff
+77 -32
View File
@@ -67,44 +67,83 @@ message UpdateUserInfoResp{
CommonResp commonResp = 1;
}
message Conversation{
string OwnerUserID = 1;
string ConversationID = 2;
int32 RecvMsgOpt = 3;
int32 ConversationType = 4;
string UserID = 5;
string GroupID = 6;
int32 UnreadCount = 7;
int64 DraftTextTime = 8;
bool IsPinned = 9;
string AttachedInfo = 10;
bool IsPrivateChat = 11;
string Ex = 12;
}
message SetReceiveMessageOptReq{
string FromUserID = 1;
int32 opt = 2;
repeated string conversationIDList = 3;
string operationID = 4;
string OpUserID = 5;
message SetConversationReq{
Conversation Conversation = 1;
string OperationID = 2;
}
message OptResult{
string conversationID = 1;
int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush
}
message SetReceiveMessageOptResp{
message SetConversationResp{
CommonResp commonResp = 1;
repeated OptResult conversationOptResultList = 2;
}
message GetReceiveMessageOptReq{
string FromUserID = 1;
repeated string conversationIDList = 2;
string operationID = 3;
string OpUserID = 4;
message SetRecvMsgOptReq {
string OwnerUserID = 1;
string ConversationID = 2;
int32 RecvMsgOpt = 3;
string OperationID = 4;
}
message GetReceiveMessageOptResp{
message SetRecvMsgOptResp {
CommonResp commonResp = 1;
repeated OptResult conversationOptResultList = 3;
}
message GetAllConversationMsgOptReq{
string FromUserID = 1;
string operationID = 2;
string OpUserID = 3;
message GetConversationReq{
string ConversationID = 1;
string OwnerUserID = 2;
string OperationID = 3;
}
message GetAllConversationMsgOptResp{
message GetConversationResp{
CommonResp commonResp = 1;
repeated OptResult conversationOptResultList = 3;
Conversation Conversation = 2;
}
message GetConversationsReq{
string OwnerUserID = 1;
repeated string ConversationIDs = 2;
string OperationID = 3;
}
message GetConversationsResp{
CommonResp commonResp = 1;
repeated Conversation Conversations = 2;
}
message GetAllConversationsReq{
string OwnerUserID = 1;
string OperationID = 2;
}
message GetAllConversationsResp{
CommonResp commonResp = 1;
repeated Conversation Conversations = 2;
}
message BatchSetConversationsReq{
repeated Conversation Conversations = 1;
string OwnerUserID = 2;
string OperationID = 3;
}
message BatchSetConversationsResp{
CommonResp commonResp = 1;
repeated string Success = 2;
repeated string Failed = 3;
}
message ResignUserReq{
@@ -130,7 +169,7 @@ message User{
}
message GetUserByIdResp{
CommonResp CommonResp = 1;
CommonResp CommonResp = 1;
User user = 2;
}
@@ -241,18 +280,24 @@ message DeleteUserReq {
}
message DeleteUserResp {
CommonResp CommonResp = 1;
}
service user {
rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp);
rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp);
rpc SetReceiveMessageOpt(SetReceiveMessageOptReq)returns(SetReceiveMessageOptResp);
rpc GetReceiveMessageOpt(GetReceiveMessageOptReq)returns(GetReceiveMessageOptResp);
rpc GetAllConversationMsgOpt(GetAllConversationMsgOptReq)returns(GetAllConversationMsgOptResp);
rpc AccountCheck(AccountCheckReq)returns(AccountCheckResp);
rpc GetConversation(GetConversationReq)returns(GetConversationResp);
rpc GetAllConversations(GetAllConversationsReq)returns(GetAllConversationsResp);
rpc GetConversations(GetConversationsReq)returns(GetConversationsResp);
rpc BatchSetConversations(BatchSetConversationsReq)returns(BatchSetConversationsResp);
rpc SetConversation(SetConversationReq)returns(SetConversationResp);
rpc SetRecvMsgOpt(SetRecvMsgOptReq)returns(SetRecvMsgOptResp);
rpc GetUserById(GetUserByIdReq) returns (GetUserByIdResp);
rpc GetUsersByName(GetUsersByNameReq) returns (GetUsersByNameResp);
+18 -1
View File
@@ -1,6 +1,13 @@
package utils
import "os"
import (
"Open_IM/pkg/common/constant"
"fmt"
"math/rand"
"os"
"path"
"time"
)
// Determine whether the given path is a folder
func IsDir(path string) bool {
@@ -20,3 +27,13 @@ func IsFile(path string) bool {
func MkDir(path string) error {
return os.MkdirAll(path, os.ModePerm)
}
func GetNewFileNameAndContentType(fileName string, fileType int) (string, string) {
suffix := path.Ext(fileName)
newName := fmt.Sprintf("%d-%d%s", time.Now().UnixNano(), rand.Int(), fileName)
contentType := ""
if fileType == constant.ImageType {
contentType = "image/" + suffix[1:]
}
return newName, contentType
}
+4
View File
@@ -25,6 +25,10 @@ func StringToInt64(i string) int64 {
j, _ := strconv.ParseInt(i, 10, 64)
return j
}
func StringToInt32(i string) int32 {
j, _ := strconv.ParseInt(i, 10, 64)
return int32(j)
}
func Int32ToString(i int32) string {
return strconv.FormatInt(int64(i), 10)
}
+18
View File
@@ -3,9 +3,11 @@ package utils
import (
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"math/rand"
"runtime"
"strconv"
"strings"
"time"
)
// copy a by b b->a
@@ -71,3 +73,19 @@ func Difference(slice1, slice2 []uint32) []uint32 {
}
return n
}
func OperationIDGenerator() string {
return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10)
}
func RemoveUserIDRepByMap(slc []string) []string {
var result []string
tempMap := map[string]byte{}
for _, e := range slc {
l := len(tempMap)
tempMap[e] = 0
if len(tempMap) != l {
result = append(result, e)
}
}
return result
}