Merge remote-tracking branch 'origin/errcode' into errcode

This commit is contained in:
Gordon 2023-03-17 19:21:58 +08:00
commit f03c72541a
23 changed files with 233 additions and 138 deletions

View File

@ -162,7 +162,7 @@ log:
#日志级别 6表示全都打印测试阶段建议设置为6
remainLogLevel: -1
stderr: true
withStack: false
elasticSearchSwitch: false
elasticSearchAddr: [ 127.0.0.1:9201 ]
elasticSearchUser: ""

View File

@ -2,6 +2,7 @@ package api
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"

View File

@ -46,7 +46,7 @@ func (o *Friend) GetFriendApplyList(c *gin.Context) {
}
func (o *Friend) GetSelfApplyList(c *gin.Context) {
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyFrom, o.client, c)
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyTo, o.client, c)
}
func (o *Friend) GetFriendList(c *gin.Context) {

View File

@ -2,6 +2,7 @@ package friend
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation"
@ -177,7 +178,8 @@ func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbf
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
friendRequests, total, err := s.FriendDatabase.PageFriendRequestToMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
pageNumber, showNumber := utils.GetPage(req.Pagination)
friendRequests, total, err := s.FriendDatabase.PageFriendRequestToMe(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
}
@ -195,7 +197,8 @@ func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *p
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
friendRequests, total, err := s.FriendDatabase.PageFriendRequestFromMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
pageNumber, showNumber := utils.GetPage(req.Pagination)
friendRequests, total, err := s.FriendDatabase.PageFriendRequestFromMe(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
}
@ -222,7 +225,8 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
friends, total, err := s.FriendDatabase.PageOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
pageNumber, showNumber := utils.GetPage(req.Pagination)
friends, total, err := s.FriendDatabase.PageOwnerFriends(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
}

View File

@ -187,6 +187,7 @@ type config struct {
RemainRotationCount uint `yaml:"remainRotationCount"`
RemainLogLevel int `yaml:"remainLogLevel"`
Stderr bool `yaml:"stderr"`
WithStack bool `yaml:"withStack"`
ElasticSearchSwitch bool `yaml:"elasticSearchSwitch"`
ElasticSearchAddr []string `yaml:"elasticSearchAddr"`
ElasticSearchUser string `yaml:"elasticSearchUser"`

View File

@ -2,7 +2,7 @@ package controller
import (
"context"
"errors"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
@ -73,7 +73,7 @@ func (f *friendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUse
return f.tx.Transaction(func(tx any) error {
_, err := f.friendRequest.NewTx(tx).Take(ctx, fromUserID, toUserID)
//有db错误
if err != nil && errors.Unwrap(err) != gorm.ErrRecordNotFound {
if err != nil && errs.Unwrap(err) != gorm.ErrRecordNotFound {
return err
}
//无错误 则更新
@ -89,7 +89,7 @@ func (f *friendDatabase) AddFriendRequest(ctx context.Context, fromUserID, toUse
return nil
}
//gorm.ErrRecordNotFound 错误,则新增
if err := f.friendRequest.NewTx(tx).Create(ctx, []*relation.FriendRequestModel{{FromUserID: fromUserID, ToUserID: toUserID, ReqMsg: reqMsg, Ex: ex}}); err != nil {
if err := f.friendRequest.NewTx(tx).Create(ctx, []*relation.FriendRequestModel{{FromUserID: fromUserID, ToUserID: toUserID, ReqMsg: reqMsg, Ex: ex, CreateTime: time.Now(), HandleTime: time.Unix(0, 0)}}); err != nil {
return err
}
return nil
@ -142,7 +142,8 @@ func (f *friendDatabase) RefuseFriendRequest(ctx context.Context, friendRequest
return err
}
friendRequest.HandleResult = constant.FriendResponseRefuse
err = f.friendRequest.Update(ctx, []*relation.FriendRequestModel{friendRequest})
friendRequest.HandleTime = time.Now()
err = f.friendRequest.Update(ctx, friendRequest)
if err != nil {
return err
}
@ -158,7 +159,8 @@ func (f *friendDatabase) AgreeFriendRequest(ctx context.Context, friendRequest *
}
friendRequest.HandlerUserID = friendRequest.FromUserID
friendRequest.HandleResult = constant.FriendResponseAgree
err = f.friendRequest.NewTx(tx).Update(ctx, []*relation.FriendRequestModel{friendRequest})
friendRequest.HandleTime = time.Now()
err = f.friendRequest.NewTx(tx).Update(ctx, friendRequest)
if err != nil {
return err
}

View File

@ -31,13 +31,13 @@ func (f *FriendRequestGorm) Delete(ctx context.Context, fromUserID, toUserID str
}
// 更新零值
func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error) {
return utils.Wrap(f.db(ctx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id =?", formUserID, toUserID).Updates(args).Error, "")
func (f *FriendRequestGorm) UpdateByMap(ctx context.Context, fromUserID string, toUserID string, args map[string]interface{}) (err error) {
return utils.Wrap(f.db(ctx).Model(&relation.FriendRequestModel{}).Where("from_user_id = ? AND to_user_id =?", fromUserID, toUserID).Updates(args).Error, "")
}
// 更新多条记录 (非零值)
func (f *FriendRequestGorm) Update(ctx context.Context, friendRequests []*relation.FriendRequestModel) (err error) {
return utils.Wrap(f.db(ctx).Updates(&friendRequests).Error, "")
// 更新记录 (非零值)
func (f *FriendRequestGorm) Update(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) {
return utils.Wrap(f.db(ctx).Where("from_user_id = ? AND to_user_id =?", friendRequest.FromUserID, friendRequest.ToUserID).Updates(friendRequest).Error, "")
}
// 获取来指定用户的好友申请 未找到 不返回错误

View File

@ -31,7 +31,7 @@ type FriendRequestModelInterface interface {
// 更新零值
UpdateByMap(ctx context.Context, formUserID string, toUserID string, args map[string]interface{}) (err error)
// 更新多条记录 (非零值)
Update(ctx context.Context, friendRequests []*FriendRequestModel) (err error)
Update(ctx context.Context, friendRequest *FriendRequestModel) (err error)
// 获取来指定用户的好友申请 未找到 不返回错误
Find(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error)
Take(ctx context.Context, fromUserID, toUserID string) (friendRequest *FriendRequestModel, err error)

View File

@ -3,6 +3,12 @@ package mw
import (
"context"
"fmt"
"math"
"runtime"
"runtime/debug"
"strings"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw/specialerror"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
@ -12,10 +18,6 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"math"
"runtime"
"runtime/debug"
"strings"
)
const OperationID = "operationID"
@ -87,23 +89,25 @@ func rpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
}
grpcStatus := status.New(codes.Code(code), codeErr.Msg())
var errInfo *errinfo.ErrorInfo
if unwrap != err {
sti, ok := err.(interface{ StackTrace() errors.StackTrace })
if ok {
log.ZWarn(ctx, "rpc server resp", err, "funcName", funcName, "unwrap", unwrap.Error(), "stack", fmt.Sprintf("%+v", err))
if fs := sti.StackTrace(); len(fs) > 0 {
pc := uintptr(fs[0])
fn := runtime.FuncForPC(pc)
file, line := fn.FileLine(pc)
errInfo = &errinfo.ErrorInfo{
Path: file,
Line: uint32(line),
Name: fn.Name(),
Cause: unwrap.Error(),
Warp: nil,
}
if arr := strings.Split(err.Error(), ": "); len(arr) > 1 {
errInfo.Warp = arr[:len(arr)-1]
if config.Config.Log.WithStack {
if unwrap != err {
sti, ok := err.(interface{ StackTrace() errors.StackTrace })
if ok {
log.ZWarn(ctx, "rpc server resp", err, "funcName", funcName, "unwrap", unwrap.Error(), "stack", fmt.Sprintf("%+v", err))
if fs := sti.StackTrace(); len(fs) > 0 {
pc := uintptr(fs[0])
fn := runtime.FuncForPC(pc)
file, line := fn.FileLine(pc)
errInfo = &errinfo.ErrorInfo{
Path: file,
Line: uint32(line),
Name: fn.Name(),
Cause: unwrap.Error(),
Warp: nil,
}
if arr := strings.Split(err.Error(), ": "); len(arr) > 1 {
errInfo.Warp = arr[:len(arr)-1]
}
}
}
}

View File

@ -86,3 +86,13 @@ func Unwrap(err error) error {
}
return err
}
func Wrap(err error, msg ...string) error {
if err == nil {
return nil
}
if len(msg) == 0 {
return errors.WithStack(err)
}
return errors.Wrap(err, strings.Join(msg, ", "))
}

View File

@ -297,7 +297,7 @@ type SetConversationReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Conversation *Conversation `protobuf:"bytes,1,opt,name=Conversation,proto3" json:"Conversation"`
Conversation *Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation"`
NotificationType int32 `protobuf:"varint,2,opt,name=notificationType,proto3" json:"notificationType"`
}
@ -390,9 +390,9 @@ type SetRecvMsgOptReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID,proto3" json:"OwnerUserID"`
ConversationID string `protobuf:"bytes,2,opt,name=ConversationID,proto3" json:"ConversationID"`
RecvMsgOpt int32 `protobuf:"varint,3,opt,name=RecvMsgOpt,proto3" json:"RecvMsgOpt"`
OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"`
ConversationID string `protobuf:"bytes,2,opt,name=conversationID,proto3" json:"conversationID"`
RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt,proto3" json:"recvMsgOpt"`
NotificationType int32 `protobuf:"varint,4,opt,name=notificationType,proto3" json:"notificationType"`
}
@ -499,8 +499,8 @@ type GetConversationReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ConversationID string `protobuf:"bytes,1,opt,name=ConversationID,proto3" json:"ConversationID"`
OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID,proto3" json:"OwnerUserID"`
ConversationID string `protobuf:"bytes,1,opt,name=conversationID,proto3" json:"conversationID"`
OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"`
}
func (x *GetConversationReq) Reset() {
@ -554,7 +554,7 @@ type GetConversationResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Conversation *Conversation `protobuf:"bytes,2,opt,name=Conversation,proto3" json:"Conversation"`
Conversation *Conversation `protobuf:"bytes,2,opt,name=conversation,proto3" json:"conversation"`
}
func (x *GetConversationResp) Reset() {
@ -601,8 +601,8 @@ type GetConversationsReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID,proto3" json:"OwnerUserID"`
ConversationIDs []string `protobuf:"bytes,2,rep,name=ConversationIDs,proto3" json:"ConversationIDs"`
OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"`
ConversationIDs []string `protobuf:"bytes,2,rep,name=conversationIDs,proto3" json:"conversationIDs"`
}
func (x *GetConversationsReq) Reset() {
@ -656,7 +656,7 @@ type GetConversationsResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Conversations []*Conversation `protobuf:"bytes,2,rep,name=Conversations,proto3" json:"Conversations"`
Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations,proto3" json:"conversations"`
}
func (x *GetConversationsResp) Reset() {
@ -703,7 +703,7 @@ type GetAllConversationsReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID,proto3" json:"OwnerUserID"`
OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID,proto3" json:"ownerUserID"`
}
func (x *GetAllConversationsReq) Reset() {
@ -750,7 +750,7 @@ type GetAllConversationsResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Conversations []*Conversation `protobuf:"bytes,2,rep,name=Conversations,proto3" json:"Conversations"`
Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations,proto3" json:"conversations"`
}
func (x *GetAllConversationsResp) Reset() {
@ -798,7 +798,7 @@ type BatchSetConversationsReq struct {
unknownFields protoimpl.UnknownFields
Conversations []*Conversation `protobuf:"bytes,1,rep,name=Conversations,proto3" json:"Conversations"`
OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID,proto3" json:"OwnerUserID"`
OwnerUserID string `protobuf:"bytes,2,opt,name=ownerUserID,proto3" json:"ownerUserID"`
NotificationType int32 `protobuf:"varint,3,opt,name=notificationType,proto3" json:"notificationType"`
}
@ -860,8 +860,8 @@ type BatchSetConversationsResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success []string `protobuf:"bytes,1,rep,name=Success,proto3" json:"Success"`
Failed []string `protobuf:"bytes,2,rep,name=Failed,proto3" json:"Failed"`
Success []string `protobuf:"bytes,1,rep,name=success,proto3" json:"success"`
Failed []string `protobuf:"bytes,2,rep,name=failed,proto3" json:"failed"`
}
func (x *BatchSetConversationsResp) Reset() {
@ -1060,62 +1060,62 @@ var file_conversation_conversation_proto_rawDesc = []byte{
0x1b, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x8d, 0x01, 0x0a,
0x12, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x71, 0x12, 0x4b, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
0x52, 0x65, 0x71, 0x12, 0x4b, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e,
0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x6f, 0x6e, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x2a, 0x0a, 0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6e, 0x6f, 0x74, 0x69,
0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x15, 0x0a, 0x13,
0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x65, 0x73, 0x70, 0x22, 0xa8, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, 0x76, 0x4d,
0x73, 0x67, 0x4f, 0x70, 0x74, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x77, 0x6e, 0x65,
0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f,
0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x6f,
0x73, 0x67, 0x4f, 0x70, 0x74, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x77, 0x6e, 0x65,
0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f,
0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f,
0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f,
0x70, 0x74, 0x12, 0x2a, 0x0a, 0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6e, 0x6f,
0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x13,
0x0a, 0x11, 0x53, 0x65, 0x74, 0x52, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70, 0x74, 0x52,
0x65, 0x73, 0x70, 0x22, 0x5e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6e,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49,
0x44, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65,
0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49,
0x44, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65,
0x72, 0x49, 0x44, 0x22, 0x62, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0c, 0x43, 0x6f,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0c, 0x63, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x76, 0x65,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x61, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x20,
0x0a, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44,
0x12, 0x28, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x43, 0x6f, 0x6e, 0x76, 0x65,
0x0a, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44,
0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x22, 0x65, 0x0a, 0x14, 0x47, 0x65,
0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
0x73, 0x70, 0x12, 0x4d, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x73, 0x70, 0x12, 0x4d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e,
0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x22, 0x3a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x76, 0x65,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x4f,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x6f,
0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x68, 0x0a,
0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x68, 0x0a,
0x17, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4d, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76,
0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4d, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x76,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x63,
0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x76,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb7, 0x01, 0x0a, 0x18, 0x42, 0x61, 0x74, 0x63,
0x68, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x52, 0x65, 0x71, 0x12, 0x4d, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61,
@ -1123,16 +1123,16 @@ var file_conversation_conversation_proto_rawDesc = []byte{
0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72,
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x55,
0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72,
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x55,
0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70,
0x65, 0x22, 0x4d, 0x0a, 0x19, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18,
0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x61, 0x69, 0x6c,
0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x61, 0x69, 0x6c,
0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x22, 0x39, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4e, 0x6f,
0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x52, 0x65,
0x71, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01,
@ -1245,10 +1245,10 @@ var file_conversation_conversation_proto_goTypes = []interface{}{
}
var file_conversation_conversation_proto_depIdxs = []int32{
0, // 0: OpenIMServer.conversation.ModifyConversationFieldReq.conversation:type_name -> OpenIMServer.conversation.Conversation
0, // 1: OpenIMServer.conversation.SetConversationReq.Conversation:type_name -> OpenIMServer.conversation.Conversation
0, // 2: OpenIMServer.conversation.GetConversationResp.Conversation:type_name -> OpenIMServer.conversation.Conversation
0, // 3: OpenIMServer.conversation.GetConversationsResp.Conversations:type_name -> OpenIMServer.conversation.Conversation
0, // 4: OpenIMServer.conversation.GetAllConversationsResp.Conversations:type_name -> OpenIMServer.conversation.Conversation
0, // 1: OpenIMServer.conversation.SetConversationReq.conversation:type_name -> OpenIMServer.conversation.Conversation
0, // 2: OpenIMServer.conversation.GetConversationResp.conversation:type_name -> OpenIMServer.conversation.Conversation
0, // 3: OpenIMServer.conversation.GetConversationsResp.conversations:type_name -> OpenIMServer.conversation.Conversation
0, // 4: OpenIMServer.conversation.GetAllConversationsResp.conversations:type_name -> OpenIMServer.conversation.Conversation
0, // 5: OpenIMServer.conversation.BatchSetConversationsReq.Conversations:type_name -> OpenIMServer.conversation.Conversation
1, // 6: OpenIMServer.conversation.conversation.ModifyConversationField:input_type -> OpenIMServer.conversation.ModifyConversationFieldReq
7, // 7: OpenIMServer.conversation.conversation.GetConversation:input_type -> OpenIMServer.conversation.GetConversationReq

View File

@ -1,6 +1,6 @@
syntax = "proto3";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation";
package OpenIMServer.conversation;
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation";
message Conversation{
string ownerUserID = 1;
@ -31,7 +31,7 @@ message ModifyConversationFieldResp{
}
message SetConversationReq{
Conversation Conversation = 1;
Conversation conversation = 1;
int32 notificationType = 2;
}
@ -39,9 +39,9 @@ message SetConversationResp{
}
message SetRecvMsgOptReq {
string OwnerUserID = 1;
string ConversationID = 2;
int32 RecvMsgOpt = 3;
string ownerUserID = 1;
string conversationID = 2;
int32 recvMsgOpt = 3;
int32 notificationType = 4;
}
@ -49,40 +49,40 @@ message SetRecvMsgOptResp {
}
message GetConversationReq{
string ConversationID = 1;
string OwnerUserID = 2;
string conversationID = 1;
string ownerUserID = 2;
}
message GetConversationResp{
Conversation Conversation = 2;
Conversation conversation = 2;
}
message GetConversationsReq{
string OwnerUserID = 1;
repeated string ConversationIDs = 2;
string ownerUserID = 1;
repeated string conversationIDs = 2;
}
message GetConversationsResp{
repeated Conversation Conversations = 2;
repeated Conversation conversations = 2;
}
message GetAllConversationsReq{
string OwnerUserID = 1;
string ownerUserID = 1;
}
message GetAllConversationsResp{
repeated Conversation Conversations = 2;
repeated Conversation conversations = 2;
}
message BatchSetConversationsReq{
repeated Conversation Conversations = 1;
string OwnerUserID = 2;
string ownerUserID = 2;
int32 notificationType = 3;
}
message BatchSetConversationsResp{
repeated string Success = 1;
repeated string Failed = 2;
repeated string success = 1;
repeated string failed = 2;
}
message GetRecvMsgNotNotifyUserIDsReq {

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package OpenIMServer.friend;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/friend";
package OpenIMServer.friend;
message getPaginationFriendsReq{
sdkws.RequestPagination pagination = 1;

View File

@ -1,8 +1,8 @@
syntax = "proto3";
package OpenIMServer.group;
import "sdkws/sdkws.proto";
import "wrapperspb/wrapperspb.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group";
package OpenIMServer.group;

View File

@ -1,8 +1,8 @@
syntax = "proto3";
package OpenIMServer.msg;
import "sdkws/sdkws.proto";
import "wrapperspb/wrapperspb.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg";
package OpenIMServer.msg;
message MsgDataToMQ{
string token = 1;

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package OpenIMServer.msggateway;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msggateway";
package OpenIMServer.msggateway;
message OnlinePushMsgReq {
sdkws.MsgData msgData = 1;

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package OpenIMServer.push;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/push";
package OpenIMServer.push;
message PushMsgReq {
sdkws.MsgData msgData = 1;

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package OpenIMServer.rtc;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/rtc";
package OpenIMServer.rtc;
message SignalMessageAssembleReq {
sdkws.SignalReq signalReq = 1;

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package OpenIMServer.third;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third";
package OpenIMServer.third;
message ApplyPutReq {
string name = 1;

View File

@ -1665,7 +1665,7 @@ var file_user_user_proto_rawDesc = []byte{
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a,
0x10, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x52, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x52,
0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70, 0x74, 0x32, 0xde, 0x05, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, 0x4f, 0x70, 0x74, 0x32, 0xb7, 0x06, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x12, 0x66, 0x0a, 0x11, 0x67, 0x65, 0x74, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x61,
0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x67, 0x65, 0x74, 0x44,
@ -1711,11 +1711,17 @@ var file_user_user_proto_rawDesc = []byte{
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x52, 0x65,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53,
0x44, 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x73, 0x65, 0x72,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x57, 0x0a, 0x0c, 0x67, 0x65,
0x74, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x22, 0x2e, 0x4f, 0x70, 0x65,
0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x67,
0x65, 0x74, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x52, 0x65, 0x71, 0x1a, 0x23,
0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x67, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x52,
0x65, 0x73, 0x70, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x44, 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e,
0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -1785,15 +1791,17 @@ var file_user_user_proto_depIdxs = []int32{
2, // 16: OpenIMServer.user.user.accountCheck:input_type -> OpenIMServer.user.accountCheckReq
22, // 17: OpenIMServer.user.user.getPaginationUsers:input_type -> OpenIMServer.user.getPaginationUsersReq
24, // 18: OpenIMServer.user.user.userRegister:input_type -> OpenIMServer.user.userRegisterReq
5, // 19: OpenIMServer.user.user.getDesignateUsers:output_type -> OpenIMServer.user.getDesignateUsersResp
7, // 20: OpenIMServer.user.user.updateUserInfo:output_type -> OpenIMServer.user.updateUserInfoResp
9, // 21: OpenIMServer.user.user.setGlobalRecvMessageOpt:output_type -> OpenIMServer.user.setGlobalRecvMessageOptResp
27, // 22: OpenIMServer.user.user.getGlobalRecvMessageOpt:output_type -> OpenIMServer.user.getGlobalRecvMessageOptResp
3, // 23: OpenIMServer.user.user.accountCheck:output_type -> OpenIMServer.user.accountCheckResp
23, // 24: OpenIMServer.user.user.getPaginationUsers:output_type -> OpenIMServer.user.getPaginationUsersResp
25, // 25: OpenIMServer.user.user.userRegister:output_type -> OpenIMServer.user.userRegisterResp
19, // [19:26] is the sub-list for method output_type
12, // [12:19] is the sub-list for method input_type
0, // 19: OpenIMServer.user.user.getAllUserID:input_type -> OpenIMServer.user.getAllUserIDReq
5, // 20: OpenIMServer.user.user.getDesignateUsers:output_type -> OpenIMServer.user.getDesignateUsersResp
7, // 21: OpenIMServer.user.user.updateUserInfo:output_type -> OpenIMServer.user.updateUserInfoResp
9, // 22: OpenIMServer.user.user.setGlobalRecvMessageOpt:output_type -> OpenIMServer.user.setGlobalRecvMessageOptResp
27, // 23: OpenIMServer.user.user.getGlobalRecvMessageOpt:output_type -> OpenIMServer.user.getGlobalRecvMessageOptResp
3, // 24: OpenIMServer.user.user.accountCheck:output_type -> OpenIMServer.user.accountCheckResp
23, // 25: OpenIMServer.user.user.getPaginationUsers:output_type -> OpenIMServer.user.getPaginationUsersResp
25, // 26: OpenIMServer.user.user.userRegister:output_type -> OpenIMServer.user.userRegisterResp
1, // 27: OpenIMServer.user.user.getAllUserID:output_type -> OpenIMServer.user.getAllUserIDResp
20, // [20:28] is the sub-list for method output_type
12, // [12:20] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
@ -2200,6 +2208,8 @@ type UserClient interface {
GetPaginationUsers(ctx context.Context, in *GetPaginationUsersReq, opts ...grpc.CallOption) (*GetPaginationUsersResp, error)
// 用户注册
UserRegister(ctx context.Context, in *UserRegisterReq, opts ...grpc.CallOption) (*UserRegisterResp, error)
// 获取所有用户ID
GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error)
}
type userClient struct {
@ -2273,6 +2283,15 @@ func (c *userClient) UserRegister(ctx context.Context, in *UserRegisterReq, opts
return out, nil
}
func (c *userClient) GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error) {
out := new(GetAllUserIDResp)
err := c.cc.Invoke(ctx, "/OpenIMServer.user.user/getAllUserID", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserServer is the server API for User service.
type UserServer interface {
// 获取指定的用户信息 全字段
@ -2289,6 +2308,8 @@ type UserServer interface {
GetPaginationUsers(context.Context, *GetPaginationUsersReq) (*GetPaginationUsersResp, error)
// 用户注册
UserRegister(context.Context, *UserRegisterReq) (*UserRegisterResp, error)
// 获取所有用户ID
GetAllUserID(context.Context, *GetAllUserIDReq) (*GetAllUserIDResp, error)
}
// UnimplementedUserServer can be embedded to have forward compatible implementations.
@ -2316,6 +2337,9 @@ func (*UnimplementedUserServer) GetPaginationUsers(context.Context, *GetPaginati
func (*UnimplementedUserServer) UserRegister(context.Context, *UserRegisterReq) (*UserRegisterResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserRegister not implemented")
}
func (*UnimplementedUserServer) GetAllUserID(context.Context, *GetAllUserIDReq) (*GetAllUserIDResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllUserID not implemented")
}
func RegisterUserServer(s *grpc.Server, srv UserServer) {
s.RegisterService(&_User_serviceDesc, srv)
@ -2447,6 +2471,24 @@ func _User_UserRegister_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _User_GetAllUserID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAllUserIDReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServer).GetAllUserID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/OpenIMServer.user.user/GetAllUserID",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServer).GetAllUserID(ctx, req.(*GetAllUserIDReq))
}
return interceptor(ctx, in, info, handler)
}
var _User_serviceDesc = grpc.ServiceDesc{
ServiceName: "OpenIMServer.user.user",
HandlerType: (*UserServer)(nil),
@ -2479,6 +2521,10 @@ var _User_serviceDesc = grpc.ServiceDesc{
MethodName: "userRegister",
Handler: _User_UserRegister_Handler,
},
{
MethodName: "getAllUserID",
Handler: _User_GetAllUserID_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "user/user.proto",

View File

@ -1,11 +1,8 @@
syntax = "proto3";
package OpenIMServer.user;
import "sdkws/sdkws.proto";
import "conversation/conversation.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user";
package OpenIMServer.user;
message getAllUserIDReq{
sdkws.RequestPagination pagination = 1;
@ -49,7 +46,7 @@ message setGlobalRecvMessageOptResp{
}
message setConversationReq{
conversation.Conversation conversation = 1;
OpenIMServer.conversation.Conversation conversation = 1;
int32 notificationType = 2;
string operationID = 3;
}
@ -77,7 +74,7 @@ message getConversationReq{
}
message getConversationResp{
conversation.Conversation conversation = 2;
OpenIMServer.conversation.Conversation conversation = 2;
}
message getConversationsReq{
@ -87,7 +84,7 @@ message getConversationsReq{
}
message getConversationsResp{
repeated conversation.Conversation conversations = 2;
repeated OpenIMServer.conversation.Conversation conversations = 2;
}
message getAllConversationsReq{
@ -96,11 +93,11 @@ message getAllConversationsReq{
}
message getAllConversationsResp{
repeated conversation.Conversation conversations = 2;
repeated OpenIMServer.conversation.Conversation conversations = 2;
}
message batchSetConversationsReq{
repeated conversation.Conversation conversations = 1;
repeated OpenIMServer.conversation.Conversation conversations = 1;
string OwnerUserID = 2;
int32 notificationType = 3;
string OperationID = 4;

View File

@ -2,13 +2,14 @@ package convert
import (
"context"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
discoveryRegistry "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
sdk "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/check"
utils2 "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
utils "github.com/OpenIMSDK/open_utils"
"time"
)
type DBFriend struct {
@ -39,7 +40,7 @@ func (*PBFriend) PB2DB(friends []*sdk.FriendInfo) (DBFriends []*relation.FriendM
return
}
func (db *DBFriend) DB2PB(ctx context.Context, friends []*relation.FriendModel) (PBFriends []*sdk.FriendInfo, err error) {
func (db *DBFriend) DB2PB(ctx context.Context, friends []*relation.FriendModel) (pbFriends []*sdk.FriendInfo, err error) {
userIDs := utils2.Slice(friends, func(e *relation.FriendModel) string { return e.FriendUserID })
users, err := db.userCheck.GetUsersInfoMap(ctx, userIDs, true)
if err != nil {
@ -51,6 +52,12 @@ func (db *DBFriend) DB2PB(ctx context.Context, friends []*relation.FriendModel)
utils.CopyStructFields(pbfriend.FriendUser, users[v.FriendUserID])
pbfriend.CreateTime = v.CreateTime.Unix()
pbfriend.FriendUser.CreateTime = v.CreateTime.Unix()
pbfriend.OperatorUserID = v.OperatorUserID
pbfriend.OwnerUserID = v.OwnerUserID
pbfriend.Remark = v.Remark
pbfriend.AddSource = v.AddSource
pbfriend.Ex = v.Ex
pbFriends = append(pbFriends, pbfriend)
}
return
}
@ -110,20 +117,30 @@ func (db *DBFriendRequest) DB2PB(ctx context.Context, friendRequests []*relation
if len(friendRequests) > 0 {
userIDs = append(userIDs, friendRequests[0].FromUserID)
}
for _, v := range friendRequests {
userIDs = append(userIDs, v.ToUserID)
}
users, err := db.userCheck.GetUsersInfoMap(ctx, userIDs, true)
if err != nil {
return nil, err
}
for _, v := range friendRequests {
pbFriendRequest := &sdk.FriendRequest{}
pbFriendRequest.FromUserID = users[v.FromUserID].UserID
pbFriendRequest.FromNickname = users[v.FromUserID].Nickname
pbFriendRequest.FromFaceURL = users[v.FromUserID].FaceURL
pbFriendRequest.FromGender = users[v.FromUserID].Gender
pbFriendRequest.ToUserID = users[v.ToUserID].UserID
pbFriendRequest.ToNickname = users[v.ToUserID].Nickname
pbFriendRequest.ToFaceURL = users[v.ToUserID].FaceURL
pbFriendRequest.ToGender = users[v.ToUserID].Gender
pbFriendRequest.CreateTime = db.CreateTime.Unix()
pbFriendRequest.HandleTime = db.HandleTime.Unix()
pbFriendRequest.CreateTime = v.CreateTime.Unix()
pbFriendRequest.HandleTime = v.HandleTime.Unix()
pbFriendRequest.HandlerUserID = v.HandlerUserID
pbFriendRequest.HandleResult = v.HandleResult
pbFriendRequest.Ex = v.Ex
pbFriendRequest.HandleMsg = v.HandleMsg
pbFriendRequest.ReqMsg = v.ReqMsg
PBFriendRequests = append(PBFriendRequests, pbFriendRequest)
}
return
@ -189,8 +206,11 @@ func (db *DBBlack) DB2PB(ctx context.Context, blacks []*relation.BlackModel) (PB
}
for _, v := range blacks {
pbBlack := &sdk.BlackInfo{}
utils.CopyStructFields(pbBlack, users[v.OwnerUserID])
pbBlack := &sdk.BlackInfo{BlackUserInfo: &sdk.PublicUserInfo{}}
pbBlack.OwnerUserID = v.OwnerUserID
pbBlack.AddSource = v.AddSource
pbBlack.CreateTime = v.CreateTime.Unix()
pbBlack.Ex = v.Ex
utils.CopyStructFields(pbBlack.BlackUserInfo, users[v.BlockUserID])
PBBlacks = append(PBBlacks, pbBlack)
}

10
pkg/utils/page.go Normal file
View File

@ -0,0 +1,10 @@
package utils
import "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
func GetPage(pagination *sdkws.RequestPagination) (pageNumber, showNumber int32) {
if pagination != nil {
return pagination.PageNumber, pagination.ShowNumber
}
return
}