mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-24 22:09:17 +08:00
cms
This commit is contained in:
parent
c7d544685e
commit
6774a8594f
63
internal/cms_api/friend/friend.go
Normal file
63
internal/cms_api/friend/friend.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package friend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"Open_IM/pkg/cms_api_struct"
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/log"
|
||||||
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
|
pbAdmin "Open_IM/pkg/proto/admin_cms"
|
||||||
|
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||||
|
"Open_IM/pkg/utils"
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetUserFriends(c *gin.Context) {
|
||||||
|
var (
|
||||||
|
req cms_api_struct.GetFriendsReq
|
||||||
|
resp cms_api_struct.GetFriendsResp
|
||||||
|
reqPb pbAdmin.GetUserFriendsReq
|
||||||
|
)
|
||||||
|
if err := c.BindJSON(&req); err != nil {
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "ShouldBindQuery failed ", err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
|
reqPb.Pagination = &pbCommon.RequestPagination{}
|
||||||
|
utils.CopyStructFields(&reqPb.Pagination, req)
|
||||||
|
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil"
|
||||||
|
log.NewError(reqPb.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reqPb.OperationID = req.OperationID
|
||||||
|
reqPb.UserID = req.UserID
|
||||||
|
reqPb.FriendUserName = req.FriendUserName
|
||||||
|
reqPb.FriendUserID = req.FriendUserID
|
||||||
|
|
||||||
|
client := pbAdmin.NewAdminCMSClient(etcdConn)
|
||||||
|
respPb, err := client.GetUserFriends(context.Background(), &reqPb)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(reqPb.OperationID, utils.GetSelfFuncName(), "GetUserInfo failed ", err.Error())
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range respPb.FriendInfoList {
|
||||||
|
friend := &cms_api_struct.FriendInfo{}
|
||||||
|
utils.CopyStructFields(friend, v)
|
||||||
|
friend.Nickname = v.FriendUser.Nickname
|
||||||
|
friend.UserID = v.FriendUser.UserID
|
||||||
|
resp.FriendInfoList = append(resp.FriendInfoList, friend)
|
||||||
|
}
|
||||||
|
resp.FriendNums = respPb.FriendNums
|
||||||
|
resp.CurrentPage = int(respPb.Pagination.CurrentPage)
|
||||||
|
resp.ShowNumber = int(respPb.Pagination.ShowNumber)
|
||||||
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||||
|
c.JSON(http.StatusOK, gin.H{"errCode": respPb.CommonResp.ErrCode, "errMsg": respPb.CommonResp.ErrMsg, "data": resp})
|
||||||
|
}
|
@ -47,7 +47,7 @@ func GetChatLogs(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range respPb.ChatLogs {
|
for _, v := range respPb.ChatLogs {
|
||||||
chatLog := pbCommon.MsgData{}
|
chatLog := cms_api_struct.ChatLog{}
|
||||||
utils.CopyStructFields(&chatLog, v)
|
utils.CopyStructFields(&chatLog, v)
|
||||||
resp.ChatLogs = append(resp.ChatLogs, &chatLog)
|
resp.ChatLogs = append(resp.ChatLogs, &chatLog)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cms_api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/internal/cms_api/admin"
|
"Open_IM/internal/cms_api/admin"
|
||||||
|
"Open_IM/internal/cms_api/friend"
|
||||||
"Open_IM/internal/cms_api/group"
|
"Open_IM/internal/cms_api/group"
|
||||||
messageCMS "Open_IM/internal/cms_api/message_cms"
|
messageCMS "Open_IM/internal/cms_api/message_cms"
|
||||||
"Open_IM/internal/cms_api/middleware"
|
"Open_IM/internal/cms_api/middleware"
|
||||||
@ -63,5 +64,9 @@ func NewGinRouter() *gin.Engine {
|
|||||||
{
|
{
|
||||||
messageCMSRouterGroup.POST("/get_chat_logs", messageCMS.GetChatLogs)
|
messageCMSRouterGroup.POST("/get_chat_logs", messageCMS.GetChatLogs)
|
||||||
}
|
}
|
||||||
|
friendCMSRouterGroup := r2.Group("friend")
|
||||||
|
{
|
||||||
|
friendCMSRouterGroup.POST("/get_friends", friend.GetUserFriends)
|
||||||
|
}
|
||||||
return baseRouter
|
return baseRouter
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
server_api_params "Open_IM/pkg/proto/sdk_ws"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -19,6 +20,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type adminCMSServer struct {
|
type adminCMSServer struct {
|
||||||
@ -296,7 +298,7 @@ func (s *adminCMSServer) GetActiveUser(_ context.Context, req *pbAdminCMS.GetAct
|
|||||||
for _, activeUser := range activeUsers {
|
for _, activeUser := range activeUsers {
|
||||||
resp.Users = append(resp.Users,
|
resp.Users = append(resp.Users,
|
||||||
&pbAdminCMS.UserResp{
|
&pbAdminCMS.UserResp{
|
||||||
UserId: activeUser.ID,
|
UserID: activeUser.ID,
|
||||||
NickName: activeUser.Name,
|
NickName: activeUser.Name,
|
||||||
MessageNum: int32(activeUser.MessageNum),
|
MessageNum: int32(activeUser.MessageNum),
|
||||||
},
|
},
|
||||||
@ -584,3 +586,80 @@ func (s *adminCMSServer) GetUserStatistics(_ context.Context, req *pbAdminCMS.Ge
|
|||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) GetUserFriends(_ context.Context, req *pbAdminCMS.GetUserFriendsReq) (*pbAdminCMS.GetUserFriendsResp, error) {
|
||||||
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
|
resp := &pbAdminCMS.GetUserFriendsResp{CommonResp: &pbAdminCMS.CommonResp{}, Pagination: &server_api_params.ResponsePagination{CurrentPage: req.Pagination.PageNumber, ShowNumber: req.Pagination.ShowNumber}}
|
||||||
|
var friendList []*imdb.FriendUser
|
||||||
|
var err error
|
||||||
|
if req.FriendUserID != "" {
|
||||||
|
friend, err := imdb.GetFriendByIDCMS(req.UserID, req.FriendUserID)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserID, req.FriendUserID)
|
||||||
|
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
||||||
|
resp.CommonResp.ErrMsg = err.Error()
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
friendList = append(friendList, friend)
|
||||||
|
} else {
|
||||||
|
friendList, err = imdb.GetUserFriendsCMS(req.UserID, req.FriendUserName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserID, req.FriendUserName, req.Pagination.PageNumber, req.Pagination.ShowNumber)
|
||||||
|
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
||||||
|
resp.CommonResp.ErrMsg = err.Error()
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, v := range friendList {
|
||||||
|
friendInfo := &server_api_params.FriendInfo{}
|
||||||
|
userInfo := &server_api_params.UserInfo{UserID: v.FriendUserID, Nickname: v.Nickname}
|
||||||
|
utils.CopyStructFields(friendInfo, v)
|
||||||
|
friendInfo.FriendUser = userInfo
|
||||||
|
resp.FriendInfoList = append(resp.FriendInfoList, friendInfo)
|
||||||
|
}
|
||||||
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) GenerateInvitationCode(_ context.Context, req *pbAdminCMS.GenerateInvitationCodeReq) (*pbAdminCMS.GenerateInvitationCodeResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) GetInvitationCodes(_ context.Context, req *pbAdminCMS.GetInvitationCodesReq) (*pbAdminCMS.GetInvitationCodesResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) QueryIPRegister(_ context.Context, req *pbAdminCMS.QueryIPRegisterReq) (*pbAdminCMS.QueryIPRegisterResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) AddIPLimit(_ context.Context, req *pbAdminCMS.AddIPLimitReq) (*pbAdminCMS.AddIPLimitResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) RemoveIPLimit(_ context.Context, req *pbAdminCMS.RemoveIPLimitReq) (*pbAdminCMS.RemoveIPLimitResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) QueryUserIDIPLimitLogin(_ context.Context, req *pbAdminCMS.QueryUserIDIPLimitLoginReq) (*pbAdminCMS.QueryUserIDIPLimitLoginResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) AddUserIPLimitLogin(_ context.Context, req *pbAdminCMS.AddUserIPLimitLoginReq) (*pbAdminCMS.AddUserIPLimitLoginResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) RemoveUserIPLimit(_ context.Context, req *pbAdminCMS.RemoveUserIPLimitReq) (*pbAdminCMS.RemoveUserIPLimitResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) GetClientInitConfig(_ context.Context, req *pbAdminCMS.GetClientInitConfigReq) (*pbAdminCMS.GetClientInitConfigResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *adminCMSServer) SetClientInitConfig(_ context.Context, req *pbAdminCMS.SetClientInitConfigReq) (*pbAdminCMS.SetClientInitConfigResp, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
@ -52,11 +52,38 @@ func (rpc *rpcAuth) UserRegister(_ context.Context, req *pbAuth.UserRegisterReq)
|
|||||||
|
|
||||||
func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) {
|
func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
|
||||||
_, err := imdb.GetUserByUserID(req.FromUserID)
|
|
||||||
if err != nil {
|
if config.Config.Demo.UseIPLimit {
|
||||||
errMsg := req.OperationID + " imdb.GetUserByUserID failed " + err.Error() + req.FromUserID
|
user, err := imdb.GetUserIPLimit(req.FromUserID)
|
||||||
log.NewError(req.OperationID, errMsg)
|
if err != nil {
|
||||||
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
|
errMsg := req.OperationID + " imdb.GetUserByUserID failed " + err.Error() + req.FromUserID
|
||||||
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var Limited bool
|
||||||
|
var LimitError error
|
||||||
|
Limited, LimitError = imdb.IsLimitLoginIp(req.LoginIp)
|
||||||
|
if LimitError != nil {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: LimitError.Error()}}, nil
|
||||||
|
}
|
||||||
|
if Limited {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.LoginLimit, ErrMsg: "limited Login"}}, nil
|
||||||
|
}
|
||||||
|
Limited, LimitError = imdb.IsLimitUserLoginIp(user.UserID, req.LoginIp)
|
||||||
|
if LimitError != nil {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: LimitError.Error()}}, nil
|
||||||
|
}
|
||||||
|
if Limited {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.LoginLimit, ErrMsg: "limited Login"}}, nil
|
||||||
|
}
|
||||||
|
Limited, LimitError = imdb.UserIsBlock(user.UserID)
|
||||||
|
if LimitError != nil {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: LimitError.Error()}}, nil
|
||||||
|
}
|
||||||
|
if Limited {
|
||||||
|
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.LoginLimit, ErrMsg: "limited Login"}}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tokens, expTime, err := token_verify.CreateToken(req.FromUserID, int(req.Platform))
|
tokens, expTime, err := token_verify.CreateToken(req.FromUserID, int(req.Platform))
|
||||||
|
@ -1353,8 +1353,6 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (*
|
|||||||
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
resp.CommonResp.ErrCode = constant.ErrDB.ErrCode
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
resp.CommonResp.ErrMsg = err.Error()
|
||||||
return resp, nil
|
return resp, nil
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
resp.GroupNum = 1
|
resp.GroupNum = 1
|
||||||
groupInfo := &open_im_sdk.GroupInfo{}
|
groupInfo := &open_im_sdk.GroupInfo{}
|
||||||
|
@ -634,7 +634,7 @@ func (s *userServer) GetUsers(ctx context.Context, req *pbUser.GetUsersReq) (*pb
|
|||||||
|
|
||||||
func (s *userServer) AddUser(ctx context.Context, req *pbUser.AddUserReq) (*pbUser.AddUserResp, error) {
|
func (s *userServer) AddUser(ctx context.Context, req *pbUser.AddUserReq) (*pbUser.AddUserResp, error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp := &pbUser.AddUserResp{}
|
resp := &pbUser.AddUserResp{CommonResp: &pbUser.CommonResp{}}
|
||||||
err := imdb.AddUser(req.UserInfo.UserID, req.UserInfo.PhoneNumber, req.UserInfo.Nickname, req.UserInfo.Email, req.UserInfo.Gender, req.UserInfo.FaceURL, req.UserInfo.Birth)
|
err := imdb.AddUser(req.UserInfo.UserID, req.UserInfo.PhoneNumber, req.UserInfo.Nickname, req.UserInfo.Email, req.UserInfo.Gender, req.UserInfo.FaceURL, req.UserInfo.Birth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "AddUser", err.Error(), req.String())
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "AddUser", err.Error(), req.String())
|
||||||
|
25
pkg/cms_api_struct/friend.go
Normal file
25
pkg/cms_api_struct/friend.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package cms_api_struct
|
||||||
|
|
||||||
|
type GetFriendsReq struct {
|
||||||
|
OperationID string `json:"operationID"`
|
||||||
|
UserID string `json:"userID"`
|
||||||
|
FriendUserName string `json:"friendUserName"`
|
||||||
|
FriendUserID string `json:"friendUserID"`
|
||||||
|
RequestPagination
|
||||||
|
}
|
||||||
|
|
||||||
|
type FriendInfo struct {
|
||||||
|
OwnerUserID string `json:"ownerUserID"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
CreateTime uint32 `json:"createTime"`
|
||||||
|
UserID string `json:"userID"`
|
||||||
|
Nickname string `json:"nickName"`
|
||||||
|
AddSource int32 `json:"addSource"`
|
||||||
|
OperatorUserID string `json:"operatorUserID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetFriendsResp struct {
|
||||||
|
ResponsePagination
|
||||||
|
FriendInfoList []*FriendInfo `json:"friendInfoList"`
|
||||||
|
FriendNums int32 `json:"friendNums"`
|
||||||
|
}
|
@ -16,8 +16,33 @@ type GetChatLogsReq struct {
|
|||||||
OperationID string `json:"operationID"`
|
OperationID string `json:"operationID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChatLog struct {
|
||||||
|
SendID string `json:"sendID,omitempty"`
|
||||||
|
RecvID string `json:"recvID,omitempty"`
|
||||||
|
GroupID string `json:"groupID,omitempty"`
|
||||||
|
ClientMsgID string `json:"clientMsgID,omitempty"`
|
||||||
|
ServerMsgID string `json:"serverMsgID,omitempty"`
|
||||||
|
SenderPlatformID int32 `json:"senderPlatformID,omitempty"`
|
||||||
|
SenderNickname string `json:"senderNickname,omitempty"`
|
||||||
|
SenderFaceURL string `json:"senderFaceURL,omitempty"`
|
||||||
|
SessionType int32 `json:"sessionType,omitempty"`
|
||||||
|
MsgFrom int32 `json:"msgFrom,omitempty"`
|
||||||
|
ContentType int32 `json:"contentType,omitempty"`
|
||||||
|
Content string `json:"content,omitempty"`
|
||||||
|
Seq uint32 `json:"seq,omitempty"`
|
||||||
|
SendTime int64 `json:"sendTime,omitempty"`
|
||||||
|
CreateTime int64 `json:"createTime,omitempty"`
|
||||||
|
Status int32 `json:"status,omitempty"`
|
||||||
|
Options map[string]bool `json:"options,omitempty"`
|
||||||
|
OfflinePushInfo *pbCommon.OfflinePushInfo `json:"offlinePushInfo,omitempty"`
|
||||||
|
AtUserIDList []string `json:"atUserIDList,omitempty"`
|
||||||
|
MsgDataList []byte `json:"msgDataList,omitempty"`
|
||||||
|
AttachedInfo string `json:"attachedInfo,omitempty"`
|
||||||
|
Ex string `json:"ex,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type GetChatLogsResp struct {
|
type GetChatLogsResp struct {
|
||||||
ChatLogs []*pbCommon.MsgData `json:"chatLogs"`
|
ChatLogs []*ChatLog `json:"chatLogs"`
|
||||||
ChatLogsNum int `json:"logNums"`
|
ChatLogsNum int `json:"logNums"`
|
||||||
ResponsePagination
|
ResponsePagination
|
||||||
}
|
}
|
||||||
|
@ -508,6 +508,8 @@ type config struct {
|
|||||||
JoinDepartmentIDList []string `yaml:"joinDepartmentIDList"`
|
JoinDepartmentIDList []string `yaml:"joinDepartmentIDList"`
|
||||||
JoinDepartmentGroups bool `yaml:"joinDepartmentGroups"`
|
JoinDepartmentGroups bool `yaml:"joinDepartmentGroups"`
|
||||||
OaNotification bool `yaml:"oaNotification"`
|
OaNotification bool `yaml:"oaNotification"`
|
||||||
|
|
||||||
|
UseIPLimit bool `yaml:"useIPLimit"`
|
||||||
}
|
}
|
||||||
Rtc struct {
|
Rtc struct {
|
||||||
SignalTimeout string `yaml:"signalTimeout"`
|
SignalTimeout string `yaml:"signalTimeout"`
|
||||||
|
@ -15,7 +15,7 @@ type Register struct {
|
|||||||
type Invitation struct {
|
type Invitation struct {
|
||||||
InvitationCode string `gorm:"column:invitation_code;primary_key;type:varchar(32)"`
|
InvitationCode string `gorm:"column:invitation_code;primary_key;type:varchar(32)"`
|
||||||
CreateTime time.Time `gorm:"column:create_time"`
|
CreateTime time.Time `gorm:"column:create_time"`
|
||||||
UserID string `gorm:"column:user_id"`
|
UserID string `gorm:"column:user_id;index:userID"`
|
||||||
LastTime time.Time `gorm:"column:last_time"`
|
LastTime time.Time `gorm:"column:last_time"`
|
||||||
Status int32 `gorm:"column:status"`
|
Status int32 `gorm:"column:status"`
|
||||||
}
|
}
|
||||||
@ -179,8 +179,8 @@ type User struct {
|
|||||||
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
||||||
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
||||||
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
||||||
InvitationCode string `gorm:"column:invitation_code"`
|
|
||||||
status int32 `gorm:"column:status"`
|
status int32 `gorm:"column:status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserIpRecord struct {
|
type UserIpRecord struct {
|
||||||
|
@ -3,6 +3,7 @@ package im_mysql_model
|
|||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
_ "gorm.io/gorm"
|
_ "gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,3 +75,10 @@ func DeleteAllRegisterAddFriendIDList() error {
|
|||||||
err := db.DB.MysqlDB.DefaultGormDB().Where("1 = 1").Delete(&db.RegisterAddFriend{}).Error
|
err := db.DB.MysqlDB.DefaultGormDB().Where("1 = 1").Delete(&db.RegisterAddFriend{}).Error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetUserIPLimit(userID string) (db.UserIpLimit, error) {
|
||||||
|
var limit db.UserIpLimit
|
||||||
|
limit.UserID = userID
|
||||||
|
err := db.DB.MysqlDB.DefaultGormDB().Model(&db.UserIpLimit{}).Take(&limit).Error
|
||||||
|
return limit, err
|
||||||
|
}
|
||||||
|
@ -2,8 +2,10 @@ package im_mysql_model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InsertToFriend(toInsertFollow *db.Friend) error {
|
func InsertToFriend(toInsertFollow *db.Friend) error {
|
||||||
@ -51,3 +53,31 @@ func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error {
|
|||||||
func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error {
|
func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error {
|
||||||
return db.DB.MysqlDB.DefaultGormDB().Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(db.Friend{}).Error
|
return db.DB.MysqlDB.DefaultGormDB().Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(db.Friend{}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FriendUser struct {
|
||||||
|
db.Friend
|
||||||
|
Nickname string `gorm:"column:name;size:255"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetUserFriendsCMS(ownerUserID, friendUserName string, pageNumber, showNumber int32) (friendUserList []*FriendUser, err error) {
|
||||||
|
db := db.DB.MysqlDB.DefaultGormDB().Table("friends").
|
||||||
|
Select("friends.*, users.name").
|
||||||
|
Where("friends.owner_user_id=?", ownerUserID).Limit(int(showNumber)).
|
||||||
|
Joins("left join friends on friends.friend_user_id = users.user_id").
|
||||||
|
Offset(int(showNumber * (pageNumber - 1)))
|
||||||
|
if friendUserName != "" {
|
||||||
|
db = db.Where("users.name like ?", fmt.Sprintf("%%%s%%", friendUserName))
|
||||||
|
}
|
||||||
|
err = db.Find(&friendUserList).Error
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetFriendByIDCMS(ownerUserID, friendUserID string) (friendUser *FriendUser, err error) {
|
||||||
|
friendUser = &FriendUser{}
|
||||||
|
err = db.DB.MysqlDB.DefaultGormDB().Table("friends").
|
||||||
|
Select("friends.*, users.name").
|
||||||
|
Where("friends.owner_user_id=? and friends.friend_user_id=?", ownerUserID, friendUserID).
|
||||||
|
Joins("left join friends on friends.friend_user_id = users.user_id").
|
||||||
|
Take(friendUser).Error
|
||||||
|
return friendUser, err
|
||||||
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package im_mysql_model
|
package im_mysql_model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +56,7 @@ type GroupWithNum struct {
|
|||||||
func GetGroupsByName(groupName string, pageNumber, showNumber int32) ([]GroupWithNum, error) {
|
func GetGroupsByName(groupName string, pageNumber, showNumber int32) ([]GroupWithNum, error) {
|
||||||
var groups []GroupWithNum
|
var groups []GroupWithNum
|
||||||
err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Select("groups.*, (select count(*) from group_members where group_members.group_id=groups.group_id) as num").
|
err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Select("groups.*, (select count(*) from group_members where group_members.group_id=groups.group_id) as num").
|
||||||
Where(" name like ? ", fmt.Sprintf("%%%s%%", groupName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groups).Error
|
Where(" name like ? and status != ?", fmt.Sprintf("%%%s%%", groupName), constant.GroupStatusDismissed).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groups).Error
|
||||||
return groups, err
|
return groups, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,16 +11,18 @@ import (
|
|||||||
func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog, error) {
|
func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog, error) {
|
||||||
var chatLogs []db.ChatLog
|
var chatLogs []db.ChatLog
|
||||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs").
|
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs").
|
||||||
Where(fmt.Sprintf(" content like '%%%s%%'", chatLog.Content)).
|
|
||||||
Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
||||||
if chatLog.SessionType != 0 {
|
if chatLog.Content != "" {
|
||||||
db = db.Where("session_type = ?", chatLog.SessionType)
|
db = db.Where(" name like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
||||||
}
|
}
|
||||||
if chatLog.ContentType == 1 {
|
if chatLog.SessionType == 1 {
|
||||||
db = db.Where("content_type = ?", chatLog.ContentType)
|
db = db.Where("session_type = ?", chatLog.SessionType)
|
||||||
} else if chatLog.ContentType == 2 {
|
} else if chatLog.SessionType == 2 {
|
||||||
db = db.Where("content_type in (?)", []int{constant.GroupChatType, constant.SuperGroupChatType})
|
db = db.Where("content_type in (?)", []int{constant.GroupChatType, constant.SuperGroupChatType})
|
||||||
}
|
}
|
||||||
|
if chatLog.ContentType != 0 {
|
||||||
|
db = db.Where("content_type = ?", chatLog.ContentType)
|
||||||
|
}
|
||||||
if chatLog.SendID != "" {
|
if chatLog.SendID != "" {
|
||||||
db = db.Where("send_id = ?", chatLog.SendID)
|
db = db.Where("send_id = ?", chatLog.SendID)
|
||||||
}
|
}
|
||||||
@ -37,13 +39,17 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
|||||||
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||||
var chatLogs []db.ChatLog
|
var chatLogs []db.ChatLog
|
||||||
var count int64
|
var count int64
|
||||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs").
|
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
||||||
Where(fmt.Sprintf(" content like '%%%s%%'", chatLog.Content))
|
if chatLog.Content != "" {
|
||||||
|
db = db.Where(" name like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
||||||
|
}
|
||||||
if chatLog.SessionType != 0 {
|
if chatLog.SessionType != 0 {
|
||||||
db = db.Where("session_type = ?", chatLog.SessionType)
|
db = db.Where("session_type = ?", chatLog.SessionType)
|
||||||
}
|
}
|
||||||
if chatLog.ContentType != 0 {
|
if chatLog.ContentType == 1 {
|
||||||
db = db.Where("content_type = ?", chatLog.ContentType)
|
db = db.Where("content_type = ?", chatLog.ContentType)
|
||||||
|
} else if chatLog.ContentType == 2 {
|
||||||
|
db = db.Where("content_type in (?)", []int{constant.GroupChatType, constant.SuperGroupChatType})
|
||||||
}
|
}
|
||||||
if chatLog.SendID != "" {
|
if chatLog.SendID != "" {
|
||||||
db = db.Where("send_id = ?", chatLog.SendID)
|
db = db.Where("send_id = ?", chatLog.SendID)
|
||||||
|
@ -130,21 +130,29 @@ func AddUser(userID string, phoneNumber string, name string, email string, gende
|
|||||||
_birth = time.Now()
|
_birth = time.Now()
|
||||||
}
|
}
|
||||||
user := db.User{
|
user := db.User{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
Nickname: name,
|
Nickname: name,
|
||||||
FaceURL: faceURL,
|
FaceURL: faceURL,
|
||||||
Gender: gender,
|
Gender: gender,
|
||||||
PhoneNumber: phoneNumber,
|
PhoneNumber: phoneNumber,
|
||||||
Birth: _birth,
|
Birth: _birth,
|
||||||
Email: email,
|
Email: email,
|
||||||
Ex: "",
|
Ex: "",
|
||||||
CreateTime: time.Now(),
|
CreateTime: time.Now(),
|
||||||
InvitationCode: "",
|
|
||||||
}
|
}
|
||||||
result := db.DB.MysqlDB.DefaultGormDB().Table("users").Create(&user)
|
result := db.DB.MysqlDB.DefaultGormDB().Table("users").Create(&user)
|
||||||
return result.Error
|
return result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UserIsBlock(userId string) (bool, error) {
|
||||||
|
var user db.BlackList
|
||||||
|
rows := db.DB.MysqlDB.DefaultGormDB().Table("black_lists").Where("uid=?", userId).First(&user).RowsAffected
|
||||||
|
if rows >= 1 {
|
||||||
|
return user.EndDisableTime.After(time.Now()), nil
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
func UsersIsBlock(userIDList []string) (inBlockUserIDList []string, err error) {
|
func UsersIsBlock(userIDList []string) (inBlockUserIDList []string, err error) {
|
||||||
err = db.DB.MysqlDB.DefaultGormDB().Table("black_lists").Where("uid in (?) and end_disable_time > now()", userIDList).Pluck("uid", &inBlockUserIDList).Error
|
err = db.DB.MysqlDB.DefaultGormDB().Table("black_lists").Where("uid in (?) and end_disable_time > now()", userIDList).Pluck("uid", &inBlockUserIDList).Error
|
||||||
return inBlockUserIDList, err
|
return inBlockUserIDList, err
|
||||||
|
@ -6,10 +6,8 @@ import (
|
|||||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -36,38 +34,6 @@ const (
|
|||||||
conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:"
|
conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
fmt.Println("init to del old keys")
|
|
||||||
for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache,
|
|
||||||
groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} {
|
|
||||||
fName := utils.GetSelfFuncName()
|
|
||||||
var cursor uint64
|
|
||||||
var n int
|
|
||||||
for {
|
|
||||||
var keys []string
|
|
||||||
var err error
|
|
||||||
keys, cursor, err = db.DB.RDB.Scan(context.Background(), cursor, key+"*", 3000).Result()
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
n += len(keys)
|
|
||||||
// for each for redis cluster
|
|
||||||
for _, key := range keys {
|
|
||||||
if err = db.DB.RDB.Del(context.Background(), key).Err(); err != nil {
|
|
||||||
log.NewError("", fName, key, err.Error())
|
|
||||||
err = db.DB.RDB.Del(context.Background(), key).Err()
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if cursor == 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetFriendIDListFromCache(userID string) ([]string, error) {
|
func GetFriendIDListFromCache(userID string) ([]string, error) {
|
||||||
getFriendIDList := func() (string, error) {
|
getFriendIDList := func() (string, error) {
|
||||||
friendIDList, err := imdb.GetFriendIDListByUserID(userID)
|
friendIDList, err := imdb.GetFriendIDListByUserID(userID)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,9 +10,9 @@ message CommonResp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message AdminLoginReq {
|
message AdminLoginReq {
|
||||||
string OperationID = 1;
|
string operationID = 1;
|
||||||
string AdminID = 2;
|
string adminID = 2;
|
||||||
string Secret = 3;
|
string secret = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,43 +52,43 @@ message GetUserRegisterAddFriendIDListResp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetChatLogsReq {
|
message GetChatLogsReq {
|
||||||
string Content = 1;
|
string content = 1;
|
||||||
string SendID = 2;
|
string sendID = 2;
|
||||||
string RecvID = 3;
|
string recvID = 3;
|
||||||
string SendTime = 4;
|
string sendTime = 4;
|
||||||
int32 SessionType = 5;
|
int32 sessionType = 5;
|
||||||
int32 ContentType = 6;
|
int32 contentType = 6;
|
||||||
server_api_params.RequestPagination Pagination = 7;
|
server_api_params.RequestPagination pagination = 7;
|
||||||
string OperationID = 8;
|
string operationID = 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ChatLog {
|
message ChatLog {
|
||||||
string ServerMsgID = 1;
|
string serverMsgID = 1;
|
||||||
string ClientMsgID = 2;
|
string clientMsgID = 2;
|
||||||
string SendID = 3;
|
string sendID = 3;
|
||||||
string RecvID = 4;
|
string recvID = 4;
|
||||||
string groupID = 5;
|
string groupID = 5;
|
||||||
string recvNickname = 6;
|
string recvNickname = 6;
|
||||||
int32 SenderPlatformID = 7;
|
int32 senderPlatformID = 7;
|
||||||
string SenderNickname = 8;
|
string senderNickname = 8;
|
||||||
string SenderFaceURL = 9;
|
string senderFaceURL = 9;
|
||||||
string GroupName = 10;
|
string groupName = 10;
|
||||||
int32 SessionType = 11;
|
int32 sessionType = 11;
|
||||||
int32 MsgFrom = 12;
|
int32 msgFrom = 12;
|
||||||
int32 ContentType = 13;
|
int32 contentType = 13;
|
||||||
string Content = 14;
|
string content = 14;
|
||||||
int32 Status = 15;
|
int32 status = 15;
|
||||||
int64 SendTime = 16;
|
int64 sendTime = 16;
|
||||||
int64 CreateTime = 17;
|
int64 createTime = 17;
|
||||||
string Ex = 18;
|
string ex = 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetChatLogsResp {
|
message GetChatLogsResp {
|
||||||
repeated ChatLog ChatLogs = 1;
|
repeated ChatLog chatLogs = 1;
|
||||||
server_api_params.ResponsePagination Pagination = 2;
|
server_api_params.ResponsePagination pagination = 2;
|
||||||
int32 ChatLogsNum = 3;
|
int32 chatLogsNum = 3;
|
||||||
CommonResp CommonResp = 4;
|
CommonResp commonResp = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,36 +98,36 @@ message StatisticsReq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message GetActiveUserReq{
|
message GetActiveUserReq{
|
||||||
StatisticsReq StatisticsReq = 1;
|
StatisticsReq statisticsReq = 1;
|
||||||
string OperationID = 2;
|
string operationID = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserResp{
|
message UserResp{
|
||||||
string NickName = 1;
|
string nickName = 1;
|
||||||
string UserId = 2;
|
string userID = 2;
|
||||||
int32 MessageNum = 3;
|
int32 messageNum = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetActiveUserResp {
|
message GetActiveUserResp {
|
||||||
repeated UserResp Users = 1;
|
repeated UserResp Users = 1;
|
||||||
CommonResp CommonResp = 2;
|
CommonResp commonResp = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetActiveGroupReq{
|
message GetActiveGroupReq{
|
||||||
StatisticsReq StatisticsReq = 1;
|
StatisticsReq statisticsReq = 1;
|
||||||
string OperationID = 2;
|
string operationID = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GroupResp {
|
message GroupResp {
|
||||||
string GroupName = 1;
|
string GroupName = 1;
|
||||||
string GroupId = 2;
|
string GroupId = 2;
|
||||||
int32 MessageNum = 3;
|
int32 MessageNum = 3;
|
||||||
CommonResp CommonResp = 4;
|
CommonResp commonResp = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetActiveGroupResp {
|
message GetActiveGroupResp {
|
||||||
repeated GroupResp Groups = 1;
|
repeated GroupResp Groups = 1;
|
||||||
CommonResp CommonResp = 2;
|
CommonResp commonResp = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DateNumList {
|
message DateNumList {
|
||||||
@ -147,7 +147,7 @@ message GetMessageStatisticsResp {
|
|||||||
int32 GroupMessageNum = 2;
|
int32 GroupMessageNum = 2;
|
||||||
repeated DateNumList PrivateMessageNumList = 3;
|
repeated DateNumList PrivateMessageNumList = 3;
|
||||||
repeated DateNumList GroupMessageNumList = 4;
|
repeated DateNumList GroupMessageNumList = 4;
|
||||||
CommonResp CommonResp = 5;
|
CommonResp commonResp = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetGroupStatisticsReq {
|
message GetGroupStatisticsReq {
|
||||||
@ -161,7 +161,7 @@ message GetGroupStatisticsResp {
|
|||||||
int32 TotalGroupNum = 2;
|
int32 TotalGroupNum = 2;
|
||||||
repeated DateNumList IncreaseGroupNumList = 3;
|
repeated DateNumList IncreaseGroupNumList = 3;
|
||||||
repeated DateNumList TotalGroupNumList = 4;
|
repeated DateNumList TotalGroupNumList = 4;
|
||||||
CommonResp CommonResp = 5;
|
CommonResp commonResp = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetUserStatisticsReq {
|
message GetUserStatisticsReq {
|
||||||
@ -176,7 +176,139 @@ message GetUserStatisticsResp {
|
|||||||
repeated DateNumList IncreaseUserNumList = 4;
|
repeated DateNumList IncreaseUserNumList = 4;
|
||||||
repeated DateNumList ActiveUserNumList = 5;
|
repeated DateNumList ActiveUserNumList = 5;
|
||||||
repeated DateNumList TotalUserNumList = 6;
|
repeated DateNumList TotalUserNumList = 6;
|
||||||
CommonResp CommonResp = 7;
|
CommonResp commonResp = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GenerateInvitationCodeReq {
|
||||||
|
string operationID = 1;
|
||||||
|
int32 codeLen = 2;
|
||||||
|
int32 codeNum = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GenerateInvitationCodeResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetInvitationCodesReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string code = 2;
|
||||||
|
int32 status = 3;
|
||||||
|
server_api_params.RequestPagination pagination = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message invitationCode {
|
||||||
|
string invitationCode = 1;
|
||||||
|
int32 createTime = 2;
|
||||||
|
int32 lastTime = 3;
|
||||||
|
string userID = 4;
|
||||||
|
int32 status = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetInvitationCodesResp {
|
||||||
|
repeated invitationCode invitationCodes = 1;
|
||||||
|
server_api_params.ResponsePagination Pagination = 2;
|
||||||
|
CommonResp commonResp = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryIPRegisterReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string IP = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryIPRegisterResp {
|
||||||
|
string IP = 1;
|
||||||
|
int32 RegisterNum = 2;
|
||||||
|
int32 Status = 3;
|
||||||
|
repeated string userIDList = 4;
|
||||||
|
CommonResp commonResp = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddIPLimitReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string IP = 2;
|
||||||
|
int32 limitTime = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddIPLimitResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveIPLimitReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string IP = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveIPLimitResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryUserIDIPLimitLoginReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string userID = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UserIPLimit {
|
||||||
|
string userID = 1;
|
||||||
|
string IP = 2;
|
||||||
|
int32 createTime = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryUserIDIPLimitLoginResp {
|
||||||
|
repeated UserIPLimit UserIPLimits = 1;
|
||||||
|
CommonResp commonResp = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddUserIPLimitLoginReq {
|
||||||
|
string userID = 1;
|
||||||
|
string operationID = 2;
|
||||||
|
string IP = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddUserIPLimitLoginResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveUserIPLimitReq {
|
||||||
|
string userID = 1;
|
||||||
|
string operationID = 2;
|
||||||
|
string IP = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveUserIPLimitResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetClientInitConfigReq {
|
||||||
|
string operationID = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetClientInitConfigResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetClientInitConfigReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string discoverPageURL = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetClientInitConfigResp {
|
||||||
|
CommonResp commonResp = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetUserFriendsReq {
|
||||||
|
string operationID = 1;
|
||||||
|
string userID = 2;
|
||||||
|
string friendUserID = 3;
|
||||||
|
string friendUserName = 4;
|
||||||
|
server_api_params.RequestPagination pagination = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message GetUserFriendsResp {
|
||||||
|
server_api_params.ResponsePagination pagination = 1;
|
||||||
|
repeated server_api_params.FriendInfo friendInfoList = 2;
|
||||||
|
int32 friendNums = 3;
|
||||||
|
CommonResp commonResp = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
service adminCMS {
|
service adminCMS {
|
||||||
@ -193,4 +325,19 @@ service adminCMS {
|
|||||||
rpc GetMessageStatistics(GetMessageStatisticsReq) returns(GetMessageStatisticsResp);
|
rpc GetMessageStatistics(GetMessageStatisticsReq) returns(GetMessageStatisticsResp);
|
||||||
rpc GetGroupStatistics(GetGroupStatisticsReq) returns(GetGroupStatisticsResp);
|
rpc GetGroupStatistics(GetGroupStatisticsReq) returns(GetGroupStatisticsResp);
|
||||||
rpc GetUserStatistics(GetUserStatisticsReq) returns(GetUserStatisticsResp);
|
rpc GetUserStatistics(GetUserStatisticsReq) returns(GetUserStatisticsResp);
|
||||||
|
|
||||||
|
rpc GenerateInvitationCode(GenerateInvitationCodeReq) returns(GenerateInvitationCodeResp);
|
||||||
|
rpc GetInvitationCodes(GetInvitationCodesReq) returns(GetInvitationCodesResp);
|
||||||
|
|
||||||
|
rpc QueryIPRegister(QueryIPRegisterReq) returns(QueryIPRegisterResp);
|
||||||
|
rpc AddIPLimit(AddIPLimitReq) returns(AddIPLimitResp);
|
||||||
|
rpc RemoveIPLimit(RemoveIPLimitReq) returns(RemoveIPLimitResp);
|
||||||
|
rpc QueryUserIDIPLimitLogin(QueryUserIDIPLimitLoginReq) returns(QueryUserIDIPLimitLoginResp);
|
||||||
|
rpc AddUserIPLimitLogin(AddUserIPLimitLoginReq) returns(AddUserIPLimitLoginResp);
|
||||||
|
rpc RemoveUserIPLimit(RemoveUserIPLimitReq) returns(RemoveUserIPLimitResp);
|
||||||
|
|
||||||
|
rpc GetClientInitConfig(GetClientInitConfigReq) returns(GetClientInitConfigResp);
|
||||||
|
rpc SetClientInitConfig(SetClientInitConfigReq) returns(SetClientInitConfigResp);
|
||||||
|
|
||||||
|
rpc GetUserFriends(GetUserFriendsReq) returns(GetUserFriendsResp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user