mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-11 04:25:59 +08:00
proto modify
This commit is contained in:
@@ -38,12 +38,7 @@ func NewGinRouter() *gin.Engine {
|
||||
userRouterGroup.POST("/user_register", u.UserRegister)
|
||||
userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1
|
||||
userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt)
|
||||
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
|
||||
userRouterGroup.POST("/get_self_user_info", u.GetSelfUserInfo) //1
|
||||
userRouterGroup.POST("/get_users_online_status", u.GetUsersOnlineStatus) //1
|
||||
userRouterGroup.POST("/get_users_info_from_cache", u.GetUsersInfoFromCache)
|
||||
userRouterGroup.POST("/get_user_friend_from_cache", u.GetFriendIDListFromCache)
|
||||
userRouterGroup.POST("/get_black_list_from_cache", u.GetBlackIDListFromCache)
|
||||
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
|
||||
//userRouterGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) // todo
|
||||
//userRouterGroup.POST("/account_check", manage.AccountCheck) // todo
|
||||
userRouterGroup.POST("/get_users", u.GetUsers)
|
||||
@@ -111,7 +106,6 @@ func NewGinRouter() *gin.Engine {
|
||||
thirdGroup := r.Group("/third")
|
||||
{
|
||||
t := NewThird(zk)
|
||||
|
||||
thirdGroup.POST("/get_rtc_invitation_info", t.GetSignalInvitationInfo)
|
||||
thirdGroup.POST("/get_rtc_invitation_start_app", t.GetSignalInvitationInfoStartApp)
|
||||
thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken)
|
||||
|
||||
+4
-20
@@ -27,6 +27,10 @@ func (o *User) client() (user.UserClient, error) {
|
||||
return user.NewUserClient(conn), nil
|
||||
}
|
||||
|
||||
func (o *User) UserRegister(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.UserRegister, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) UpdateUserInfo(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.UpdateUserInfo, o.client, c)
|
||||
}
|
||||
@@ -39,26 +43,6 @@ func (o *User) GetUsersPublicInfo(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetDesignateUsers, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) GetSelfUserInfo(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetSelfUserInfo, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) GetUsersOnlineStatus(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetUsersOnlineStatus, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) GetUsersInfoFromCache(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetUsersInfoFromCache, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) GetFriendIDListFromCache(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetFriendIDListFromCache, o.client, c)
|
||||
}
|
||||
|
||||
func (o *User) GetBlackIDListFromCache(c *gin.Context) {
|
||||
a2r.Call(user.UserClient.GetBlackIDListFromCache, o.client, c)
|
||||
}
|
||||
|
||||
//func (u *User) GetAllUsersUid(c *gin.Context) {
|
||||
// a2r.Call(user.UserClient.GetAllUsersUid, u.client, c)
|
||||
//}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (m *minioImpl) GetObjectInfo(ctx context.Context, args *BucketFile) (*Objec
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *minioImpl) CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
|
||||
func (m *minioImpl) CopyObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
|
||||
destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -103,15 +103,15 @@ func (m *minioImpl) CopyObjetInfo(ctx context.Context, src *BucketFile, dst *Buc
|
||||
return m.client.CopyObject(destination, minio.NewSourceInfo(src.Bucket, src.Name, nil))
|
||||
}
|
||||
|
||||
func (m *minioImpl) DeleteObjetInfo(ctx context.Context, info *BucketFile) error {
|
||||
func (m *minioImpl) DeleteObjectInfo(ctx context.Context, info *BucketFile) error {
|
||||
return m.client.RemoveObject(info.Bucket, info.Name)
|
||||
}
|
||||
|
||||
func (m *minioImpl) MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
|
||||
if err := m.CopyObjetInfo(ctx, src, dst); err != nil {
|
||||
func (m *minioImpl) MoveObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
|
||||
if err := m.CopyObjectInfo(ctx, src, dst); err != nil {
|
||||
return err
|
||||
}
|
||||
return m.DeleteObjetInfo(ctx, src)
|
||||
return m.DeleteObjectInfo(ctx, src)
|
||||
}
|
||||
|
||||
func (m *minioImpl) MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error {
|
||||
@@ -119,7 +119,7 @@ func (m *minioImpl) MergeObjectInfo(ctx context.Context, src []BucketFile, dst *
|
||||
case 0:
|
||||
return errors.New("src empty")
|
||||
case 1:
|
||||
return m.CopyObjetInfo(ctx, &src[0], dst)
|
||||
return m.CopyObjectInfo(ctx, &src[0], dst)
|
||||
}
|
||||
destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -11,9 +11,9 @@ type Interface interface {
|
||||
ClearBucket() string
|
||||
ApplyPut(ctx context.Context, args *ApplyPutArgs) (*PutRes, error)
|
||||
GetObjectInfo(ctx context.Context, args *BucketFile) (*ObjectInfo, error)
|
||||
CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
|
||||
DeleteObjetInfo(ctx context.Context, info *BucketFile) error
|
||||
MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
|
||||
CopyObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
|
||||
DeleteObjectInfo(ctx context.Context, info *BucketFile) error
|
||||
MoveObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
|
||||
MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error
|
||||
IsNotFound(err error) bool
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errC
|
||||
_ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey)
|
||||
}
|
||||
|
||||
func (m *msgServer) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) {
|
||||
func (m *msgServer) GetMessagesReactionExtensions(ctx context.Context, req *msg.GetMessagesReactionExtensionsReq) (resp *msg.GetMessagesReactionExtensionsResp, err error) {
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
|
||||
var rResp msg.GetMessageListReactionExtensionsResp
|
||||
for _, messageValue := range req.MessageReactionKeyList {
|
||||
@@ -218,7 +218,7 @@ func (m *msgServer) AddMessageReactionExtensions(ctx context.Context, req *msg.M
|
||||
return
|
||||
}
|
||||
|
||||
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) {
|
||||
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessagesReactionExtensionsReq) (resp *msg.DeleteMessagesReactionExtensionsResp, err error) {
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
|
||||
var rResp msg.DeleteMessagesReactionExtensionsResp
|
||||
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package msg
|
||||
|
||||
import "context"
|
||||
|
||||
func DeleteMessageNotification(ctx context.Context, userID string, seqs []int64) {
|
||||
panic("todo")
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package msg
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"OpenIM/pkg/proto/msg"
|
||||
"OpenIM/pkg/proto/sdkws"
|
||||
"OpenIM/pkg/utils"
|
||||
@@ -34,27 +33,6 @@ type MessageRevoked struct {
|
||||
SessionType int32 `json:"sessionType"`
|
||||
Seq uint32 `json:"seq"`
|
||||
}
|
||||
type MsgCallBackReq struct {
|
||||
SendID string `json:"sendID"`
|
||||
RecvID string `json:"recvID"`
|
||||
Content string `json:"content"`
|
||||
SendTime int64 `json:"sendTime"`
|
||||
MsgFrom int32 `json:"msgFrom"`
|
||||
ContentType int32 `json:"contentType"`
|
||||
SessionType int32 `json:"sessionType"`
|
||||
PlatformID int32 `json:"senderPlatformID"`
|
||||
MsgID string `json:"msgID"`
|
||||
IsOnlineOnly bool `json:"isOnlineOnly"`
|
||||
}
|
||||
type MsgCallBackResp struct {
|
||||
ErrCode int32 `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
ResponseErrCode int32 `json:"responseErrCode"`
|
||||
ResponseResult struct {
|
||||
ModifiedMsg string `json:"modifiedMsg"`
|
||||
Ext string `json:"ext"`
|
||||
}
|
||||
}
|
||||
|
||||
func (m *msgServer) userIsMuteAndIsAdminInGroup(ctx context.Context, groupID, userID string) (isMute bool, err error) {
|
||||
groupMemberInfo, err := m.Group.GetGroupMemberInfo(ctx, groupID, userID)
|
||||
@@ -331,7 +309,7 @@ func valueCopy(pb *msg.SendMsgReq) *msg.SendMsgReq {
|
||||
}
|
||||
|
||||
func (m *msgServer) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *msg.SendMsgReq, wg *sync.WaitGroup) error {
|
||||
msgToMQGroup := msg.MsgDataToMQ{OperationID: tracelog.GetOperationID(ctx), MsgData: groupPB.MsgData}
|
||||
msgToMQGroup := msg.MsgDataToMQ{MsgData: groupPB.MsgData}
|
||||
tempOptions := make(map[string]bool, 1)
|
||||
for k, v := range groupPB.MsgData.Options {
|
||||
tempOptions[k] = v
|
||||
|
||||
@@ -52,10 +52,11 @@ func (m *msgServer) sendMsgNotification(ctx context.Context, req *msg.SendMsgReq
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
resp.SendTime = msgToMQSingle.MsgData.SendTime
|
||||
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
|
||||
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
|
||||
resp = &msg.SendMsgResp{
|
||||
ServerMsgID: msgToMQSingle.MsgData.ServerMsgID,
|
||||
ClientMsgID: msgToMQSingle.MsgData.ClientMsgID,
|
||||
SendTime: msgToMQSingle.MsgData.SendTime,
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -90,9 +91,11 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq)
|
||||
return nil, err
|
||||
}
|
||||
promePkg.Inc(promePkg.SingleChatMsgProcessSuccessCounter)
|
||||
resp.SendTime = msgToMQSingle.MsgData.SendTime
|
||||
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
|
||||
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
|
||||
resp = &msg.SendMsgResp{
|
||||
ServerMsgID: msgToMQSingle.MsgData.ServerMsgID,
|
||||
ClientMsgID: msgToMQSingle.MsgData.ClientMsgID,
|
||||
SendTime: msgToMQSingle.MsgData.SendTime,
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -265,9 +268,9 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
|
||||
}
|
||||
resp.MaxSeq = maxSeq
|
||||
resp.MinSeq = minSeq
|
||||
if len(req.GroupIDList) > 0 {
|
||||
if len(req.GroupIDs) > 0 {
|
||||
resp.GroupMaxAndMinSeq = make(map[string]*sdkws.MaxAndMinSeq)
|
||||
for _, groupID := range req.GroupIDList {
|
||||
for _, groupID := range req.GroupIDs {
|
||||
maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, groupID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -5,8 +5,6 @@ import (
|
||||
"OpenIM/pkg/common/db/cache"
|
||||
"OpenIM/pkg/common/db/controller"
|
||||
"OpenIM/pkg/common/db/localcache"
|
||||
"OpenIM/pkg/common/db/relation"
|
||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/common/db/unrelation"
|
||||
"OpenIM/pkg/common/prome"
|
||||
"OpenIM/pkg/discoveryregistry"
|
||||
@@ -54,6 +52,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
||||
GroupLocalCache: localcache.NewGroupLocalCache(client),
|
||||
black: check.NewBlackChecker(client),
|
||||
friend: check.NewFriendChecker(client),
|
||||
MessageLocker: NewLockerMessage(cacheModel),
|
||||
}
|
||||
s.initPrometheus()
|
||||
msg.RegisterMsgServer(server, s)
|
||||
|
||||
@@ -7,13 +7,13 @@ import (
|
||||
"OpenIM/pkg/common/db/obj"
|
||||
"OpenIM/pkg/common/db/relation"
|
||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/discoveryregistry"
|
||||
"OpenIM/pkg/proto/third"
|
||||
"context"
|
||||
"github.com/OpenIMSDK/openKeeper"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
||||
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||
rdb, err := cache.NewRedis()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -30,7 +30,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
||||
return err
|
||||
}
|
||||
third.RegisterThirdServer(server, &thirdServer{
|
||||
thirdDatabase: controller.NewThirdDatabase(cache.NewCache(rdb)),
|
||||
thirdDatabase: controller.NewThirdDatabase(cache.NewCacheModel(rdb)),
|
||||
userCheck: check.NewUserCheck(client),
|
||||
s3dataBase: controller.NewS3Database(o, relation.NewObjectHash(db), relation.NewObjectInfo(db), relation.NewObjectPut(db)),
|
||||
})
|
||||
@@ -43,28 +43,6 @@ type thirdServer struct {
|
||||
userCheck *check.UserCheck
|
||||
}
|
||||
|
||||
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
|
||||
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp = &third.GetSignalInvitationInfoResp{}
|
||||
resp.InvitationInfo = signalReq.Invitation
|
||||
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (t *thirdServer) GetSignalInvitationInfoStartApp(ctx context.Context, req *third.GetSignalInvitationInfoStartAppReq) (resp *third.GetSignalInvitationInfoStartAppResp, err error) {
|
||||
signalReq, err := t.thirdDatabase.GetAvailableSignalInvitationInfo(ctx, req.UserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp = &third.GetSignalInvitationInfoStartAppResp{}
|
||||
resp.InvitationInfo = signalReq.Invitation
|
||||
resp.OfflinePushInfo = signalReq.OfflinePushInfo
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (t *thirdServer) FcmUpdateToken(ctx context.Context, req *third.FcmUpdateTokenReq) (resp *third.FcmUpdateTokenResp, err error) {
|
||||
err = t.thirdDatabase.FcmUpdateToken(ctx, req.Account, int(req.PlatformID), req.FcmToken, req.ExpireTime)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user