mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
notification
This commit is contained in:
parent
333453df79
commit
27fd4f444b
@ -1,49 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
type paramsAddBlackList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
}*/
|
||||
|
||||
func AddBlacklist(c *gin.Context) {
|
||||
log.Info("", "", "api add blacklist init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsSearchFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddBlacklistReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OwnerUid: params.OwnerUid,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api add blacklist is server:userID=%s", req.Uid)
|
||||
RpcResp, err := client.AddBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call add blacklist rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call add blacklist rpc server success,args=%s", RpcResp.String())
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.InfoByArgs("api add blacklist success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsImportFriendReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UIDList []string `json:"uidList" binding:"required"`
|
||||
OwnerUid string `json:"ownerUid" binding:"required"`
|
||||
}
|
||||
|
||||
type paramsAddFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
ReqMessage string `json:"reqMessage"`
|
||||
}
|
||||
|
||||
//
|
||||
func ImportFriend(c *gin.Context) {
|
||||
log.Info("", "", "ImportFriend init ....")
|
||||
log.NewDebug("", "api importFriend start")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
|
||||
params := paramsImportFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.ImportFriendReq{
|
||||
UidList: params.UIDList,
|
||||
OperationID: params.OperationID,
|
||||
OwnerUid: params.OwnerUid,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.NewDebug(req.OperationID, "args is ", req.String())
|
||||
RpcResp, err := client.ImportFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "rpc importFriend failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
failedUidList := make([]string, 0)
|
||||
for _, v := range RpcResp.FailedUidList {
|
||||
failedUidList = append(failedUidList, v)
|
||||
}
|
||||
log.NewDebug(req.OperationID, "rpc importFriend success", RpcResp.CommonResp.ErrorMsg, RpcResp.CommonResp.ErrorCode, RpcResp.FailedUidList)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": failedUidList})
|
||||
}
|
||||
|
||||
func AddFriend(c *gin.Context) {
|
||||
log.Info("", "", "api add friend init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
|
||||
params := paramsAddFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddFriendReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
ReqMessage: params.ReqMessage,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api add friend is server")
|
||||
RpcResp, err := client.AddFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call add friend rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
})
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsAddFriendResponse struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
Flag int32 `json:"flag" binding:"required"`
|
||||
}
|
||||
|
||||
func AddFriendResponse(c *gin.Context) {
|
||||
log.Info("", "", fmt.Sprintf("api add friend response init ...."))
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsAddFriendResponse{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddFriendResponseReq{
|
||||
Uid: params.UID,
|
||||
Flag: params.Flag,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api add friend response is server:userID=%s", req.Uid)
|
||||
RpcResp, err := client.AddFriendResponse(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call add_friend_response rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call add friend response rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
log.InfoByArgs("api add friend response success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsDeleteFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
}
|
||||
|
||||
func DeleteFriend(c *gin.Context) {
|
||||
log.Info("", "", fmt.Sprintf("api delete_friend init ...."))
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsDeleteFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.DeleteFriendReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api delete_friend is server:%s", req.Uid)
|
||||
RpcResp, err := client.DeleteFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call delete_friend rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call delete_friend rpc server,args=%s", RpcResp.String())
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.InfoByArgs("api delete_friend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
604
internal/api/friend/friend.go
Normal file
604
internal/api/friend/friend.go
Normal file
@ -0,0 +1,604 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsCommFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
ToUserID string `json:"toUserID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
}
|
||||
|
||||
func AddBlacklist(c *gin.Context) {
|
||||
params := paramsCommFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddBlacklistReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "AddBlacklist args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp)
|
||||
}
|
||||
|
||||
type paramsImportFriendReq struct {
|
||||
FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
Token string `json:"token"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
OpUserID string `json:"opUserID" binding:"required"`
|
||||
}
|
||||
|
||||
func ImportFriend(c *gin.Context) {
|
||||
params := paramsImportFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
req := &pbFriend.ImportFriendReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "ImportFriend args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.ImportFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "ImportFriend failed", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
failedUidList := make([]string, 0)
|
||||
for _, v := range RpcResp.FailedUidList {
|
||||
failedUidList = append(failedUidList, v)
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.CommonResp.ErrCode, "errMsg": RpcResp.CommonResp.ErrMsg, "failedUidList": failedUidList}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.OperationID, "AddBlacklist api return ", resp)
|
||||
}
|
||||
|
||||
type paramsAddFriend struct {
|
||||
paramsCommFriend
|
||||
ReqMessage string `json:"reqMessage"`
|
||||
}
|
||||
|
||||
func AddFriend(c *gin.Context) {
|
||||
params := paramsAddFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddFriendReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
req.ReqMessage = params.ReqMessage
|
||||
log.NewInfo("AddFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp)
|
||||
}
|
||||
|
||||
type paramsAddFriendResponse struct {
|
||||
paramsCommFriend
|
||||
Flag int32 `json:"flag" binding:"required"`
|
||||
}
|
||||
|
||||
func AddFriendResponse(c *gin.Context) {
|
||||
params := paramsAddFriendResponse{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.AddFriendResponseReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
req.Flag = params.Flag
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddFriendResponse(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp)
|
||||
}
|
||||
|
||||
type paramsDeleteFriend struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
func DeleteFriend(c *gin.Context) {
|
||||
params := paramsDeleteFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.DeleteFriendReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.DeleteFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp)
|
||||
}
|
||||
|
||||
type paramsGetBlackList struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
type PublicUserInfo struct {
|
||||
UserID string `json:"userID"`
|
||||
Nickname string `json:"nickname"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
Gender int32 `json:"gender"`
|
||||
}
|
||||
|
||||
type blackUserInfo struct {
|
||||
PublicUserInfo
|
||||
}
|
||||
|
||||
func GetBlacklist(c *gin.Context) {
|
||||
params := paramsGetBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetBlacklistReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
if RpcResp.ErrCode == 0 {
|
||||
userBlackList := make([]blackUserInfo, 0)
|
||||
for _, friend := range RpcResp.Data {
|
||||
var b blackUserInfo
|
||||
utils.CopyStructFields(&b, friend)
|
||||
|
||||
userBlackList = append(userBlackList, b)
|
||||
}
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrCode,
|
||||
"errMsg": RpcResp.ErrMsg,
|
||||
"data": userBlackList,
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewError(req.CommID.OperationID, "GetBlacklist api return ", resp)
|
||||
}
|
||||
}
|
||||
|
||||
type paramsSetFriendComment struct {
|
||||
paramsCommFriend
|
||||
remark string `json:"remark" binding:"required"`
|
||||
}
|
||||
|
||||
func SetFriendComment(c *gin.Context) {
|
||||
params := paramsSetFriendComment{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.SetFriendCommentReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
req.Remark = params.remark
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.SetFriendComment(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"})
|
||||
return
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp)
|
||||
}
|
||||
|
||||
type paramsRemoveBlackList struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
func RemoveBlacklist(c *gin.Context) {
|
||||
params := paramsRemoveBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.RemoveBlacklistReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.RemoveBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp)
|
||||
}
|
||||
|
||||
type paramsIsFriend struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
func IsFriend(c *gin.Context) {
|
||||
params := paramsIsFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.IsFriendReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.IsFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg, "isFriend": RpcResp.ShipType}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
}
|
||||
|
||||
type paramsSearchFriend struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
func GetFriendsInfo(c *gin.Context) {
|
||||
params := paramsSearchFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendsInfoReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendsInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetFriendsInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetFriendsInfo failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call search friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
if RpcResp.ErrCode == 0 {
|
||||
var fi friendInfo
|
||||
utils.CopyStructFields(&fi, RpcResp.Data.FriendUser)
|
||||
utils.CopyStructFields(&fi, RpcResp.Data)
|
||||
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrCode,
|
||||
"errMsg": RpcResp.ErrMsg,
|
||||
"data": fi,
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrCode,
|
||||
"errMsg": RpcResp.ErrMsg,
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
}
|
||||
|
||||
type paramsGetFriendList struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
type friendInfo struct {
|
||||
UserID string `json:"userID"`
|
||||
Nickname string `json:"nickname"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
Gender int32 `json:"gender"`
|
||||
Mobile string `json:"mobile"`
|
||||
Birth string `json:"birth"`
|
||||
Email string `json:"email"`
|
||||
Ext string `json:"ext"`
|
||||
Remark string `json:"remark"`
|
||||
IsBlack int32 `json:"isBlack"`
|
||||
}
|
||||
|
||||
func GetFriendList(c *gin.Context) {
|
||||
params := paramsGetFriendList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendListReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetFriendList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
if RpcResp.ErrCode == 0 {
|
||||
friendsInfo := make([]friendInfo, 0)
|
||||
for _, friend := range RpcResp.Data {
|
||||
|
||||
var fi friendInfo
|
||||
utils.CopyStructFields(&fi, friend.FriendUser)
|
||||
utils.CopyStructFields(&fi, RpcResp.Data)
|
||||
friendsInfo = append(friendsInfo, fi)
|
||||
}
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrCode,
|
||||
"errMsg": RpcResp.ErrMsg,
|
||||
"data": friendsInfo,
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type paramsGetApplyList struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
|
||||
type FriendApplicationUserInfo struct {
|
||||
PublicUserInfo
|
||||
ApplyTime int64 `json:"applyTime"`
|
||||
ReqMessage string `json:"reqMessage`
|
||||
Flag int32 `json:"flag"`
|
||||
}
|
||||
|
||||
func GetFriendApplyList(c *gin.Context) {
|
||||
params := paramsGetApplyList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendApplyReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.GetFriendApplyList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
if RpcResp.ErrCode == 0 {
|
||||
userInfoList := make([]FriendApplicationUserInfo, 0)
|
||||
for _, applyUserinfo := range RpcResp.Data {
|
||||
var un FriendApplicationUserInfo
|
||||
utils.CopyStructFields(&un, applyUserinfo.UserInfo)
|
||||
utils.CopyStructFields(&un, applyUserinfo)
|
||||
userInfoList = append(userInfoList, un)
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg, "data": userInfoList}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
}
|
||||
}
|
||||
|
||||
func GetSelfApplyList(c *gin.Context) {
|
||||
params := paramsGetApplyList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendApplyReq{}
|
||||
utils.CopyStructFields(req.CommID, params)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetSelfApplyList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"})
|
||||
return
|
||||
}
|
||||
|
||||
if RpcResp.ErrCode == 0 {
|
||||
userInfoList := make([]FriendApplicationUserInfo, 0)
|
||||
for _, applyUserinfo := range RpcResp.Data {
|
||||
var un FriendApplicationUserInfo
|
||||
utils.CopyStructFields(&un, applyUserinfo.UserInfo)
|
||||
utils.CopyStructFields(&un, applyUserinfo)
|
||||
userInfoList = append(userInfoList, un)
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg, "data": userInfoList}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrCode, "errMsg": RpcResp.ErrMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp)
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGetBlackList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
type blackListUserInfo struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Gender int32 `json:"gender"`
|
||||
Mobile string `json:"mobile"`
|
||||
Birth string `json:"birth"`
|
||||
Email string `json:"email"`
|
||||
Ex string `json:"ex"`
|
||||
}
|
||||
|
||||
func GetBlacklist(c *gin.Context) {
|
||||
log.Info("", "", "api get blacklist init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetBlacklistReq{
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, fmt.Sprintf("api get blacklist is server"))
|
||||
RpcResp, err := client.GetBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call get_friend_list rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get blacklist rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
userBlackList := make([]blackListUserInfo, 0)
|
||||
for _, friend := range RpcResp.Data {
|
||||
var fi blackListUserInfo
|
||||
fi.UID = friend.Uid
|
||||
fi.Name = friend.Name
|
||||
fi.Icon = friend.Icon
|
||||
fi.Gender = friend.Gender
|
||||
fi.Mobile = friend.Mobile
|
||||
fi.Birth = friend.Birth
|
||||
fi.Email = friend.Email
|
||||
fi.Ex = friend.Ex
|
||||
userBlackList = append(userBlackList, fi)
|
||||
}
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
"data": userBlackList,
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
log.InfoByArgs("api get black list success return,get args=%s,return=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGetApplyList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type UserInfo struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Gender int32 `json:"gender"`
|
||||
Mobile string `json:"mobile"`
|
||||
Birth string `json:"birth"`
|
||||
Email string `json:"email"`
|
||||
Ex string `json:"ex"`
|
||||
ReqMessage string `json:"reqMessage"`
|
||||
ApplyTime string `json:"applyTime"`
|
||||
Flag int32 `json:"flag"`
|
||||
}
|
||||
|
||||
func GetFriendApplyList(c *gin.Context) {
|
||||
log.Info("", "", "api get_friend_apply_list init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetApplyList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendApplyReq{
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api get friend apply list is server")
|
||||
RpcResp, err := client.GetFriendApplyList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call get friend apply list rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get friend apply list rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
userInfoList := make([]UserInfo, 0)
|
||||
for _, applyUserinfo := range RpcResp.Data {
|
||||
var un UserInfo
|
||||
un.UID = applyUserinfo.Uid
|
||||
un.Name = applyUserinfo.Name
|
||||
un.Icon = applyUserinfo.Icon
|
||||
un.Gender = applyUserinfo.Gender
|
||||
un.Mobile = applyUserinfo.Mobile
|
||||
un.Birth = applyUserinfo.Birth
|
||||
un.Email = applyUserinfo.Email
|
||||
un.Ex = applyUserinfo.Ex
|
||||
un.Flag = applyUserinfo.Flag
|
||||
un.ApplyTime = applyUserinfo.ApplyTime
|
||||
un.ReqMessage = applyUserinfo.ReqMessage
|
||||
userInfoList = append(userInfoList, un)
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": userInfoList}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
log.InfoByArgs("api get friend apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
||||
|
||||
func GetSelfApplyList(c *gin.Context) {
|
||||
log.Info("", "", "api get self friend apply list init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetApplyList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendApplyReq{
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api get self apply list is server")
|
||||
RpcResp, err := client.GetSelfApplyList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call get self apply list rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get self apply list rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
userInfoList := make([]UserInfo, 0)
|
||||
for _, selfApplyOtherUserinfo := range RpcResp.Data {
|
||||
var un UserInfo
|
||||
un.UID = selfApplyOtherUserinfo.Uid
|
||||
un.Name = selfApplyOtherUserinfo.Name
|
||||
un.Icon = selfApplyOtherUserinfo.Icon
|
||||
un.Gender = selfApplyOtherUserinfo.Gender
|
||||
un.Mobile = selfApplyOtherUserinfo.Mobile
|
||||
un.Birth = selfApplyOtherUserinfo.Birth
|
||||
un.Email = selfApplyOtherUserinfo.Email
|
||||
un.Ex = selfApplyOtherUserinfo.Ex
|
||||
un.Flag = selfApplyOtherUserinfo.Flag
|
||||
un.ApplyTime = selfApplyOtherUserinfo.ApplyTime
|
||||
un.ReqMessage = selfApplyOtherUserinfo.ReqMessage
|
||||
userInfoList = append(userInfoList, un)
|
||||
}
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": userInfoList}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
log.InfoByArgs("api get self apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGetFriendLIst struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
type friendInfo struct {
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon"`
|
||||
Gender int32 `json:"gender"`
|
||||
Mobile string `json:"mobile"`
|
||||
Birth string `json:"birth"`
|
||||
Email string `json:"email"`
|
||||
Ex string `json:"ex"`
|
||||
Comment string `json:"comment"`
|
||||
IsInBlackList int32 `json:"isInBlackList"`
|
||||
}
|
||||
|
||||
func GetFriendList(c *gin.Context) {
|
||||
log.Info("", "", fmt.Sprintf("api get_friendlist init ...."))
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetFriendLIst{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendListReq{
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api get friend list is server")
|
||||
RpcResp, err := client.GetFriendList(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call get friend list rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get friend list rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
friendsInfo := make([]friendInfo, 0)
|
||||
for _, friend := range RpcResp.Data {
|
||||
var fi friendInfo
|
||||
fi.UID = friend.Uid
|
||||
fi.Name = friend.Name
|
||||
fi.Icon = friend.Icon
|
||||
fi.Gender = friend.Gender
|
||||
fi.Mobile = friend.Mobile
|
||||
fi.Birth = friend.Birth
|
||||
fi.Email = friend.Email
|
||||
fi.Ex = friend.Ex
|
||||
fi.Comment = friend.Comment
|
||||
fi.IsInBlackList = friend.IsInBlackList
|
||||
friendsInfo = append(friendsInfo, fi)
|
||||
}
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
"data": friendsInfo,
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
log.InfoByArgs("api get friend list success return,get args=%s,return=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsSearchFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
OwnerUid string `json:"ownerUid"`
|
||||
}
|
||||
|
||||
func GetFriendsInfo(c *gin.Context) {
|
||||
log.Info("", "", fmt.Sprintf("api search friend init ...."))
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsSearchFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.GetFriendsInfoReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api search_friend is server")
|
||||
RpcResp, err := client.GetFriendsInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call search friend rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call search friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call search friend rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
"data": gin.H{
|
||||
"uid": RpcResp.Data.Uid,
|
||||
"icon": RpcResp.Data.Icon,
|
||||
"name": RpcResp.Data.Name,
|
||||
"gender": RpcResp.Data.Gender,
|
||||
"mobile": RpcResp.Data.Mobile,
|
||||
"birth": RpcResp.Data.Birth,
|
||||
"email": RpcResp.Data.Email,
|
||||
"ex": RpcResp.Data.Ex,
|
||||
"comment": RpcResp.Data.Comment,
|
||||
},
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
resp := gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
log.InfoByArgs("api search_friend success return,get args=%s,return=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsIsFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
ReceiveUid string `json:"receive_uid"`
|
||||
}
|
||||
|
||||
func IsFriend(c *gin.Context) {
|
||||
log.Info("", "", "api is friend init....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsIsFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.IsFriendReq{
|
||||
OperationID: params.OperationID,
|
||||
ReceiveUid: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api is friend is server")
|
||||
RpcResp, err := client.IsFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call add friend rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call is friend rpc server success,args=%s", RpcResp.String())
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "isFriend": RpcResp.ShipType}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.InfoByArgs("api is friend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsRemoveBlackList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
}
|
||||
|
||||
func RemoveBlacklist(c *gin.Context) {
|
||||
log.Info("", "", "api remove_blacklist init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsRemoveBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.RemoveBlacklistReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api remove blacklist is server:userID=%s", req.Uid)
|
||||
RpcResp, err := client.RemoveBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call remove blacklist rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call remove blacklist rpc server success,args=%s", RpcResp.String())
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
log.InfoByArgs("api remove blacklist success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsSetFriendComment struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
Comment string `json:"comment"`
|
||||
}
|
||||
|
||||
func SetFriendComment(c *gin.Context) {
|
||||
log.Info("", "", "api set friend comment init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsSetFriendComment{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbFriend.SetFriendCommentReq{
|
||||
Uid: params.UID,
|
||||
OperationID: params.OperationID,
|
||||
Comment: params.Comment,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api set friend comment is server")
|
||||
RpcResp, err := client.SetFriendComment(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call set friend comment rpc server failed", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "call set friend comment rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
log.Info("", "", "api set friend comment success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsCreateGroupStruct struct {
|
||||
MemberList []*pb.GroupAddMemberInfo `json:"memberList"`
|
||||
GroupName string `json:"groupName"`
|
||||
Introduction string `json:"introduction"`
|
||||
Notification string `json:"notification"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
Ex string `json:"ex"`
|
||||
}
|
||||
|
||||
func CreateGroup(c *gin.Context) {
|
||||
log.Info("", "", "api create group init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsCreateGroupStruct{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.CreateGroupReq{
|
||||
MemberList: params.MemberList,
|
||||
GroupName: params.GroupName,
|
||||
Introduction: params.Introduction,
|
||||
Notification: params.Notification,
|
||||
FaceUrl: params.FaceUrl,
|
||||
OperationID: params.OperationID,
|
||||
Ex: params.Ex,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api create group is server,params=%s", req.String())
|
||||
RpcResp, err := client.CreateGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call create group rpc server failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call create group rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": gin.H{"groupID": RpcResp.GroupID}}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
log.InfoByArgs("api create group success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGroupApplicationList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func newUserRegisterReq(params *paramsGroupApplicationList) *group.GetGroupApplicationListReq {
|
||||
pbData := group.GetGroupApplicationListReq{
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
type paramsGroupApplicationListRet struct {
|
||||
ID string `json:"id"`
|
||||
GroupID string `json:"groupID"`
|
||||
FromUserID string `json:"fromUserID"`
|
||||
ToUserID string `json:"toUserID"`
|
||||
Flag int32 `json:"flag"`
|
||||
RequestMsg string `json:"reqMsg"`
|
||||
HandledMsg string `json:"handledMsg"`
|
||||
AddTime int64 `json:"createTime"`
|
||||
FromUserNickname string `json:"fromUserNickName"`
|
||||
ToUserNickname string `json:"toUserNickName"`
|
||||
FromUserFaceUrl string `json:"fromUserFaceURL"`
|
||||
ToUserFaceUrl string `json:"toUserFaceURL"`
|
||||
HandledUser string `json:"handledUser"`
|
||||
Type int32 `json:"type"`
|
||||
HandleStatus int32 `json:"handleStatus"`
|
||||
HandleResult int32 `json:"handleResult"`
|
||||
}
|
||||
|
||||
func GetGroupApplicationList(c *gin.Context) {
|
||||
log.Info("", "", "api GetGroupApplicationList init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGroupApplicationList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newUserRegisterReq(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.UID = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api GetGroupApplicationList is server, [data: %s]", pbData.String())
|
||||
reply, err := client.GetGroupApplicationList(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api GetGroupApplicationList call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api GetGroupApplicationList call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
unProcessCount := 0
|
||||
userReq := make([]paramsGroupApplicationListRet, 0)
|
||||
if reply != nil && reply.Data != nil && reply.Data.User != nil {
|
||||
for i := 0; i < len(reply.Data.User); i++ {
|
||||
req := paramsGroupApplicationListRet{}
|
||||
req.ID = reply.Data.User[i].ID
|
||||
req.GroupID = reply.Data.User[i].GroupID
|
||||
req.FromUserID = reply.Data.User[i].FromUserID
|
||||
req.ToUserID = reply.Data.User[i].ToUserID
|
||||
req.Flag = reply.Data.User[i].Flag
|
||||
req.RequestMsg = reply.Data.User[i].RequestMsg
|
||||
req.HandledMsg = reply.Data.User[i].HandledMsg
|
||||
req.AddTime = reply.Data.User[i].AddTime
|
||||
req.FromUserNickname = reply.Data.User[i].FromUserNickname
|
||||
req.ToUserNickname = reply.Data.User[i].ToUserNickname
|
||||
req.FromUserFaceUrl = reply.Data.User[i].FromUserFaceUrl
|
||||
req.ToUserFaceUrl = reply.Data.User[i].ToUserFaceUrl
|
||||
req.HandledUser = reply.Data.User[i].HandledUser
|
||||
req.Type = reply.Data.User[i].Type
|
||||
req.HandleStatus = reply.Data.User[i].HandleStatus
|
||||
req.HandleResult = reply.Data.User[i].HandleResult
|
||||
userReq = append(userReq, req)
|
||||
|
||||
if req.Flag == 0 {
|
||||
unProcessCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
"data": gin.H{
|
||||
"count": unProcessCount,
|
||||
"user": userReq,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGetGroupInfo struct {
|
||||
GroupIDList []string `json:"groupIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func GetGroupsInfo(c *gin.Context) {
|
||||
log.Info("", "", "api get groups info init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetGroupInfo{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.GetGroupsInfoReq{
|
||||
GroupIDList: params.GroupIDList,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "get groups info is server,params=%s", req.String())
|
||||
RpcResp, err := client.GetGroupsInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call get groups info rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get groups info rpc server success", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
groupsInfo := make([]pb.GroupInfo, 0)
|
||||
for _, v := range RpcResp.Data {
|
||||
var groupInfo pb.GroupInfo
|
||||
groupInfo.GroupId = v.GroupId
|
||||
groupInfo.GroupName = v.GroupName
|
||||
groupInfo.Notification = v.Notification
|
||||
groupInfo.Introduction = v.Introduction
|
||||
groupInfo.FaceUrl = v.FaceUrl
|
||||
groupInfo.CreateTime = v.CreateTime
|
||||
groupInfo.OwnerId = v.OwnerId
|
||||
groupInfo.MemberCount = v.MemberCount
|
||||
|
||||
groupsInfo = append(groupsInfo, groupInfo)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
"data": groupsInfo,
|
||||
})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package group
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
@ -31,10 +32,6 @@ type KickGroupMemberReq struct {
|
||||
}
|
||||
|
||||
func KickGroupMember(c *gin.Context) {
|
||||
log.Info("", "", "KickGroupMember start....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
|
||||
params := KickGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@ -50,7 +47,8 @@ func KickGroupMember(c *gin.Context) {
|
||||
UidListInfo: params.UidListInfo,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "recv req: ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.KickGroupMember(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "GetGroupMemberList failed, err: ", err.Error())
|
||||
@ -349,3 +347,445 @@ func InviteUserToGroup(c *gin.Context) {
|
||||
//resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": RpcResp.Id2Result}
|
||||
c.JSON(http.StatusOK, iResp)
|
||||
}
|
||||
|
||||
type paramsCreateGroupStruct struct {
|
||||
MemberList []*pb.GroupAddMemberInfo `json:"memberList"`
|
||||
GroupName string `json:"groupName"`
|
||||
Introduction string `json:"introduction"`
|
||||
Notification string `json:"notification"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
Ex string `json:"ex"`
|
||||
}
|
||||
|
||||
func CreateGroup(c *gin.Context) {
|
||||
log.Info("", "", "api create group init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsCreateGroupStruct{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.CreateGroupReq{
|
||||
MemberList: params.MemberList,
|
||||
GroupName: params.GroupName,
|
||||
Introduction: params.Introduction,
|
||||
Notification: params.Notification,
|
||||
FaceUrl: params.FaceUrl,
|
||||
OperationID: params.OperationID,
|
||||
Ex: params.Ex,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api create group is server,params=%s", req.String())
|
||||
RpcResp, err := client.CreateGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,call create group rpc server failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call create group rpc server success,args=%s", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": gin.H{"groupID": RpcResp.GroupID}}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
log.InfoByArgs("api create group success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
||||
|
||||
type paramsGroupApplicationList struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func newUserRegisterReq(params *paramsGroupApplicationList) *group.GetGroupApplicationListReq {
|
||||
pbData := group.GetGroupApplicationListReq{
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
type paramsGroupApplicationListRet struct {
|
||||
ID string `json:"id"`
|
||||
GroupID string `json:"groupID"`
|
||||
FromUserID string `json:"fromUserID"`
|
||||
ToUserID string `json:"toUserID"`
|
||||
Flag int32 `json:"flag"`
|
||||
RequestMsg string `json:"reqMsg"`
|
||||
HandledMsg string `json:"handledMsg"`
|
||||
AddTime int64 `json:"createTime"`
|
||||
FromUserNickname string `json:"fromUserNickName"`
|
||||
ToUserNickname string `json:"toUserNickName"`
|
||||
FromUserFaceUrl string `json:"fromUserFaceURL"`
|
||||
ToUserFaceUrl string `json:"toUserFaceURL"`
|
||||
HandledUser string `json:"handledUser"`
|
||||
Type int32 `json:"type"`
|
||||
HandleStatus int32 `json:"handleStatus"`
|
||||
HandleResult int32 `json:"handleResult"`
|
||||
}
|
||||
|
||||
func GetGroupApplicationList(c *gin.Context) {
|
||||
log.Info("", "", "api GetGroupApplicationList init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGroupApplicationList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newUserRegisterReq(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.UID = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api GetGroupApplicationList is server, [data: %s]", pbData.String())
|
||||
reply, err := client.GetGroupApplicationList(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api GetGroupApplicationList call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api GetGroupApplicationList call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
unProcessCount := 0
|
||||
userReq := make([]paramsGroupApplicationListRet, 0)
|
||||
if reply != nil && reply.Data != nil && reply.Data.User != nil {
|
||||
for i := 0; i < len(reply.Data.User); i++ {
|
||||
req := paramsGroupApplicationListRet{}
|
||||
req.ID = reply.Data.User[i].ID
|
||||
req.GroupID = reply.Data.User[i].GroupID
|
||||
req.FromUserID = reply.Data.User[i].FromUserID
|
||||
req.ToUserID = reply.Data.User[i].ToUserID
|
||||
req.Flag = reply.Data.User[i].Flag
|
||||
req.RequestMsg = reply.Data.User[i].RequestMsg
|
||||
req.HandledMsg = reply.Data.User[i].HandledMsg
|
||||
req.AddTime = reply.Data.User[i].AddTime
|
||||
req.FromUserNickname = reply.Data.User[i].FromUserNickname
|
||||
req.ToUserNickname = reply.Data.User[i].ToUserNickname
|
||||
req.FromUserFaceUrl = reply.Data.User[i].FromUserFaceUrl
|
||||
req.ToUserFaceUrl = reply.Data.User[i].ToUserFaceUrl
|
||||
req.HandledUser = reply.Data.User[i].HandledUser
|
||||
req.Type = reply.Data.User[i].Type
|
||||
req.HandleStatus = reply.Data.User[i].HandleStatus
|
||||
req.HandleResult = reply.Data.User[i].HandleResult
|
||||
userReq = append(userReq, req)
|
||||
|
||||
if req.Flag == 0 {
|
||||
unProcessCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
"data": gin.H{
|
||||
"count": unProcessCount,
|
||||
"user": userReq,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
type paramsGetGroupInfo struct {
|
||||
GroupIDList []string `json:"groupIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func GetGroupsInfo(c *gin.Context) {
|
||||
log.Info("", "", "api get groups info init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGetGroupInfo{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.GetGroupsInfoReq{
|
||||
GroupIDList: params.GroupIDList,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "get groups info is server,params=%s", req.String())
|
||||
RpcResp, err := client.GetGroupsInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call get groups info rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call get groups info rpc server success", RpcResp.String())
|
||||
if RpcResp.ErrorCode == 0 {
|
||||
groupsInfo := make([]pb.GroupInfo, 0)
|
||||
for _, v := range RpcResp.Data {
|
||||
var groupInfo pb.GroupInfo
|
||||
groupInfo.GroupId = v.GroupId
|
||||
groupInfo.GroupName = v.GroupName
|
||||
groupInfo.Notification = v.Notification
|
||||
groupInfo.Introduction = v.Introduction
|
||||
groupInfo.FaceUrl = v.FaceUrl
|
||||
groupInfo.CreateTime = v.CreateTime
|
||||
groupInfo.OwnerId = v.OwnerId
|
||||
groupInfo.MemberCount = v.MemberCount
|
||||
|
||||
groupsInfo = append(groupsInfo, groupInfo)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": RpcResp.ErrorCode,
|
||||
"errMsg": RpcResp.ErrorMsg,
|
||||
"data": groupsInfo,
|
||||
})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
}
|
||||
|
||||
type paramsGroupApplicationResponse struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
FromUserNickName string `json:"fromUserNickName"`
|
||||
FromUserFaceUrl string `json:"fromUserFaceUrl"`
|
||||
ToUserID string `json:"toUserID" binding:"required"`
|
||||
ToUserNickName string `json:"toUserNickName"`
|
||||
ToUserFaceUrl string `json:"toUserFaceUrl"`
|
||||
AddTime int64 `json:"addTime"`
|
||||
RequestMsg string `json:"requestMsg"`
|
||||
HandledMsg string `json:"handledMsg"`
|
||||
Type int32 `json:"type"`
|
||||
HandleStatus int32 `json:"handleStatus"`
|
||||
HandleResult int32 `json:"handleResult"`
|
||||
|
||||
UserID string `json:"userID"`
|
||||
}
|
||||
|
||||
func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.GroupApplicationResponseReq {
|
||||
pbData := group.GroupApplicationResponseReq{
|
||||
OperationID: params.OperationID,
|
||||
GroupID: params.GroupID,
|
||||
FromUserID: params.FromUserID,
|
||||
FromUserNickName: params.FromUserNickName,
|
||||
FromUserFaceUrl: params.FromUserFaceUrl,
|
||||
ToUserID: params.ToUserID,
|
||||
ToUserNickName: params.ToUserNickName,
|
||||
ToUserFaceUrl: params.ToUserFaceUrl,
|
||||
AddTime: params.AddTime,
|
||||
RequestMsg: params.RequestMsg,
|
||||
HandledMsg: params.HandledMsg,
|
||||
Type: params.Type,
|
||||
HandleStatus: params.HandleStatus,
|
||||
HandleResult: params.HandleResult,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
func ApplicationGroupResponse(c *gin.Context) {
|
||||
log.Info("", "", "api GroupApplicationResponse init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGroupApplicationResponse{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newGroupApplicationResponse(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.OwnerID = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api GroupApplicationResponse is server, [data: %s]", pbData.String())
|
||||
reply, err := client.GroupApplicationResponse(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api GroupApplicationResponse call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api GroupApplicationResponse call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
type paramsJoinGroup struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
Message string `json:"message"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func JoinGroup(c *gin.Context) {
|
||||
log.Info("", "", "api join group init....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsJoinGroup{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.JoinGroupReq{
|
||||
GroupID: params.GroupID,
|
||||
Message: params.Message,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api join group is server,params=%s", req.String())
|
||||
RpcResp, err := client.JoinGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call join group rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call join group rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
|
||||
type paramsQuitGroup struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func QuitGroup(c *gin.Context) {
|
||||
log.Info("", "", "api quit group init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsQuitGroup{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.QuitGroupReq{
|
||||
GroupID: params.GroupID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api quit group is server,params=%s", req.String())
|
||||
RpcResp, err := client.QuitGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call quit group rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call quit group rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
log.InfoByArgs("api quit group success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
||||
|
||||
type paramsSetGroupInfo struct {
|
||||
GroupID string `json:"groupId" binding:"required"`
|
||||
GroupName string `json:"groupName"`
|
||||
Notification string `json:"notification"`
|
||||
Introduction string `json:"introduction"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func SetGroupInfo(c *gin.Context) {
|
||||
log.Info("", "", "api set group info init...")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsSetGroupInfo{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.SetGroupInfoReq{
|
||||
GroupID: params.GroupID,
|
||||
GroupName: params.GroupName,
|
||||
Notification: params.Notification,
|
||||
Introduction: params.Introduction,
|
||||
FaceUrl: params.FaceUrl,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api set group info is server,params=%s", req.String())
|
||||
RpcResp, err := client.SetGroupInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call set group info rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call set group info rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
||||
|
||||
type paramsTransferGroupOwner struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
}
|
||||
|
||||
func newTransferGroupOwnerReq(params *paramsTransferGroupOwner) *group.TransferGroupOwnerReq {
|
||||
pbData := group.TransferGroupOwnerReq{
|
||||
OperationID: params.OperationID,
|
||||
GroupID: params.GroupID,
|
||||
NewOwner: params.UID,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
func TransferGroupOwner(c *gin.Context) {
|
||||
log.Info("", "", "api TransferGroupOwner init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsTransferGroupOwner{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newTransferGroupOwnerReq(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.OldOwner = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api TransferGroupOwner is server, [data: %s]", pbData.String())
|
||||
reply, err := client.TransferGroupOwner(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api TransferGroupOwner call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api TransferGroupOwner call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsGroupApplicationResponse struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
FromUserNickName string `json:"fromUserNickName"`
|
||||
FromUserFaceUrl string `json:"fromUserFaceUrl"`
|
||||
ToUserID string `json:"toUserID" binding:"required"`
|
||||
ToUserNickName string `json:"toUserNickName"`
|
||||
ToUserFaceUrl string `json:"toUserFaceUrl"`
|
||||
AddTime int64 `json:"addTime"`
|
||||
RequestMsg string `json:"requestMsg"`
|
||||
HandledMsg string `json:"handledMsg"`
|
||||
Type int32 `json:"type"`
|
||||
HandleStatus int32 `json:"handleStatus"`
|
||||
HandleResult int32 `json:"handleResult"`
|
||||
|
||||
UserID string `json:"userID"`
|
||||
}
|
||||
|
||||
func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.GroupApplicationResponseReq {
|
||||
pbData := group.GroupApplicationResponseReq{
|
||||
OperationID: params.OperationID,
|
||||
GroupID: params.GroupID,
|
||||
FromUserID: params.FromUserID,
|
||||
FromUserNickName: params.FromUserNickName,
|
||||
FromUserFaceUrl: params.FromUserFaceUrl,
|
||||
ToUserID: params.ToUserID,
|
||||
ToUserNickName: params.ToUserNickName,
|
||||
ToUserFaceUrl: params.ToUserFaceUrl,
|
||||
AddTime: params.AddTime,
|
||||
RequestMsg: params.RequestMsg,
|
||||
HandledMsg: params.HandledMsg,
|
||||
Type: params.Type,
|
||||
HandleStatus: params.HandleStatus,
|
||||
HandleResult: params.HandleResult,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
func ApplicationGroupResponse(c *gin.Context) {
|
||||
log.Info("", "", "api GroupApplicationResponse init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsGroupApplicationResponse{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newGroupApplicationResponse(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.OwnerID = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api GroupApplicationResponse is server, [data: %s]", pbData.String())
|
||||
reply, err := client.GroupApplicationResponse(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api GroupApplicationResponse call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api GroupApplicationResponse call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
})
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsJoinGroup struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
Message string `json:"message"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func JoinGroup(c *gin.Context) {
|
||||
log.Info("", "", "api join group init....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsJoinGroup{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.JoinGroupReq{
|
||||
GroupID: params.GroupID,
|
||||
Message: params.Message,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api join group is server,params=%s", req.String())
|
||||
RpcResp, err := client.JoinGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call join group rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call join group rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsQuitGroup struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func QuitGroup(c *gin.Context) {
|
||||
log.Info("", "", "api quit group init ....")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsQuitGroup{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.QuitGroupReq{
|
||||
GroupID: params.GroupID,
|
||||
OperationID: params.OperationID,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api quit group is server,params=%s", req.String())
|
||||
RpcResp, err := client.QuitGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call quit group rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call quit group rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
log.InfoByArgs("api quit group success return,get args=%s,return args=%s", req.String(), RpcResp.String())
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsSetGroupInfo struct {
|
||||
GroupID string `json:"groupId" binding:"required"`
|
||||
GroupName string `json:"groupName"`
|
||||
Notification string `json:"notification"`
|
||||
Introduction string `json:"introduction"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
func SetGroupInfo(c *gin.Context) {
|
||||
log.Info("", "", "api set group info init...")
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := pb.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsSetGroupInfo{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pb.SetGroupInfoReq{
|
||||
GroupID: params.GroupID,
|
||||
GroupName: params.GroupName,
|
||||
Notification: params.Notification,
|
||||
Introduction: params.Introduction,
|
||||
FaceUrl: params.FaceUrl,
|
||||
Token: c.Request.Header.Get("token"),
|
||||
OperationID: params.OperationID,
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "api set group info is server,params=%s", req.String())
|
||||
RpcResp, err := client.SetGroupInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "call set group info rpc server failed,err=%s", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.InfoByArgs("call set group info rpc server success,args=%s", RpcResp.String())
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg})
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paramsTransferGroupOwner struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
UID string `json:"uid" binding:"required"`
|
||||
}
|
||||
|
||||
func newTransferGroupOwnerReq(params *paramsTransferGroupOwner) *group.TransferGroupOwnerReq {
|
||||
pbData := group.TransferGroupOwnerReq{
|
||||
OperationID: params.OperationID,
|
||||
GroupID: params.GroupID,
|
||||
NewOwner: params.UID,
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
|
||||
func TransferGroupOwner(c *gin.Context) {
|
||||
log.Info("", "", "api TransferGroupOwner init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
client := group.NewGroupClient(etcdConn)
|
||||
//defer etcdConn.Close()
|
||||
|
||||
params := paramsTransferGroupOwner{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := newTransferGroupOwnerReq(¶ms)
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if claims, err := token_verify.ParseToken(token); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
} else {
|
||||
pbData.OldOwner = claims.UID
|
||||
}
|
||||
|
||||
log.Info("", "", "api TransferGroupOwner is server, [data: %s]", pbData.String())
|
||||
reply, err := client.TransferGroupOwner(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.Error("", "", "api TransferGroupOwner call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api TransferGroupOwner call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
})
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc add blacklist is server,args=%s", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
isMagagerFlag := 0
|
||||
tokenUid := claims.UID
|
||||
|
||||
if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) {
|
||||
isMagagerFlag = 1
|
||||
}
|
||||
|
||||
if isMagagerFlag == 0 {
|
||||
err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
err = im_mysql_model.InsertInToUserBlackList(req.OwnerUid, req.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/internal/push/content_struct"
|
||||
"Open_IM/internal/push/logic"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbChat "Open_IM/pkg/proto/chat"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc add friend is server,userid=%s", req.Uid)
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
//Cannot add non-existent users
|
||||
if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil {
|
||||
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend")
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//Establish a latest relationship in the friend request table
|
||||
err = im_mysql_model.ReplaceIntoFriendReq(claims.UID, req.Uid, constant.ApplicationFriendFlag, req.ReqMessage)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,create friend request record failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrAddFriend.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc add friend is success return,uid=%s", req.Uid)
|
||||
//Push message when add friend successfully
|
||||
senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID)
|
||||
receiverInfo, errReceive := im_mysql_model.FindUserByUID(req.Uid)
|
||||
if errSend == nil && errReceive == nil {
|
||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||
SendID: senderInfo.UID,
|
||||
RecvID: receiverInfo.UID,
|
||||
Content: content_struct.NewContentStructString(0, "", senderInfo.Name+" asked to add you as a friend"),
|
||||
SendTime: utils.GetCurrentTimestampBySecond(),
|
||||
MsgFrom: constant.SysMsgType,
|
||||
ContentType: constant.AddFriendTip,
|
||||
SessionType: constant.SingleChatType,
|
||||
OperationID: req.OperationID,
|
||||
})
|
||||
}
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "ImportFriend come here,args=%s", req.String())
|
||||
var resp pbFriend.ImportFriendResp
|
||||
var c pbFriend.CommonResp
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "parse token failed", err.Error())
|
||||
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||
c.ErrorMsg = constant.ErrParseToken.ErrMsg
|
||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||
}
|
||||
|
||||
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||
log.NewError(req.OperationID, "not manager uid", claims.UID)
|
||||
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||
c.ErrorMsg = "not authorized"
|
||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||
}
|
||||
if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil {
|
||||
log.NewError(req.OperationID, "this user not exists,cant not add friend", req.OwnerUid)
|
||||
c.ErrorCode = constant.ErrAddFriend.ErrCode
|
||||
c.ErrorMsg = "this user not exists,cant not add friend"
|
||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil
|
||||
}
|
||||
for _, v := range req.UidList {
|
||||
if _, fErr := im_mysql_model.FindUserByUID(v); fErr != nil {
|
||||
c.ErrorMsg = "some uid establish failed"
|
||||
c.ErrorCode = 408
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
} else {
|
||||
if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil {
|
||||
//Establish two single friendship
|
||||
err1 := im_mysql_model.InsertToFriend(req.OwnerUid, v, 1)
|
||||
if err1 != nil {
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
log.NewError(req.OperationID, "err1,create friendship failed", req.OwnerUid, v, err1.Error())
|
||||
}
|
||||
err2 := im_mysql_model.InsertToFriend(v, req.OwnerUid, 1)
|
||||
if err2 != nil {
|
||||
log.NewError(req.OperationID, "err2,create friendship failed", v, req.OwnerUid, err2.Error())
|
||||
}
|
||||
if err1 == nil && err2 == nil {
|
||||
var name, faceUrl string
|
||||
n := content_struct.NotificationContent{IsDisplay: 1, DefaultTips: constant.FriendAcceptTip}
|
||||
r, err := im_mysql_model.FindUserByUID(v)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "get info failed", err.Error(), v)
|
||||
}
|
||||
if r != nil {
|
||||
name, faceUrl = r.Name, r.Icon
|
||||
}
|
||||
|
||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||
SendID: v,
|
||||
RecvID: req.OwnerUid,
|
||||
SenderFaceURL: faceUrl,
|
||||
SenderNickName: name,
|
||||
Content: n.ContentToString(),
|
||||
SendTime: utils.GetCurrentTimestampByNano(),
|
||||
MsgFrom: constant.UserMsgType, //Notification message identification
|
||||
ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
|
||||
SessionType: constant.SingleChatType,
|
||||
OperationID: req.OperationID,
|
||||
})
|
||||
} else {
|
||||
c.ErrorMsg = "some uid establish failed"
|
||||
c.ErrorCode = 408
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resp.CommonResp = &c
|
||||
log.NewDebug(req.OperationID, "rpc come end", resp.CommonResp.ErrorCode, resp.CommonResp.ErrorMsg, resp.FailedUidList)
|
||||
return &resp, nil
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/internal/push/content_struct"
|
||||
"Open_IM/internal/push/logic"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbChat "Open_IM/pkg/proto/chat"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc add friend response is server,args=%s", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
//Check there application before agreeing or refuse to a friend's application
|
||||
if _, err = im_mysql_model.FindFriendApplyFromFriendReqByUid(req.Uid, claims.UID); err != nil {
|
||||
log.Error(req.Token, req.OperationID, "No such application record")
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrAgreeToAddFriend.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
//Change friend request status flag
|
||||
err = im_mysql_model.UpdateFriendRelationshipToFriendReq(req.Uid, claims.UID, req.Flag)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,update friend request table failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc add friend response success return,userid=%s,flag=%d", req.Uid, req.Flag)
|
||||
//Change the status of the friend request form
|
||||
if req.Flag == constant.FriendFlag {
|
||||
//Establish friendship after find friend relationship not exists
|
||||
_, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid)
|
||||
//fixme If there is an error, it means that there is no friend record or database err, if no friend record should be inserted,Continue down execution
|
||||
if err != nil {
|
||||
log.Error("", req.OperationID, err.Error())
|
||||
}
|
||||
//Establish two single friendship
|
||||
err = im_mysql_model.InsertToFriend(claims.UID, req.Uid, req.Flag)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
|
||||
}
|
||||
err = im_mysql_model.InsertToFriend(req.Uid, claims.UID, req.Flag)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
|
||||
}
|
||||
//Push message when establish friends successfully
|
||||
//senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID)
|
||||
//if errSend == nil {
|
||||
// logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||
// SendID: claims.UID,
|
||||
// RecvID: req.Uid,
|
||||
// Content: content_struct.NewContentStructString(1, "", senderInfo.Name+" agreed to add you as a friend."),
|
||||
// SendTime: utils.GetCurrentTimestampBySecond(),
|
||||
// MsgFrom: constant.UserMsgType, //Notification message identification
|
||||
// ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
|
||||
// SessionType: constant.SingleChatType,
|
||||
// OperationID: req.OperationID,
|
||||
// })
|
||||
//}
|
||||
}
|
||||
if req.Flag == constant.RefuseFriendFlag {
|
||||
senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID)
|
||||
if errSend == nil {
|
||||
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
|
||||
SendID: claims.UID,
|
||||
RecvID: req.Uid,
|
||||
Content: content_struct.NewContentStructString(0, "", senderInfo.Name+" refuse to add you as a friend."),
|
||||
SendTime: utils.GetCurrentTimestampBySecond(),
|
||||
MsgFrom: constant.UserMsgType, //Notification message identification
|
||||
ContentType: constant.RefuseFriendApplicationTip, //Add friend flag
|
||||
SessionType: constant.SingleChatType,
|
||||
OperationID: req.OperationID,
|
||||
})
|
||||
}
|
||||
}
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc delete friend is server,args=%s", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
err = im_mysql_model.DeleteSingleFriendInfo(claims.UID, req.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,delete friend failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc delete friend success return")
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
487
internal/rpc/friend/firend.go
Normal file
487
internal/rpc/friend/firend.go
Normal file
@ -0,0 +1,487 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/chat"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
sdk_ws "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
"google.golang.org/grpc"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type friendServer struct {
|
||||
rpcPort int
|
||||
rpcRegisterName string
|
||||
etcdSchema string
|
||||
etcdAddr []string
|
||||
}
|
||||
|
||||
func NewFriendServer(port int) *friendServer {
|
||||
log.NewPrivateLog("friend")
|
||||
return &friendServer{
|
||||
rpcPort: port,
|
||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||
etcdAddr: config.Config.Etcd.EtcdAddr,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *friendServer) Run() {
|
||||
log.Info("", "", fmt.Sprintf("rpc friend init...."))
|
||||
|
||||
ip := utils.ServerIP
|
||||
registerAddress := ip + ":" + strconv.Itoa(s.rpcPort)
|
||||
//listener network
|
||||
listener, err := net.Listen("tcp", registerAddress)
|
||||
if err != nil {
|
||||
log.InfoByArgs(fmt.Sprintf("Failed to listen rpc friend network,err=%s", err.Error()))
|
||||
return
|
||||
}
|
||||
log.Info("", "", "listen network success, address = %s", registerAddress)
|
||||
defer listener.Close()
|
||||
//grpc server
|
||||
srv := grpc.NewServer()
|
||||
defer srv.GracefulStop()
|
||||
//User friend related services register to etcd
|
||||
pbFriend.RegisterFriendServer(srv, s)
|
||||
err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10)
|
||||
if err != nil {
|
||||
log.ErrorByArgs("register rpc fiend service to etcd failed,err=%s", err.Error())
|
||||
return
|
||||
}
|
||||
err = srv.Serve(listener)
|
||||
if err != nil {
|
||||
log.ErrorByArgs("listen rpc friend error,err=%s", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendInfoResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendsInfo args ", req.String())
|
||||
var (
|
||||
isInBlackList int32
|
||||
// isFriend int32
|
||||
comment string
|
||||
)
|
||||
|
||||
friendShip, err := imdb.FindFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindFriendRelationshipFromFriend failed ", err.Error())
|
||||
return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
// isFriend = constant.FriendFlag
|
||||
}
|
||||
comment = friendShip.Remark
|
||||
|
||||
friendUserInfo, err := imdb.FindUserByUID(req.CommID.ToUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error())
|
||||
return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
|
||||
err = imdb.FindRelationshipFromBlackList(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err == nil {
|
||||
isInBlackList = constant.BlackListFlag
|
||||
}
|
||||
|
||||
resp := pbFriend.GetFriendInfoResp{
|
||||
ErrCode: 0,
|
||||
ErrMsg: "",
|
||||
Data: &pbFriend.FriendInfo{
|
||||
IsBlack: isInBlackList,
|
||||
},
|
||||
}
|
||||
utils.CopyStructFields(resp.Data.FriendUser, friendUserInfo)
|
||||
resp.Data.IsBlack = isInBlackList
|
||||
resp.Data.OwnerUserID = req.CommID.FromUserID
|
||||
resp.Data.Remark = comment
|
||||
resp.Data.CreateTime = friendUserInfo.CreateTime
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendsInfo ok ", resp)
|
||||
return &resp, nil
|
||||
|
||||
}
|
||||
|
||||
func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "AddBlacklist args ", req.String())
|
||||
ok := token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess failed ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
}
|
||||
|
||||
err := imdb.InsertInToUserBlackList(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "InsertInToUserBlackList failed ", err.Error())
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "InsertInToUserBlackList ok ", req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
chat.BlackAddedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
|
||||
}
|
||||
|
||||
func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
|
||||
ok := token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess failed ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
}
|
||||
//Cannot add non-existent users
|
||||
if _, err := imdb.FindUserByUID(req.CommID.ToUserID); err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error(), req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAddFriend.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//Establish a latest relationship in the friend request table
|
||||
err := imdb.ReplaceIntoFriendReq(req.CommID.FromUserID, req.CommID.ToUserID, constant.ApplicationFriendFlag, req.ReqMessage)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "ReplaceIntoFriendReq failed ", err.Error())
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAddFriend.ErrCode, ErrMsg: constant.ErrAddFriend.ErrMsg}, nil
|
||||
}
|
||||
|
||||
chat.FriendApplicationAddedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID, req.ReqMessage)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) {
|
||||
log.NewInfo(req.OperationID, "ImportFriend failed ", req.String())
|
||||
var resp pbFriend.ImportFriendResp
|
||||
var c pbFriend.CommonResp
|
||||
|
||||
if !utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
log.NewError(req.OperationID, "not authorized", req.OpUserID)
|
||||
c.ErrCode = constant.ErrAddFriend.ErrCode
|
||||
c.ErrMsg = "not authorized"
|
||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.FriendUserIDList}, nil
|
||||
}
|
||||
|
||||
if _, err := imdb.FindUserByUID(req.FromUserID); err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), req.FromUserID)
|
||||
c.ErrCode = constant.ErrAddFriend.ErrCode
|
||||
c.ErrMsg = "this user not exists,cant not add friend"
|
||||
return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.FriendUserIDList}, nil
|
||||
}
|
||||
|
||||
for _, v := range req.FriendUserIDList {
|
||||
if _, fErr := imdb.FindUserByUID(v); fErr != nil {
|
||||
c.ErrMsg = "some uid establish failed"
|
||||
c.ErrCode = 408
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
} else {
|
||||
if _, err := imdb.FindFriendRelationshipFromFriend(req.FromUserID, v); err != nil {
|
||||
//Establish two single friendship
|
||||
err1 := imdb.InsertToFriend(req.FromUserID, v, 1)
|
||||
if err1 != nil {
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
log.NewError(req.OperationID, "InsertToFriend failed", req.FromUserID, v, err1.Error())
|
||||
c.ErrMsg = "some uid establish failed"
|
||||
c.ErrCode = 408
|
||||
continue
|
||||
}
|
||||
err2 := imdb.InsertToFriend(v, req.FromUserID, 1)
|
||||
if err2 != nil {
|
||||
resp.FailedUidList = append(resp.FailedUidList, v)
|
||||
log.NewError(req.OperationID, "InsertToFriend failed", v, req.FromUserID, err2.Error())
|
||||
c.ErrMsg = "some uid establish failed"
|
||||
c.ErrCode = 408
|
||||
continue
|
||||
}
|
||||
chat.FriendAddedNotification(req.OperationID, req.OpUserID, req.FromUserID, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
resp.CommonResp = &c
|
||||
log.NewInfo(req.OperationID, "ImportFriend rpc ok ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
|
||||
|
||||
if !token_verify.CheckAccess(rreq.CommID.FromUserID, req.CommID.ToUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess failed ", req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAgreeToAddFriend.ErrCode, ErrMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//Check there application before agreeing or refuse to a friend's application
|
||||
//req.CommID.FromUserID process req.CommID.ToUserID
|
||||
if _, err := imdb.FindFriendApplyFromFriendReqByUid(req.CommID.ToUserID, req.CommID.FromUserID); err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindFriendApplyFromFriendReqByUid failed ", err.Error(), req.CommID.ToUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAgreeToAddFriend.ErrCode, ErrMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//Change friend request status flag
|
||||
err := imdb.UpdateFriendRelationshipToFriendReq(req.CommID.ToUserID, req.CommID.FromUserID, req.Flag)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "UpdateFriendRelationshipToFriendReq failed ", err.Error(), req.CommID.ToUserID, req.CommID.FromUserID, req.Flag)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc AddFriendResponse ok")
|
||||
//Change the status of the friend request form
|
||||
if req.Flag == constant.FriendFlag {
|
||||
//Establish friendship after find friend relationship not exists
|
||||
_, err := imdb.FindFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err == nil {
|
||||
log.NewWarn(req.CommID.OperationID, "FindFriendRelationshipFromFriend exist", req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
} else {
|
||||
//Establish two single friendship
|
||||
err = imdb.InsertToFriend(req.CommID.FromUserID, req.CommID.ToUserID, req.Flag)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID, req.Flag)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAgreeToAddFriend.ErrCode, ErrMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
}
|
||||
|
||||
_, err = imdb.FindFriendRelationshipFromFriend(req.CommID.ToUserID, req.CommID.FromUserID)
|
||||
if err == nil {
|
||||
log.NewWarn(req.CommID.OperationID, "FindFriendRelationshipFromFriend exist", req.CommID.ToUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
err = imdb.InsertToFriend(req.CommID.ToUserID, req.CommID.FromUserID, req.Flag)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID, req.Flag)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrAgreeToAddFriend.ErrCode, ErrMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil
|
||||
}
|
||||
}
|
||||
|
||||
chat.FriendApplicationProcessedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID, req.Flag)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String())
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
err := imdb.DeleteSingleFriendInfo(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "DeleteSingleFriendInfo failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok")
|
||||
chat.FriendDeletedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String())
|
||||
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess failed", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.GetBlacklistResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
blackListInfo, err := imdb.GetBlackListByUID(req.CommID.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "GetBlackListByUID failed ", err.Error(), req.CommID.FromUserID)
|
||||
return &pbFriend.GetBlacklistResp{ErrCode: constant.ErrGetBlackList.ErrCode, ErrMsg: constant.ErrGetBlackList.ErrMsg}, nil
|
||||
}
|
||||
|
||||
var (
|
||||
userInfoList []*sdk_ws.PublicUserInfo
|
||||
)
|
||||
for _, blackUser := range blackListInfo {
|
||||
var blackUserInfo sdk_ws.PublicUserInfo
|
||||
//Find black user information
|
||||
us, err := imdb.FindUserByUID(blackUser.BlockUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error(), blackUser.BlockUserID)
|
||||
continue
|
||||
}
|
||||
utils.CopyStructFields(&blackUserInfo, us)
|
||||
userInfoList = append(userInfoList, &blackUserInfo)
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc GetBlacklist ok")
|
||||
return &pbFriend.GetBlacklistResp{Data: userInfoList}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) SetFriendComment(ctx context.Context, req *pbFriend.SetFriendCommentReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String())
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
err := imdb.UpdateFriendComment(req.CommID.FromUserID, req.CommID.OpUserID, req.Remark)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "UpdateFriendComment failed ", err.Error(), req.CommID.FromUserID, req.CommID.OpUserID, req.Remark)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrSetFriendComment.ErrCode, ErrMsg: constant.ErrSetFriendComment.ErrMsg}, nil
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc SetFriendComment ok")
|
||||
chat.FriendInfoChangedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String())
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
err := imdb.RemoveBlackList(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "RemoveBlackList failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok")
|
||||
chat.BlackDeletedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) {
|
||||
log.NewInfo("IsInBlackList args ", req.String())
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.IsInBlackListResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
var isInBlacklist = false
|
||||
err := imdb.FindRelationshipFromBlackList(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err == nil {
|
||||
isInBlacklist = true
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "IsInBlackList rpc ok")
|
||||
return &pbFriend.IsInBlackListResp{Response: isInBlacklist}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) {
|
||||
log.NewInfo("IsFriend args ", req.String())
|
||||
var isFriend int32
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.IsFriendResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
_, err := imdb.FindFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID)
|
||||
if err == nil {
|
||||
isFriend = constant.FriendFlag
|
||||
} else {
|
||||
isFriend = constant.ApplicationFriendFlag
|
||||
}
|
||||
log.NewInfo("IsFriend rpc ok")
|
||||
return &pbFriend.IsFriendResp{ShipType: isFriend}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) {
|
||||
log.NewInfo("GetFriendList args ", req.String())
|
||||
var userInfoList []*pbFriend.FriendInfo
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendListResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
friends, err := imdb.FindUserInfoFromFriend(req.CommID.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserInfoFromFriend failed", err.Error(), req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendListResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
for _, friendUser := range friends {
|
||||
var friendUserInfo pbFriend.FriendInfo
|
||||
//find user is in blackList
|
||||
err = imdb.FindRelationshipFromBlackList(req.CommID.FromUserID, friendUser.FriendUserID)
|
||||
if err == nil {
|
||||
friendUserInfo.IsBlack = constant.BlackListFlag
|
||||
} else {
|
||||
friendUserInfo.IsBlack = 0
|
||||
}
|
||||
//Find user information
|
||||
us, err := imdb.FindUserByUID(friendUser.FriendUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed", err.Error(), friendUser.FriendUserID)
|
||||
continue
|
||||
}
|
||||
utils.CopyStructFields(friendUserInfo.FriendUser, us)
|
||||
friendUserInfo.Remark = friendUser.Remark
|
||||
friendUserInfo.OwnerUserID = req.CommID.FromUserID
|
||||
friendUserInfo.CreateTime = friendUser.CreateTime
|
||||
userInfoList = append(userInfoList, &friendUserInfo)
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc GetFriendList ok", pbFriend.GetFriendListResp{Data: userInfoList})
|
||||
return &pbFriend.GetFriendListResp{Data: userInfoList}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String())
|
||||
var appleUserList []*pbFriend.ApplyUserInfo
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendApplyResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
// Find the current user friend applications received
|
||||
ApplyUsersInfo, err := imdb.FindFriendsApplyFromFriendReq(req.CommID.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindFriendsApplyFromFriendReq ", err.Error(), req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendApplyResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
|
||||
for _, applyUserInfo := range ApplyUsersInfo {
|
||||
var userInfo pbFriend.ApplyUserInfo
|
||||
//Find friend application status
|
||||
userInfo.Flag = applyUserInfo.Flag
|
||||
userInfo.ReqMessage = applyUserInfo.ReqMessage
|
||||
userInfo.ApplyTime = applyUserInfo.CreateTime
|
||||
|
||||
//Find user information
|
||||
us, err := imdb.FindUserByUID(applyUserInfo.ReqID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error(), applyUserInfo.ReqID)
|
||||
continue
|
||||
}
|
||||
utils.CopyStructFields(userInfo.UserInfo, us)
|
||||
appleUserList = append(appleUserList, &userInfo)
|
||||
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc GetFriendApplyList ok", pbFriend.GetFriendApplyResp{Data: appleUserList})
|
||||
return &pbFriend.GetFriendApplyResp{Data: appleUserList}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) {
|
||||
log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String())
|
||||
var selfApplyOtherUserList []*pbFriend.ApplyUserInfo
|
||||
//Parse token, to find current user information
|
||||
if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) {
|
||||
log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendApplyResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
|
||||
// Find the self add other userinfo
|
||||
usersInfo, err := imdb.FindSelfApplyFromFriendReq(req.CommID.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindSelfApplyFromFriendReq failed ", err.Error(), req.CommID.FromUserID)
|
||||
return &pbFriend.GetFriendApplyResp{ErrCode: constant.ErrMysql.ErrCode, ErrMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
for _, selfApplyOtherUserInfo := range usersInfo {
|
||||
var userInfo pbFriend.ApplyUserInfo
|
||||
//Find friend application status
|
||||
userInfo.Flag = selfApplyOtherUserInfo.Flag
|
||||
userInfo.ReqMessage = selfApplyOtherUserInfo.ReqMessage
|
||||
userInfo.ApplyTime = selfApplyOtherUserInfo.CreateTime
|
||||
//Find user information
|
||||
us, err := imdb.FindUserByUID(selfApplyOtherUserInfo.UserID)
|
||||
if err != nil {
|
||||
log.NewError(req.CommID.OperationID, "FindUserByUID failed", err.Error(), selfApplyOtherUserInfo.UserID)
|
||||
continue
|
||||
}
|
||||
utils.CopyStructFields(userInfo.UserInfo, us)
|
||||
selfApplyOtherUserList = append(selfApplyOtherUserList, &userInfo)
|
||||
}
|
||||
log.NewInfo(req.CommID.OperationID, "rpc GetSelfApplyList ok", pbFriend.GetFriendApplyResp{Data: selfApplyOtherUserList})
|
||||
return &pbFriend.GetFriendApplyResp{Data: selfApplyOtherUserList}, nil
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc get blacklist is server,args=%s", req.String())
|
||||
var (
|
||||
userInfoList []*pbFriend.UserInfo
|
||||
comment string
|
||||
)
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
blackListInfo, err := im_mysql_model.GetBlackListByUID(claims.UID)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s get blacklist failed", err.Error())
|
||||
return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrGetBlackList.ErrCode, ErrorMsg: constant.ErrGetBlackList.ErrMsg}, nil
|
||||
}
|
||||
for _, blackUser := range blackListInfo {
|
||||
var blackUserInfo pbFriend.UserInfo
|
||||
//Find black user information
|
||||
us, err := im_mysql_model.FindUserByUID(blackUser.BlockId)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s search black list userInfo failed", err.Error())
|
||||
continue
|
||||
}
|
||||
friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, blackUser.BlockId)
|
||||
if err == nil {
|
||||
comment = friendShip.Comment
|
||||
}
|
||||
blackUserInfo.Uid = us.UID
|
||||
blackUserInfo.Icon = us.Icon
|
||||
blackUserInfo.Name = us.Name
|
||||
blackUserInfo.Gender = us.Gender
|
||||
blackUserInfo.Mobile = us.Mobile
|
||||
blackUserInfo.Birth = us.Birth
|
||||
blackUserInfo.Email = us.Email
|
||||
blackUserInfo.Ex = us.Ex
|
||||
blackUserInfo.Comment = comment
|
||||
|
||||
userInfoList = append(userInfoList, &blackUserInfo)
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc get blacklist success return")
|
||||
return &pbFriend.GetBlacklistResp{Data: userInfoList}, nil
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
"google.golang.org/grpc"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type friendServer struct {
|
||||
rpcPort int
|
||||
rpcRegisterName string
|
||||
etcdSchema string
|
||||
etcdAddr []string
|
||||
}
|
||||
|
||||
func NewFriendServer(port int) *friendServer {
|
||||
log.NewPrivateLog("friend")
|
||||
return &friendServer{
|
||||
rpcPort: port,
|
||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,
|
||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||
etcdAddr: config.Config.Etcd.EtcdAddr,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *friendServer) Run() {
|
||||
log.Info("", "", fmt.Sprintf("rpc friend init...."))
|
||||
|
||||
ip := utils.ServerIP
|
||||
registerAddress := ip + ":" + strconv.Itoa(s.rpcPort)
|
||||
//listener network
|
||||
listener, err := net.Listen("tcp", registerAddress)
|
||||
if err != nil {
|
||||
log.InfoByArgs(fmt.Sprintf("Failed to listen rpc friend network,err=%s", err.Error()))
|
||||
return
|
||||
}
|
||||
log.Info("", "", "listen network success, address = %s", registerAddress)
|
||||
defer listener.Close()
|
||||
//grpc server
|
||||
srv := grpc.NewServer()
|
||||
defer srv.GracefulStop()
|
||||
//User friend related services register to etcd
|
||||
pbFriend.RegisterFriendServer(srv, s)
|
||||
err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10)
|
||||
if err != nil {
|
||||
log.ErrorByArgs("register rpc fiend service to etcd failed,err=%s", err.Error())
|
||||
return
|
||||
}
|
||||
err = srv.Serve(listener)
|
||||
if err != nil {
|
||||
log.ErrorByArgs("listen rpc friend error,err=%s", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendInfoResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc search user is server,args=%s", req.String())
|
||||
var (
|
||||
isInBlackList int32
|
||||
isFriend int32
|
||||
comment string
|
||||
)
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid)
|
||||
if err == nil {
|
||||
isFriend = constant.FriendFlag
|
||||
comment = friendShip.Comment
|
||||
}
|
||||
friendUserInfo, err := im_mysql_model.FindUserByUID(req.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,no this user", err.Error())
|
||||
return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, req.Uid)
|
||||
if err == nil {
|
||||
isInBlackList = constant.BlackListFlag
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc search friend success return")
|
||||
return &pbFriend.GetFriendInfoResp{
|
||||
ErrorCode: 0,
|
||||
ErrorMsg: "",
|
||||
Data: &pbFriend.GetFriendData{
|
||||
Uid: friendUserInfo.UID,
|
||||
Icon: friendUserInfo.Icon,
|
||||
Name: friendUserInfo.Name,
|
||||
Gender: friendUserInfo.Gender,
|
||||
Mobile: friendUserInfo.Mobile,
|
||||
Birth: friendUserInfo.Birth,
|
||||
Email: friendUserInfo.Email,
|
||||
Ex: friendUserInfo.Ex,
|
||||
Comment: comment,
|
||||
IsFriend: isFriend,
|
||||
IsInBlackList: isInBlackList,
|
||||
},
|
||||
}, nil
|
||||
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc get friend apply list is server,args=%s", req.String())
|
||||
var appleUserList []*pbFriend.ApplyUserInfo
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
// Find the current user friend applications received
|
||||
ApplyUsersInfo, err := im_mysql_model.FindFriendsApplyFromFriendReq(claims.UID)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,search applyInfo failed", err.Error())
|
||||
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
for _, applyUserInfo := range ApplyUsersInfo {
|
||||
var userInfo pbFriend.ApplyUserInfo
|
||||
//Find friend application status
|
||||
userInfo.Flag = applyUserInfo.Flag
|
||||
userInfo.ReqMessage = applyUserInfo.ReqMessage
|
||||
userInfo.ApplyTime = strconv.FormatInt(applyUserInfo.CreateTime.Unix(), 10)
|
||||
//Find user information
|
||||
us, err := im_mysql_model.FindUserByUID(applyUserInfo.ReqId)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,search userInfo failed", err.Error())
|
||||
continue
|
||||
}
|
||||
userInfo.Uid = us.UID
|
||||
userInfo.Icon = us.Icon
|
||||
userInfo.Name = us.Name
|
||||
userInfo.Gender = us.Gender
|
||||
userInfo.Mobile = us.Mobile
|
||||
userInfo.Birth = us.Birth
|
||||
userInfo.Email = us.Email
|
||||
userInfo.Ex = us.Ex
|
||||
appleUserList = append(appleUserList, &userInfo)
|
||||
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, fmt.Sprintf("rpc get friendapplylist success return"))
|
||||
return &pbFriend.GetFriendApplyResp{Data: appleUserList}, nil
|
||||
}
|
||||
|
||||
func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc get self apply list is server,args=%s", req.String())
|
||||
var selfApplyOtherUserList []*pbFriend.ApplyUserInfo
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
// Find the self add other userinfo
|
||||
usersInfo, err := im_mysql_model.FindSelfApplyFromFriendReq(claims.UID)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,search self to other user Info failed", err.Error())
|
||||
return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
for _, selfApplyOtherUserInfo := range usersInfo {
|
||||
var userInfo pbFriend.ApplyUserInfo
|
||||
//Find friend application status
|
||||
userInfo.Flag = selfApplyOtherUserInfo.Flag
|
||||
userInfo.ReqMessage = selfApplyOtherUserInfo.ReqMessage
|
||||
userInfo.ApplyTime = strconv.FormatInt(selfApplyOtherUserInfo.CreateTime.Unix(), 10)
|
||||
//Find user information
|
||||
us, err := im_mysql_model.FindUserByUID(selfApplyOtherUserInfo.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,search userInfo failed", err.Error())
|
||||
continue
|
||||
}
|
||||
userInfo.Uid = us.UID
|
||||
userInfo.Icon = us.Icon
|
||||
userInfo.Name = us.Name
|
||||
userInfo.Gender = us.Gender
|
||||
userInfo.Mobile = us.Mobile
|
||||
userInfo.Birth = us.Birth
|
||||
userInfo.Email = us.Email
|
||||
userInfo.Ex = us.Ex
|
||||
selfApplyOtherUserList = append(selfApplyOtherUserList, &userInfo)
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, fmt.Sprintf("rpc get self apply list success return"))
|
||||
return &pbFriend.GetFriendApplyResp{Data: selfApplyOtherUserList}, nil
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc get friend list is server,args=%s", req.String())
|
||||
var userInfoList []*pbFriend.UserInfo
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
friends, err := im_mysql_model.FindUserInfoFromFriend(claims.UID)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s search friendInfo failed", err.Error())
|
||||
return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
for _, friendUser := range friends {
|
||||
var friendUserInfo pbFriend.UserInfo
|
||||
|
||||
//find user is in blackList
|
||||
err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, friendUser.FriendId)
|
||||
if err == nil {
|
||||
friendUserInfo.IsInBlackList = constant.BlackListFlag
|
||||
} else {
|
||||
friendUserInfo.IsInBlackList = 0
|
||||
}
|
||||
//Find user information
|
||||
us, err := im_mysql_model.FindUserByUID(friendUser.FriendId)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s search userInfo failed", err.Error())
|
||||
continue
|
||||
}
|
||||
friendUserInfo.Uid = friendUser.FriendId
|
||||
friendUserInfo.Comment = friendUser.Comment
|
||||
friendUserInfo.Icon = us.Icon
|
||||
friendUserInfo.Name = us.Name
|
||||
friendUserInfo.Gender = us.Gender
|
||||
friendUserInfo.Mobile = us.Mobile
|
||||
friendUserInfo.Birth = us.Birth
|
||||
friendUserInfo.Email = us.Email
|
||||
friendUserInfo.Ex = us.Ex
|
||||
|
||||
userInfoList = append(userInfoList, &friendUserInfo)
|
||||
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc get friend list success return")
|
||||
return &pbFriend.GetFriendListResp{Data: userInfoList}, nil
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) {
|
||||
log.InfoByArgs("rpc is friend is server,args=%s", req.String())
|
||||
var isFriend int32
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.IsFriendResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
_, err = im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.ReceiveUid)
|
||||
if err == nil {
|
||||
isFriend = constant.FriendFlag
|
||||
} else {
|
||||
isFriend = constant.ApplicationFriendFlag
|
||||
}
|
||||
log.InfoByArgs(fmt.Sprintf("rpc is friend success return"))
|
||||
return &pbFriend.IsFriendResp{ShipType: isFriend}, nil
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) {
|
||||
log.InfoByArgs("rpc is in blacklist is server,args=%s", req.String())
|
||||
var isInBlacklist = false
|
||||
err := im_mysql_model.FindRelationshipFromBlackList(req.ReceiveUid, req.SendUid)
|
||||
if err == nil {
|
||||
isInBlacklist = true
|
||||
}
|
||||
log.InfoByArgs(fmt.Sprintf("rpc is in blackList success return"))
|
||||
return &pbFriend.IsInBlackListResp{Response: isInBlacklist}, nil
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc remove blacklist is server,userid=%s", req.Uid)
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
err = im_mysql_model.RemoveBlackList(claims.UID, req.Uid)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,remove blacklist failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc remove blacklist success return,userid=%s", req.Uid)
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
pbFriend "Open_IM/pkg/proto/friend"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *friendServer) SetFriendComment(ctx context.Context, req *pbFriend.SetFriendCommentReq) (*pbFriend.CommonResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc set friend comment is server,params=%s", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
err = im_mysql_model.UpdateFriendComment(claims.UID, req.Uid, req.Comment)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "set friend comment failed,err=%s", err.Error())
|
||||
return &pbFriend.CommonResp{ErrorCode: constant.ErrSetFriendComment.ErrCode, ErrorMsg: constant.ErrSetFriendComment.ErrMsg}, nil
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc set friend comment is success return")
|
||||
return &pbFriend.CommonResp{}, nil
|
||||
}
|
@ -11,6 +11,7 @@ import (
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbGroup "Open_IM/pkg/proto/group"
|
||||
"Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"encoding/json"
|
||||
@ -70,165 +71,142 @@ func (s *groupServer) Run() {
|
||||
}
|
||||
|
||||
func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) {
|
||||
log.NewInfo(req.OperationID, "CreateGroup, args=%s", req.String())
|
||||
var (
|
||||
groupId string
|
||||
)
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "ParseToken failed, ", err.Error(), req.String())
|
||||
log.NewInfo(req.OperationID, "CreateGroup, args ", req.String())
|
||||
if !token_verify.CheckAccess(req.OpUserID, req.FromUserID) {
|
||||
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.FromUserID)
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
//Time stamp + MD5 to generate group chat id
|
||||
groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
|
||||
err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ext)
|
||||
groupId := utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
|
||||
err := im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ext)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), req.String())
|
||||
log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ext)
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
|
||||
isManagerFlag := 0
|
||||
tokenUid := claims.UID
|
||||
|
||||
if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) {
|
||||
isManagerFlag = 1
|
||||
}
|
||||
|
||||
us, err := im_mysql_model.FindUserByUID(claims.UID)
|
||||
us, err := im_mysql_model.FindUserByUID(req.FromUserID)
|
||||
if err != nil {
|
||||
log.Error("", req.OperationID, "find userInfo failed", err.Error())
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), req.FromUserID)
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
|
||||
if isManagerFlag == 0 {
|
||||
//Add the group owner to the group first, otherwise the group creation will fail
|
||||
err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Nickname, us.FaceUrl, constant.GroupOwner)
|
||||
if err != nil {
|
||||
log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error())
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
//Add the group owner to the group first, otherwise the group creation will fail
|
||||
err = im_mysql_model.InsertIntoGroupMember(groupId, us.UserID, us.Nickname, us.FaceUrl, constant.GroupOwner)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error())
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
|
||||
err = db.DB.AddGroupMember(groupId, claims.UID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), groupId, claims.UID)
|
||||
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
err = db.DB.AddGroupMember(groupId, req.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), groupId, req.FromUserID)
|
||||
// return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//Binding group id and member id
|
||||
for _, user := range req.MemberList {
|
||||
us, err := im_mysql_model.FindUserByUID(user.Uid)
|
||||
for _, user := range req.InitMemberList {
|
||||
us, err := im_mysql_model.FindUserByUID(user.UserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.Uid)
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.UserID)
|
||||
continue
|
||||
}
|
||||
err = im_mysql_model.InsertIntoGroupMember(groupId, user.Uid, us.Nickname, us.FaceUrl, user.SetRole)
|
||||
if err != nil {
|
||||
log.ErrorByArgs("InsertIntoGroupMember failed", user.Uid, groupId, err.Error())
|
||||
if user.Role == 1 {
|
||||
log.NewError(req.OperationID, "only one owner, failed ", user)
|
||||
continue
|
||||
}
|
||||
err = db.DB.AddGroupMember(groupId, user.Uid)
|
||||
err = im_mysql_model.InsertIntoGroupMember(groupId, user.UserID, us.Nickname, us.FaceUrl, user.Role)
|
||||
if err != nil {
|
||||
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
||||
log.NewError(req.OperationID, "InsertIntoGroupMember failed ", groupId, user.UserID, us.Nickname, us.FaceUrl, user.Role)
|
||||
}
|
||||
err = db.DB.AddGroupMember(groupId, user.UserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "add mongo group member failed, db.DB.AddGroupMember failed ", err.Error())
|
||||
}
|
||||
}
|
||||
resp := &pbGroup.CreateGroupResp{}
|
||||
|
||||
if isManagerFlag == 1 {
|
||||
|
||||
}
|
||||
group, err := im_mysql_model.FindGroupInfoByGroupId(groupId)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), groupId)
|
||||
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
|
||||
resp.ErrCode = constant.ErrCreateGroup.ErrCode
|
||||
resp.ErrMsg = constant.ErrCreateGroup.ErrMsg
|
||||
return resp, nil
|
||||
}
|
||||
memberList, err := im_mysql_model.FindGroupMemberListByGroupId(groupId)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed ", err.Error(), groupId)
|
||||
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
|
||||
}
|
||||
chat.GroupCreatedNotification(req.OperationID, us, group, memberList)
|
||||
log.NewInfo(req.OperationID, "GroupCreatedNotification, rpc CreateGroup success return ", groupId)
|
||||
|
||||
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
|
||||
chat.GroupCreatedNotification(req)
|
||||
utils.CopyStructFields(resp.GroupInfo, group)
|
||||
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) {
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
log.NewInfo(req.OperationID, "GetJoinedGroupList, args ", req.String())
|
||||
if !token_verify.CheckAccess(req.OpUserID, req.FromUserID) {
|
||||
log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.FromUserID)
|
||||
return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||
|
||||
joinedGroupList, err := imdb.GetJoinedGroupIdListByMemberId(claims.UID)
|
||||
joinedGroupList, err := imdb.GetJoinedGroupIdListByMemberId(req.FromUserID)
|
||||
if err != nil {
|
||||
log.Error(claims.UID, req.OperationID, "GetJoinedGroupIdListByMemberId failed, err: ", err.Error())
|
||||
return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil
|
||||
log.NewError(req.OperationID, "GetJoinedGroupIdListByMemberId failed ", err.Error(), req.FromUserID)
|
||||
return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrParam.ErrCode, ErrMsg: constant.ErrParam.ErrMsg}, nil
|
||||
}
|
||||
|
||||
var resp pbGroup.GetJoinedGroupListResp
|
||||
|
||||
for _, v := range joinedGroupList {
|
||||
var groupNode pbGroup.GroupInfo
|
||||
var groupNode open_im_sdk.GroupInfo
|
||||
num := imdb.GetGroupMemberNumByGroupId(v.GroupID)
|
||||
owner := imdb.GetGroupOwnerByGroupId(v.GroupID)
|
||||
owner, err2 := imdb.GetGroupOwnerInfoByGroupId(v.GroupID)
|
||||
group, err := imdb.FindGroupInfoByGroupId(v.GroupID)
|
||||
if num > 0 && owner != "" && err == nil {
|
||||
groupNode.GroupId = v.GroupID
|
||||
groupNode.FaceUrl = group.FaceUrl
|
||||
groupNode.CreateTime = uint64(group.CreateTime.Unix())
|
||||
groupNode.GroupName = group.GroupName
|
||||
groupNode.Introduction = group.Introduction
|
||||
groupNode.Notification = group.Notification
|
||||
groupNode.OwnerId = owner
|
||||
groupNode.MemberCount = uint32(int32(num))
|
||||
if num > 0 && owner != nil && err2 == nil && group != nil && err == nil {
|
||||
utils.CopyStructFields(&groupNode, group)
|
||||
utils.CopyStructFields(groupNode.Owner, owner)
|
||||
groupNode.MemberCount = uint32(num)
|
||||
resp.GroupList = append(resp.GroupList, &groupNode)
|
||||
} else {
|
||||
log.NewError(req.OperationID, "check nil ", num, owner, err, group)
|
||||
continue
|
||||
}
|
||||
log.Info(claims.UID, req.OperationID, "member num: ", num, "owner: ", owner)
|
||||
log.NewDebug(req.OperationID, "joinedGroup ", groupNode)
|
||||
}
|
||||
resp.ErrCode = 0
|
||||
log.NewInfo(req.OperationID, "GetJoinedGroupList return ", resp.String())
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) {
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup args: ", req.String())
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
|
||||
|
||||
if !imdb.IsExistGroupMember(req.GroupID, req.OpUserID) && !utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
log.NewError(req.OperationID, "no permission InviteUserToGroup ", req.GroupID)
|
||||
log.NewError(req.OperationID, "no permission InviteUserToGroup ", req.GroupID, req.OpUserID)
|
||||
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
|
||||
groupInfoFromMysql, err := imdb.FindGroupInfoByGroupId(req.GroupID)
|
||||
if err != nil || groupInfoFromMysql == nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed", req.GroupID)
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", req.GroupID, err)
|
||||
return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
|
||||
//
|
||||
//from User: invite: applicant
|
||||
//to user: invite: invited
|
||||
//to application
|
||||
var resp pbGroup.InviteUserToGroupResp
|
||||
opUser, err := imdb.FindUserByUID(req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), req.OpUserID)
|
||||
}
|
||||
var nicknameList string
|
||||
for _, v := range req.UidList {
|
||||
for _, v := range req.InvitedUserIDList {
|
||||
var resultNode pbGroup.Id2Result
|
||||
resultNode.UId = v
|
||||
resultNode.UserID = v
|
||||
resultNode.Result = 0
|
||||
toUserInfo, err := imdb.FindUserByUID(v)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error())
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), v)
|
||||
resultNode.Result = -1
|
||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||
continue
|
||||
}
|
||||
|
||||
if imdb.IsExistGroupMember(req.GroupID, v) {
|
||||
log.NewError(req.OperationID, "ExistGroupMember failed ", req.GroupID, v)
|
||||
log.NewError(req.OperationID, "IsExistGroupMember ", req.GroupID, v)
|
||||
resultNode.Result = -1
|
||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -236,91 +214,69 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InsertGroupMember failed ", req.GroupID, toUserInfo.UserID, toUserInfo.Nickname, toUserInfo.FaceUrl)
|
||||
resultNode.Result = -1
|
||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||
continue
|
||||
}
|
||||
member, err := imdb.GetMemberInfoById(req.GroupID, v)
|
||||
if groupInfoFromMysql != nil && opUser != nil && member != nil {
|
||||
chat.MemberInvitedNotification(req.OperationID, *groupInfoFromMysql, *opUser, *member)
|
||||
} else {
|
||||
log.NewError(req.OperationID, "args failed, nil ", groupInfoFromMysql, opUser, member)
|
||||
}
|
||||
|
||||
chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, v)
|
||||
err = db.DB.AddGroupMember(req.GroupID, toUserInfo.UserID)
|
||||
if err != nil {
|
||||
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
|
||||
log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, toUserInfo.UserID)
|
||||
}
|
||||
nicknameList = nicknameList + toUserInfo.Nickname + " "
|
||||
resp.Id2Result = append(resp.Id2Result, &resultNode)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &resultNode)
|
||||
}
|
||||
|
||||
resp.ErrCode = 0
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
type inviteUserToGroupReq struct {
|
||||
GroupID string `json:"groupID"`
|
||||
UidList []string `json:"uidList"`
|
||||
Reason string `json:"reason"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
|
||||
func (c *inviteUserToGroupReq) ContentToString() string {
|
||||
data, _ := json.Marshal(c)
|
||||
dataString := string(data)
|
||||
return dataString
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) {
|
||||
log.NewInfo(req.OperationID, "GetGroupAllMember, args ", req.String())
|
||||
var resp pbGroup.GetGroupAllMemberResp
|
||||
resp.ErrCode = 0
|
||||
memberList, err := imdb.FindGroupMemberListByGroupId(req.GroupID)
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrDb.ErrCode
|
||||
resp.ErrMsg = err.Error()
|
||||
resp.ErrMsg = constant.ErrDb.ErrMsg
|
||||
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed,", err.Error(), req.GroupID)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
for _, v := range memberList {
|
||||
var node pbGroup.GroupMemberFullInfo
|
||||
node.Role = v.AdministratorLevel
|
||||
node.NickName = v.NickName
|
||||
node.UserId = v.UserID
|
||||
node.FaceUrl = v.FaceUrl
|
||||
node.JoinTime = uint64(v.JoinTime.Unix())
|
||||
resp.MemberList = append(resp.MemberList, &node)
|
||||
m := token_verify.IsMangerUserID(req.OpUserID)
|
||||
in := false
|
||||
if m {
|
||||
in = true
|
||||
}
|
||||
for _, v := range memberList {
|
||||
var node open_im_sdk.GroupMemberFullInfo
|
||||
utils.CopyStructFields(node, v)
|
||||
resp.MemberList = append(resp.MemberList, &node)
|
||||
if !m && req.OpUserID == v.UserID {
|
||||
in = true
|
||||
}
|
||||
}
|
||||
if !in {
|
||||
|
||||
}
|
||||
resp.ErrCode = 0
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) {
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbGroup.GetGroupMemberListResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
// log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
|
||||
fmt.Println("req: ", req.GroupID)
|
||||
log.NewInfo(req.OperationID, "GetGroupMemberList, args ", req.String())
|
||||
|
||||
var resp pbGroup.GetGroupMemberListResp
|
||||
resp.ErrCode = 0
|
||||
memberList, err := imdb.GetGroupMemberByGroupId(req.GroupID, req.Filter, req.NextSeq, 30)
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrDb.ErrCode
|
||||
resp.ErrMsg = err.Error()
|
||||
log.Error(claims.UID, req.OperationID, "GetGroupMemberByGroupId failed, ", err.Error(), "params: ", req.GroupID, req.Filter, req.NextSeq)
|
||||
log.NewError(req.OperationID, "GetGroupMemberByGroupId failed,", req.GroupID, req.Filter, req.NextSeq, 30)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
for _, v := range memberList {
|
||||
var node pbGroup.GroupMemberFullInfo
|
||||
node.Role = v.AdministratorLevel
|
||||
node.NickName = v.NickName
|
||||
node.UserId = v.UserID
|
||||
// node.FaceUrl =
|
||||
node.JoinTime = uint64(v.JoinTime.Unix())
|
||||
var node open_im_sdk.GroupMemberFullInfo
|
||||
utils.CopyStructFields(&node, v)
|
||||
resp.MemberList = append(resp.MemberList, &node)
|
||||
}
|
||||
//db operate get db sorted by join time
|
||||
@ -331,33 +287,12 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr
|
||||
}
|
||||
|
||||
resp.ErrCode = 0
|
||||
log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
type groupMemberFullInfo struct {
|
||||
GroupId string `json:"groupID"`
|
||||
UserId string `json:"userId"`
|
||||
Role int `json:"role"`
|
||||
JoinTime uint64 `json:"joinTime"`
|
||||
NickName string `json:"nickName"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
}
|
||||
|
||||
type kickGroupMemberApiReq struct {
|
||||
GroupID string `json:"groupID"`
|
||||
UidListInfo []groupMemberFullInfo `json:"uidListInfo"`
|
||||
Reason string `json:"reason"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
|
||||
func (c *kickGroupMemberApiReq) ContentToString() string {
|
||||
data, _ := json.Marshal(c)
|
||||
dataString := string(data)
|
||||
return dataString
|
||||
}
|
||||
|
||||
func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) {
|
||||
log.NewInfo(req.OperationID, "KickGroupMember failed ", req.String())
|
||||
log.NewInfo(req.OperationID, "KickGroupMember args ", req.String())
|
||||
ownerList, err := imdb.GetOwnerManagerByGroupId(req.GroupID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "GetOwnerManagerByGroupId failed ", err.Error(), req.GroupID)
|
||||
@ -368,209 +303,188 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
||||
for _, v := range ownerList {
|
||||
if v.UserID == req.OpUserID {
|
||||
flag = 1
|
||||
log.NewInfo(req.OperationID, "is group owner ", req.OpUserID, req.GroupID)
|
||||
log.NewDebug(req.OperationID, "is group owner ", req.OpUserID, req.GroupID)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if flag != 1 {
|
||||
if utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
if token_verify.IsMangerUserID(req.OpUserID) {
|
||||
flag = 1
|
||||
log.NewInfo(req.OperationID, "is app manager ", req.OpUserID, req.GroupID)
|
||||
log.NewDebug(req.OperationID, "is app manager ", req.OpUserID)
|
||||
}
|
||||
}
|
||||
|
||||
if flag != 1 {
|
||||
log.NewError(req.OperationID, "failed, no access kick")
|
||||
log.NewError(req.OperationID, "failed, no access kick ")
|
||||
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
|
||||
if len(req.UidListInfo) == 0 {
|
||||
if len(req.KickedUserIDList) == 0 {
|
||||
log.NewError(req.OperationID, "failed, kick list 0")
|
||||
return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrParam.ErrCode, ErrMsg: constant.ErrParam.ErrMsg}, nil
|
||||
}
|
||||
|
||||
groupOwnerUserID := ""
|
||||
for _, v := range ownerList {
|
||||
if v.AdministratorLevel == 1 {
|
||||
groupOwnerUserID = v.UserID
|
||||
}
|
||||
}
|
||||
|
||||
//remove
|
||||
var resp pbGroup.KickGroupMemberResp
|
||||
for _, v := range req.UidListInfo {
|
||||
for _, v := range req.KickedUserIDList {
|
||||
//owner cant kicked
|
||||
if v.UserId == req.OpUserID {
|
||||
log.NewError(req.OperationID, v.UserId, "failed, can't kick owner ", req.OpUserID)
|
||||
resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: -1})
|
||||
if v == groupOwnerUserID {
|
||||
log.NewError(req.OperationID, "failed, can't kick owner ", v)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
|
||||
continue
|
||||
}
|
||||
err := imdb.RemoveGroupMember(req.GroupID, v.UserId)
|
||||
err := imdb.RemoveGroupMember(req.GroupID, v)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v.UserId)
|
||||
resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: -1})
|
||||
log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v)
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1})
|
||||
} else {
|
||||
resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: 0})
|
||||
resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: 0})
|
||||
}
|
||||
|
||||
err = db.DB.DelGroupMember(req.GroupID, v.UserId)
|
||||
err = db.DB.DelGroupMember(req.GroupID, v)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "DelGroupMember failed ", err.Error(), req.GroupID, v.UserId)
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range req.UidListInfo {
|
||||
chat.MemberKickedNotificationID(req.OperationID, req.GroupID, req.OpUserID, v.UserId, req.Reason)
|
||||
for _, v := range req.KickedUserIDList {
|
||||
chat.MemberKickedNotification(req.OperationID, req.GroupID, req.OpUserID, v, req.Reason)
|
||||
}
|
||||
|
||||
resp.ErrCode = 0
|
||||
log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) {
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbGroup.GetGroupMembersInfoResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
log.InfoByKv(claims.UID, req.OperationID, "param: ", req.MemberList)
|
||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
|
||||
|
||||
var resp pbGroup.GetGroupMembersInfoResp
|
||||
|
||||
for _, v := range req.MemberList {
|
||||
var memberNode pbGroup.GroupMemberFullInfo
|
||||
var memberNode open_im_sdk.GroupMemberFullInfo
|
||||
memberInfo, err := imdb.GetMemberInfoById(req.GroupID, v)
|
||||
memberNode.UserId = v
|
||||
fmt.Println("id : ", memberNode.UserId)
|
||||
memberNode.UserID = v
|
||||
if err != nil {
|
||||
log.Error(claims.UID, req.OperationID, req.GroupID, v, "GetMemberInfoById failed, ", err.Error())
|
||||
//error occurs, only id is valid
|
||||
resp.MemberList = append(resp.MemberList, &memberNode)
|
||||
log.NewError(req.OperationID, "GetMemberInfoById failed ", err.Error(), req.GroupID, v)
|
||||
continue
|
||||
} else {
|
||||
utils.CopyStructFields(&memberNode, memberInfo)
|
||||
resp.MemberList = append(resp.MemberList, &memberNode)
|
||||
}
|
||||
user, err := imdb.FindUserByUID(v)
|
||||
if err == nil && user != nil {
|
||||
memberNode.FaceUrl = user.FaceUrl
|
||||
memberNode.JoinTime = uint64(memberInfo.JoinTime.Unix())
|
||||
memberNode.UserId = user.UserID
|
||||
memberNode.NickName = memberInfo.NickName
|
||||
memberNode.Role = memberInfo.AdministratorLevel
|
||||
}
|
||||
resp.MemberList = append(resp.MemberList, &memberNode)
|
||||
}
|
||||
resp.ErrCode = 0
|
||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo rpc return ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupApplicationList(_ context.Context, pb *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) {
|
||||
log.Info("", "", "rpc GetGroupApplicationList call start..., [pb: %s]", pb.String())
|
||||
|
||||
reply, err := im_mysql_model.GetGroupApplicationList(pb.OpUserID)
|
||||
func (s *groupServer) GetGroupApplicationList(_ context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) {
|
||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
|
||||
reply, err := im_mysql_model.GetGroupApplicationList(req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "GetGroupApplicationList failed ", err.Error(), req.OpUserID)
|
||||
return &pbGroup.GetGroupApplicationListResp{ErrCode: 701, ErrMsg: "GetGroupApplicationList failed"}, nil
|
||||
}
|
||||
log.Info("", "", "rpc GetGroupApplicationList call..., im_mysql_model.GetGroupApplicationList")
|
||||
|
||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo rpc return ", reply)
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) {
|
||||
log.Info(req.Token, req.OperationID, "rpc get group info is server,args=%s", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
|
||||
return &pbGroup.GetGroupsInfoResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
log.Info("", req.OperationID, "args:", req.GroupIDList, claims.UID)
|
||||
groupsInfoList := make([]*pbGroup.GroupInfo, 0)
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||
groupsInfoList := make([]*open_im_sdk.GroupInfo, 0)
|
||||
for _, groupID := range req.GroupIDList {
|
||||
groupInfoFromMysql, err := im_mysql_model.FindGroupInfoByGroupId(groupID)
|
||||
if err != nil {
|
||||
log.Error(req.Token, req.OperationID, "find group info failed,err=%s", err.Error())
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), groupID)
|
||||
continue
|
||||
}
|
||||
var groupInfo pbGroup.GroupInfo
|
||||
groupInfo.GroupId = groupID
|
||||
groupInfo.GroupName = groupInfoFromMysql.GroupName
|
||||
groupInfo.Introduction = groupInfoFromMysql.Introduction
|
||||
groupInfo.Notification = groupInfoFromMysql.Notification
|
||||
groupInfo.FaceUrl = groupInfoFromMysql.FaceUrl
|
||||
groupInfo.OwnerId = im_mysql_model.GetGroupOwnerByGroupId(groupID)
|
||||
groupInfo.MemberCount = uint32(im_mysql_model.GetGroupMemberNumByGroupId(groupID))
|
||||
groupInfo.CreateTime = uint64(groupInfoFromMysql.CreateTime.Unix())
|
||||
|
||||
var groupInfo open_im_sdk.GroupInfo
|
||||
utils.CopyStructFields(&groupInfo, groupInfoFromMysql)
|
||||
groupsInfoList = append(groupsInfoList, &groupInfo)
|
||||
}
|
||||
log.Info(req.Token, req.OperationID, "rpc get groupsInfo success return")
|
||||
return &pbGroup.GetGroupsInfoResp{Data: groupsInfoList}, nil
|
||||
|
||||
resp := pbGroup.GetGroupsInfoResp{GroupInfoList: groupsInfoList}
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo rpc return ", resp)
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) {
|
||||
log.NewInfo(pb.OperationID, "GroupApplicationResponse args: ", pb.String())
|
||||
reply, err := imdb.GroupApplicationResponse(pb)
|
||||
func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.CommonResp, error) {
|
||||
log.NewInfo(req.OperationID, "GroupApplicationResponse args ", req.String())
|
||||
reply, err := imdb.GroupApplicationResponse(req)
|
||||
if err != nil {
|
||||
log.NewError(pb.OperationID, "GroupApplicationResponse failed ", err.Error(), pb.String())
|
||||
return &pbGroup.GroupApplicationResponseResp{ErrCode: 702, ErrMsg: err.Error()}, nil
|
||||
log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), req.String())
|
||||
return &pbGroup.CommonResp{ErrCode: 702, ErrMsg: err.Error()}, nil
|
||||
}
|
||||
|
||||
if pb.HandleResult == 1 {
|
||||
if pb.ToUserID == "0" {
|
||||
err = db.DB.AddGroupMember(pb.GroupID, pb.FromUserID)
|
||||
if req.HandleResult == 1 {
|
||||
if req.ToUserID == "0" {
|
||||
err = db.DB.AddGroupMember(req.GroupID, req.FromUserID)
|
||||
if err != nil {
|
||||
log.Error("", "", "rpc GroupApplicationResponse call..., db.DB.AddGroupMember fail [pb: %s] [err: %s]", pb.String(), err.Error())
|
||||
return nil, err
|
||||
log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.FromUserID)
|
||||
}
|
||||
} else {
|
||||
err = db.DB.AddGroupMember(pb.GroupID, pb.ToUserID)
|
||||
err = db.DB.AddGroupMember(req.GroupID, req.ToUserID)
|
||||
if err != nil {
|
||||
log.Error("", "", "rpc GroupApplicationResponse call..., db.DB.AddGroupMember fail [pb: %s] [err: %s]", pb.String(), err.Error())
|
||||
return nil, err
|
||||
log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.ToUserID)
|
||||
}
|
||||
}
|
||||
}
|
||||
if pb.ToUserID == "0" {
|
||||
group, err := imdb.FindGroupInfoByGroupId(pb.GroupID)
|
||||
if req.ToUserID == "0" {
|
||||
group, err := imdb.FindGroupInfoByGroupId(req.GroupID)
|
||||
if err != nil {
|
||||
log.NewError(pb.OperationID, "FindGroupInfoByGroupId failed ", pb.GroupID)
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", req.GroupID)
|
||||
return reply, nil
|
||||
}
|
||||
member, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OpUserID)
|
||||
member, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(pb.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", pb.GroupID, pb.OpUserID)
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", req.GroupID, req.OpUserID)
|
||||
return reply, nil
|
||||
}
|
||||
chat.ApplicationProcessedNotification(pb.OperationID, pb.FromUserID, *group, *member, pb.HandleResult, pb.HandledMsg)
|
||||
if pb.HandleResult == 1 {
|
||||
entrantUser, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.FromUserID)
|
||||
chat.ApplicationProcessedNotification(req.OperationID, req.FromUserID, *group, *member, req.HandleResult, req.HandledMsg)
|
||||
if req.HandleResult == 1 {
|
||||
entrantUser, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, req.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(pb.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", err.Error(), pb.GroupID, pb.FromUserID)
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", err.Error(), req.GroupID, req.FromUserID)
|
||||
return reply, nil
|
||||
}
|
||||
chat.MemberEnterNotification(pb.OperationID, group, entrantUser)
|
||||
chat.MemberEnterNotification(req.OperationID, req.GroupID, entrantUser)
|
||||
}
|
||||
} else {
|
||||
log.NewError(pb.OperationID, "args failed ", pb.String())
|
||||
log.NewError(req.OperationID, "args failed ", req.String())
|
||||
}
|
||||
|
||||
log.NewInfo(pb.OperationID, "rpc GroupApplicationResponse ok ", reply)
|
||||
log.NewInfo(req.OperationID, "rpc GroupApplicationResponse ok ", reply)
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) {
|
||||
log.NewInfo(req.Token, req.OperationID, "JoinGroup args ", req.String())
|
||||
log.NewInfo(req.OperationID, "JoinGroup args ", req.String())
|
||||
//Parse token, to find current user information
|
||||
claims, err := token_verify.ParseToken(req.Token)
|
||||
//claims, err := token_verify.ParseToken(req.Token)
|
||||
//if err != nil {
|
||||
// log.NewError(req.OperationID, "ParseToken failed", err.Error(), req.String())
|
||||
// return &pbGroup.CommonResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
//}
|
||||
applicationUserInfo, err := im_mysql_model.FindUserByUID(req.FromUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "ParseToken failed", err.Error(), req.String())
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrParseToken.ErrCode, ErrMsg: constant.ErrParseToken.ErrMsg}, nil
|
||||
}
|
||||
applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindUserByUID failed", err.Error(), claims.UID)
|
||||
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), req.FromUserID)
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
|
||||
}
|
||||
|
||||
_, err = im_mysql_model.FindGroupRequestUserInfoByGroupIDAndUid(req.GroupID, claims.UID)
|
||||
_, err = im_mysql_model.FindGroupRequestUserInfoByGroupIDAndUid(req.GroupID, req.FromUserID)
|
||||
if err == nil {
|
||||
err = im_mysql_model.DelGroupRequest(req.GroupID, claims.UID, "0")
|
||||
err = im_mysql_model.DelGroupRequest(req.GroupID, req.FromUserID, "0")
|
||||
}
|
||||
|
||||
if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Nickname, applicationUserInfo.FaceUrl); err != nil {
|
||||
log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error())
|
||||
if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, req.FromUserID, "0", req.ReqMessage, applicationUserInfo.Nickname, applicationUserInfo.FaceUrl); err != nil {
|
||||
log.NewError(req.OperationID, "InsertIntoGroupRequest ", err.Error(), req.GroupID, req.FromUserID, "0", req.ReqMessage, applicationUserInfo.Nickname, applicationUserInfo.FaceUrl)
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrJoinGroupApplication.ErrCode, ErrMsg: constant.ErrJoinGroupApplication.ErrMsg}, nil
|
||||
}
|
||||
|
||||
@ -620,9 +534,9 @@ func hasAccess(req *pbGroup.SetGroupInfoReq) bool {
|
||||
if utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
return true
|
||||
}
|
||||
groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, req.OpUserID)
|
||||
groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupInfo.GroupID, req.OpUserID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed, ", err.Error(), req.GroupID, req.OpUserID)
|
||||
log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed, ", err.Error(), req.GroupInfo.GroupID, req.OpUserID)
|
||||
return false
|
||||
|
||||
}
|
||||
@ -638,39 +552,39 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrSetGroupInfo.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
|
||||
group, err := im_mysql_model.FindGroupInfoByGroupId(req.GroupID)
|
||||
group, err := im_mysql_model.FindGroupInfoByGroupId(req.GroupInfo.GroupID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed, ", err.Error(), req.GroupID)
|
||||
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed, ", err.Error(), req.GroupInfo.GroupID)
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrSetGroupInfo.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil
|
||||
}
|
||||
|
||||
////bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl
|
||||
var changedType int32
|
||||
if group.GroupName != req.GroupName && req.GroupName != "" {
|
||||
if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" {
|
||||
changedType = 1
|
||||
}
|
||||
if group.Notification != req.Notification && req.Notification != "" {
|
||||
if group.Notification != req.GroupInfo.Notification && req.GroupInfo.Notification != "" {
|
||||
changedType = changedType | (1 << 1)
|
||||
}
|
||||
if group.Introduction != req.Introduction && req.Introduction != "" {
|
||||
if group.Introduction != req.GroupInfo.Introduction && req.GroupInfo.Introduction != "" {
|
||||
changedType = changedType | (1 << 2)
|
||||
}
|
||||
if group.FaceUrl != req.FaceUrl && req.FaceUrl != "" {
|
||||
if group.FaceUrl != req.GroupInfo.FaceUrl && req.GroupInfo.FaceUrl != "" {
|
||||
changedType = changedType | (1 << 3)
|
||||
}
|
||||
//only administrators can set group information
|
||||
if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil {
|
||||
if err = im_mysql_model.SetGroupInfo(req.GroupInfo.GroupID, req.GroupInfo.GroupName, req.GroupInfo.Introduction, req.GroupInfo.Notification, req.GroupInfo.FaceUrl, ""); err != nil {
|
||||
return &pbGroup.CommonResp{ErrCode: constant.ErrSetGroupInfo.ErrCode, ErrMsg: constant.ErrSetGroupInfo.ErrMsg}, nil
|
||||
}
|
||||
|
||||
if changedType != 0 {
|
||||
chat.GroupInfoChangedNotification(req.OperationID, changedType, req.GroupID, req.OpUserID)
|
||||
chat.GroupInfoChangedNotification(req.OperationID, changedType, req.GroupInfo.GroupID, req.OpUserID)
|
||||
}
|
||||
|
||||
return &pbGroup.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) TransferGroupOwner(_ context.Context, pb *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) {
|
||||
func (s *groupServer) TransferGroupOwner(_ context.Context, pb *pbGroup.TransferGroupOwnerReq) (*pbGroup.CommonResp, error) {
|
||||
log.Info("", "", "rpc TransferGroupOwner call start..., [pb: %s]", pb.String())
|
||||
|
||||
reply, err := im_mysql_model.TransferGroupOwner(pb)
|
||||
|
@ -10,7 +10,7 @@ const (
|
||||
Application = 0
|
||||
AgreeApplication = 1
|
||||
|
||||
//feiend related
|
||||
//friend related
|
||||
BlackListFlag = 1
|
||||
ApplicationFriendFlag = 0
|
||||
FriendFlag = 1
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// reqId add userId
|
||||
func ReplaceIntoFriendReq(reqId, userId string, flag int32, reqMessage string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
@ -44,6 +45,7 @@ func FindSelfApplyFromFriendReq(userId string) ([]FriendRequest, error) {
|
||||
return usersInfo, nil
|
||||
}
|
||||
|
||||
//reqId apply to add userId already
|
||||
func FindFriendApplyFromFriendReqByUid(reqId, userId string) (*FriendRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
@ -57,6 +59,7 @@ func FindFriendApplyFromFriendReqByUid(reqId, userId string) (*FriendRequest, er
|
||||
return &friendRequest, nil
|
||||
}
|
||||
|
||||
//userId process reqId
|
||||
func UpdateFriendRelationshipToFriendReq(reqId, userId string, flag int32) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
|
@ -212,6 +212,19 @@ func GetGroupOwnerByGroupId(groupId string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetGroupOwnerInfoByGroupId(groupId string) (*GroupMember, error) {
|
||||
omList, err := GetOwnerManagerByGroupId(groupId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range omList {
|
||||
if v.AdministratorLevel == 1 {
|
||||
return v, nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func InsertGroupMember(groupId, userId, nickName, userFaceUrl string, role int32) error {
|
||||
return InsertIntoGroupMember(groupId, userId, nickName, userFaceUrl, role)
|
||||
}
|
||||
|
@ -164,12 +164,12 @@ func GetGroupApplicationList(uid string) (*group.GetGroupApplicationListResp, er
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOwnerResp, error) {
|
||||
oldOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OldOwner)
|
||||
func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.CommonResp, error) {
|
||||
oldOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OldOwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.NewOwner)
|
||||
newOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.NewOwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -178,19 +178,19 @@ func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOw
|
||||
return nil, errors.New("the self")
|
||||
}
|
||||
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwner, 0); err != nil {
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.NewOwner, 1); err != nil {
|
||||
UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwner, 1)
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.NewOwnerUserID, 1); err != nil {
|
||||
UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 1)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.TransferGroupOwnerResp{}, nil
|
||||
return &group.CommonResp{}, nil
|
||||
}
|
||||
|
||||
func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.GroupApplicationResponseResp, error) {
|
||||
func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) {
|
||||
|
||||
ownerUser, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OwnerID)
|
||||
if err != nil {
|
||||
|
@ -41,7 +41,7 @@ type Group struct {
|
||||
Notification string `gorm:"column:notification"`
|
||||
FaceUrl string `gorm:"column:face_url"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
Ext string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type GroupMember struct {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
commonDB "Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"time"
|
||||
)
|
||||
@ -80,6 +81,43 @@ func GetClaimFromToken(tokensString string) (*Claims, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func IsAppManagerAccess(token string, OpUserID string) bool {
|
||||
claims, err := ParseToken(token)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) && claims.UID == OpUserID {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsMangerUserID(OpUserID string) bool {
|
||||
if utils.IsContain(OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func CheckAccess(OpUserID string, OwnerUserID string) bool {
|
||||
if utils.IsContain(OpUserID, config.Config.Manager.AppManagerUid) {
|
||||
return true
|
||||
}
|
||||
if OpUserID == OwnerUserID {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func GetUserIDFromToken(token string) (bool, string) {
|
||||
claims, err := ParseToken(token)
|
||||
if err != nil {
|
||||
return false, ""
|
||||
}
|
||||
return true, claims.UID
|
||||
}
|
||||
|
||||
func ParseToken(tokensString string) (claims *Claims, err error) {
|
||||
|
||||
claims, err = GetClaimFromToken(tokensString)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,168 +1,137 @@
|
||||
syntax = "proto3";
|
||||
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
|
||||
option go_package = "./friend;friend";
|
||||
package friend;
|
||||
|
||||
message CommonResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
}
|
||||
|
||||
message CommID{
|
||||
string OpUserID = 1;
|
||||
string OperationID = 2;
|
||||
string ToUserID = 4;
|
||||
string FromUserID = 5;
|
||||
}
|
||||
|
||||
message GetFriendsInfoReq{
|
||||
string uid = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
}
|
||||
message GetFriendInfoResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
GetFriendData Data = 3;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message GetFriendData{
|
||||
string uid = 1;
|
||||
string icon = 2;
|
||||
string name = 3;
|
||||
int32 gender = 4;
|
||||
string mobile = 5;
|
||||
string birth = 6;
|
||||
string email = 7;
|
||||
string ex = 8;
|
||||
string comment = 9;
|
||||
int32 isFriend = 10;
|
||||
int32 isInBlackList = 11;
|
||||
message GetFriendInfoResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
FriendInfo Data = 3;
|
||||
}
|
||||
|
||||
message FriendInfo{
|
||||
string OwnerUserID = 1;
|
||||
string Remark = 2;
|
||||
uint64 CreateTime = 3;
|
||||
open_im_sdk.UserInfo FriendUser = 4;
|
||||
int32 IsBlack = 5;
|
||||
}
|
||||
|
||||
|
||||
message AddFriendReq{
|
||||
string uid = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
string ReqMessage = 4;
|
||||
CommID CommID = 1;
|
||||
string ReqMessage = 2;
|
||||
}
|
||||
|
||||
|
||||
message ImportFriendReq{
|
||||
repeated string uidList = 1;
|
||||
repeated string FriendUserIDList = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
string OwnerUid = 4;
|
||||
string FromUserID = 3;
|
||||
string OpUserID = 4;
|
||||
}
|
||||
|
||||
message ImportFriendResp{
|
||||
CommonResp commonResp = 1;
|
||||
repeated string failedUidList = 2;
|
||||
}
|
||||
|
||||
message GetFriendApplyReq{
|
||||
string OperationID = 1;
|
||||
string Token = 2;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
message GetFriendApplyResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated ApplyUserInfo data = 4;
|
||||
}
|
||||
|
||||
message ApplyUserInfo{
|
||||
string uid = 1;
|
||||
string name = 2;
|
||||
string icon = 3;
|
||||
int32 gender = 4;
|
||||
string mobile = 5;
|
||||
string birth = 6;
|
||||
string email = 7;
|
||||
string ex = 8;
|
||||
int32 flag = 9;
|
||||
string applyTime = 10;
|
||||
string reqMessage = 11;
|
||||
open_im_sdk.PublicUserInfo UserInfo = 1;
|
||||
int64 applyTime = 2;
|
||||
string reqMessage = 3;
|
||||
int32 Flag = 4;
|
||||
}
|
||||
|
||||
|
||||
message getFriendListReq{
|
||||
string OperationID = 1;
|
||||
string Token = 2;
|
||||
}
|
||||
message getFriendListResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
repeated UserInfo data = 3;
|
||||
}
|
||||
message UserInfo{
|
||||
string uid = 1;
|
||||
string name = 3;
|
||||
string icon = 2;
|
||||
int32 gender = 4;
|
||||
string mobile = 5;
|
||||
string birth = 6;
|
||||
string email = 7;
|
||||
string ex = 8;
|
||||
string comment = 9;
|
||||
int32 isInBlackList = 10;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message getFriendListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated FriendInfo Data = 3;
|
||||
}
|
||||
|
||||
|
||||
message AddBlacklistReq{
|
||||
string uid = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
string OwnerUid = 4;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
|
||||
message RemoveBlacklistReq{
|
||||
string uid = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
|
||||
message GetBlacklistReq{
|
||||
string OperationID = 1;
|
||||
string token = 2;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message GetBlacklistResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
repeated UserInfo data = 3;
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated open_im_sdk.PublicUserInfo data = 3;
|
||||
}
|
||||
|
||||
message IsFriendReq{
|
||||
string token = 1;
|
||||
string receiveUid = 2;
|
||||
string OperationID = 3;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message IsFriendResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
int32 shipType = 3;
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
int32 ShipType = 3;
|
||||
}
|
||||
|
||||
message IsInBlackListReq{
|
||||
string sendUid = 1;
|
||||
string receiveUid = 2;
|
||||
string OperationID = 3;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message IsInBlackListResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
bool response = 3;
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
bool Response = 3;
|
||||
}
|
||||
|
||||
message DeleteFriendReq{
|
||||
string uid = 1;
|
||||
string OperationID = 2;
|
||||
string Token = 3;
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
|
||||
message AddFriendResponseReq{
|
||||
string uid = 1;
|
||||
CommID CommID = 1;
|
||||
int32 flag = 2;
|
||||
string OperationID = 3;
|
||||
string Token = 4;
|
||||
}
|
||||
|
||||
message SetFriendCommentReq{
|
||||
string uid = 1;
|
||||
string operationID = 2;
|
||||
string comment = 3;
|
||||
string token = 4;
|
||||
CommID CommID = 1;
|
||||
string Remark = 2;
|
||||
}
|
||||
|
||||
service friend{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
syntax = "proto3";
|
||||
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
|
||||
option go_package = "./group;group";
|
||||
package group;
|
||||
|
||||
@ -7,58 +8,54 @@ message CommonResp{
|
||||
string ErrMsg = 2;
|
||||
}
|
||||
|
||||
message CreateGroupReq{
|
||||
repeated GroupAddMemberInfo memberList = 1;
|
||||
string groupName = 2;
|
||||
string introduction = 3;
|
||||
string notification = 4;
|
||||
string faceUrl = 5;
|
||||
string token = 6;
|
||||
string operationID = 7;
|
||||
string OpUserID = 8;
|
||||
string Ext = 9;
|
||||
message GroupAddMemberInfo{
|
||||
string UserID = 1;
|
||||
int32 Role = 2;
|
||||
}
|
||||
|
||||
|
||||
message GroupAddMemberInfo{
|
||||
string uid = 1;
|
||||
int32 setRole = 2;
|
||||
message CreateGroupReq{
|
||||
repeated GroupAddMemberInfo InitMemberList = 1; //
|
||||
string GroupName = 2;
|
||||
string Introduction = 3;
|
||||
string Notification = 4;
|
||||
string FaceUrl = 5;
|
||||
string Ext = 6;
|
||||
string OperationID = 7;
|
||||
string OpUserID = 8;
|
||||
string FromUserID = 9;
|
||||
}
|
||||
|
||||
message CreateGroupResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
string groupID = 3;
|
||||
open_im_sdk.GroupInfo GroupInfo = 3;
|
||||
}
|
||||
|
||||
message GetGroupsInfoReq{
|
||||
repeated string groupIDList = 1;
|
||||
string token = 2;
|
||||
string operationID = 3;
|
||||
string OpUserID = 4;
|
||||
repeated string GroupIDList = 1;
|
||||
string OperationID = 2;
|
||||
string OpUserID = 3;
|
||||
}
|
||||
|
||||
message GetGroupsInfoResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated GroupInfo data = 3;
|
||||
repeated open_im_sdk.GroupInfo GroupInfoList = 3;
|
||||
}
|
||||
|
||||
|
||||
message SetGroupInfoReq{
|
||||
string groupID = 1;
|
||||
string groupName = 2;
|
||||
string notification = 3;
|
||||
string introduction = 4;
|
||||
string faceUrl = 5;
|
||||
string token = 6;
|
||||
string operationID = 7;
|
||||
string OpUserID = 8;
|
||||
open_im_sdk.GroupInfo GroupInfo = 1;
|
||||
string OpUserID = 2;
|
||||
string FromUserID = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
|
||||
|
||||
//owner or manager
|
||||
message GetGroupApplicationListReq {
|
||||
string OpUserID = 1;
|
||||
string OperationID = 2;
|
||||
string FromUserID = 3; //owner or manager
|
||||
}
|
||||
|
||||
message GetGroupApplicationList_Data_User {
|
||||
@ -93,21 +90,17 @@ message GetGroupApplicationListResp {
|
||||
|
||||
message TransferGroupOwnerReq {
|
||||
string GroupID = 1;
|
||||
string OldOwner = 2;
|
||||
string NewOwner = 3;
|
||||
string OldOwnerUserID = 2;
|
||||
string NewOwnerUserID = 3;
|
||||
string OperationID = 4;
|
||||
string OpUserID = 5;
|
||||
}
|
||||
|
||||
message TransferGroupOwnerResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
}
|
||||
|
||||
message JoinGroupReq{
|
||||
string groupID = 1;
|
||||
string message = 2;
|
||||
string token = 3;
|
||||
string GroupID = 1;
|
||||
string ReqMessage = 2;
|
||||
string FromUserID = 3;
|
||||
string OperationID = 4;
|
||||
string OpUserID = 5;
|
||||
}
|
||||
@ -117,166 +110,124 @@ message GroupApplicationResponseReq{
|
||||
string OpUserID = 2;
|
||||
string GroupID = 3;
|
||||
string FromUserID = 4; //请求加群:请求者,邀请加群:邀请人
|
||||
string FromUserNickName = 5;
|
||||
string FromUserFaceUrl = 6;
|
||||
string ToUserID = 7; //请求加群:0,邀请加群:被邀请人
|
||||
string ToUserNickName = 8;
|
||||
string ToUserFaceUrl = 9;
|
||||
int64 AddTime = 10;
|
||||
string RequestMsg = 11;
|
||||
string HandledMsg = 12;
|
||||
int32 Type = 13;
|
||||
int32 HandleStatus = 14;
|
||||
int32 HandleResult = 15;
|
||||
// int32 Type = 13;
|
||||
// int32 HandleStatus = 14;
|
||||
int32 HandleResult = 15;
|
||||
}
|
||||
|
||||
message GroupApplicationResponseResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message SetOwnerGroupNickNameReq{
|
||||
string groupID = 1;
|
||||
string nickName = 2;
|
||||
string GroupID = 1;
|
||||
string Nickname = 2;
|
||||
string OperationID = 3;
|
||||
string token = 4;
|
||||
string FromUserID = 4;
|
||||
string OpUserID = 5;
|
||||
}
|
||||
|
||||
|
||||
message QuitGroupReq{
|
||||
string groupID = 1;
|
||||
string operationID = 2;
|
||||
string token = 3;
|
||||
string GroupID = 1;
|
||||
string OperationID = 2;
|
||||
string FromUserID = 3;
|
||||
string OpUserID = 4;
|
||||
}
|
||||
|
||||
|
||||
message GroupApplicationUserInfo{
|
||||
string groupID = 1;
|
||||
string uid = 2;
|
||||
string name = 3;
|
||||
string icon = 4;
|
||||
string reqMsg = 5;
|
||||
int64 applicationTime = 6;
|
||||
int32 flag = 7;
|
||||
string operatorID = 8;
|
||||
string handledMsg = 9;
|
||||
}
|
||||
|
||||
message GroupMemberFullInfo {
|
||||
string userId = 1;
|
||||
int32 role = 2;
|
||||
uint64 joinTime = 3;
|
||||
string nickName = 4;
|
||||
string faceUrl = 5;
|
||||
}
|
||||
|
||||
message GetGroupMemberListReq {
|
||||
string groupID = 1;
|
||||
string token = 2;
|
||||
string operationID = 3;
|
||||
int32 filter = 4;
|
||||
int32 nextSeq = 5;
|
||||
string OpUserID = 6;
|
||||
string GroupID = 1;
|
||||
string OpUserID = 2;
|
||||
string OperationID = 3;
|
||||
int32 Filter = 4;
|
||||
int32 NextSeq = 5;
|
||||
}
|
||||
|
||||
message GetGroupMemberListResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated GroupMemberFullInfo memberList = 3;
|
||||
repeated open_im_sdk.GroupMemberFullInfo memberList = 3;
|
||||
int32 nextSeq = 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetGroupMembersInfoReq {
|
||||
string groupID = 1;
|
||||
string GroupID = 1;
|
||||
repeated string memberList = 2;
|
||||
string token = 3;
|
||||
string operationID = 4;
|
||||
string OpUserID = 5;
|
||||
string OpUserID = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
|
||||
message GetGroupMembersInfoResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated GroupMemberFullInfo memberList = 3;
|
||||
|
||||
repeated open_im_sdk.GroupMemberFullInfo memberList = 3;
|
||||
}
|
||||
|
||||
message KickGroupMemberReq {
|
||||
string groupID = 1;
|
||||
repeated GroupMemberFullInfo uidListInfo = 2;
|
||||
string reason = 3;
|
||||
string token = 4;
|
||||
string operationID = 5;
|
||||
string GroupID = 1;
|
||||
repeated string KickedUserIDList = 2;
|
||||
string Reason = 3;
|
||||
string OperationID = 5;
|
||||
string OpUserID = 6;
|
||||
}
|
||||
|
||||
message Id2Result {
|
||||
string uId = 1;
|
||||
int32 result = 2; //0 ok; -1 error
|
||||
string UserID = 1;
|
||||
int32 Result = 2; //0 ok; -1 error
|
||||
}
|
||||
|
||||
message KickGroupMemberResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated Id2Result id2result = 3;
|
||||
repeated Id2Result Id2ResultList = 3;
|
||||
}
|
||||
|
||||
|
||||
message getJoinedGroupListReq {
|
||||
string token = 1;
|
||||
message GetJoinedGroupListReq {
|
||||
string FromUserID = 1;
|
||||
string operationID = 2;
|
||||
string OpUserID = 3;
|
||||
}
|
||||
|
||||
message GroupInfo {
|
||||
string groupId = 1;
|
||||
string groupName = 2;
|
||||
string notification = 3;
|
||||
string introduction = 4;
|
||||
string faceUrl = 5;
|
||||
uint64 createTime = 6;
|
||||
string ownerId = 7;
|
||||
uint32 memberCount = 8;
|
||||
}
|
||||
|
||||
message getJoinedGroupListResp{
|
||||
message GetJoinedGroupListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrorMsg = 2;
|
||||
repeated GroupInfo GroupList = 3;
|
||||
string ErrMsg = 2;
|
||||
repeated open_im_sdk.GroupInfo GroupList = 3;
|
||||
}
|
||||
|
||||
|
||||
message inviteUserToGroupReq {
|
||||
string token = 1;
|
||||
string operationID = 2;
|
||||
string groupID = 3;
|
||||
string reason = 4;
|
||||
repeated string uidList = 5;
|
||||
message InviteUserToGroupReq {
|
||||
string OperationID = 2;
|
||||
string GroupID = 3;
|
||||
string Reason = 4;
|
||||
repeated string InvitedUserIDList = 5;
|
||||
string OpUserID = 6;
|
||||
}
|
||||
|
||||
message inviteUserToGroupResp {
|
||||
message InviteUserToGroupResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated Id2Result Id2Result = 3; // 0 ok, -1 error
|
||||
repeated Id2Result Id2ResultList = 3; // 0 ok, -1 error
|
||||
}
|
||||
|
||||
|
||||
message GetGroupAllMemberReq {
|
||||
string groupID = 1;
|
||||
string token = 2;
|
||||
string operationID = 3;
|
||||
string OpUserID = 4;
|
||||
string GroupID = 1;
|
||||
string OpUserID = 2;
|
||||
string OperationID = 3;
|
||||
}
|
||||
|
||||
message GetGroupAllMemberResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated GroupMemberFullInfo memberList = 3;
|
||||
repeated open_im_sdk.GroupMemberFullInfo memberList = 3;
|
||||
}
|
||||
|
||||
|
||||
@ -288,14 +239,14 @@ service group{
|
||||
rpc getGroupsInfo(GetGroupsInfoReq) returns(GetGroupsInfoResp);
|
||||
rpc setGroupInfo(SetGroupInfoReq) returns(CommonResp);
|
||||
rpc getGroupApplicationList(GetGroupApplicationListReq) returns(GetGroupApplicationListResp);
|
||||
rpc transferGroupOwner(TransferGroupOwnerReq) returns(TransferGroupOwnerResp);
|
||||
rpc groupApplicationResponse(GroupApplicationResponseReq) returns(GroupApplicationResponseResp);
|
||||
rpc transferGroupOwner(TransferGroupOwnerReq) returns(CommonResp);
|
||||
rpc groupApplicationResponse(GroupApplicationResponseReq) returns(CommonResp);
|
||||
// rpc setOwnerGroupNickName(SetOwnerGroupNickNameReq) returns(CommonResp);
|
||||
rpc getGroupMemberList(GetGroupMemberListReq) returns(GetGroupMemberListResp);
|
||||
rpc getGroupMembersInfo(GetGroupMembersInfoReq) returns(GetGroupMembersInfoResp);
|
||||
rpc kickGroupMember(KickGroupMemberReq) returns (KickGroupMemberResp);
|
||||
rpc getJoinedGroupList(getJoinedGroupListReq) returns (getJoinedGroupListResp);
|
||||
rpc inviteUserToGroup(inviteUserToGroupReq) returns (inviteUserToGroupResp);
|
||||
rpc getJoinedGroupList(GetJoinedGroupListReq) returns (GetJoinedGroupListResp);
|
||||
rpc inviteUserToGroup(InviteUserToGroupReq) returns (InviteUserToGroupResp);
|
||||
|
||||
rpc getGroupAllMember(GetGroupAllMemberReq) returns(GetGroupAllMemberResp);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: sdk_ws/ws.proto
|
||||
|
||||
package open_im_sdk // import "./sdk_ws"
|
||||
package open_im_sdk
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
@ -32,7 +32,7 @@ func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListRe
|
||||
func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*PullMessageBySeqListResp) ProtoMessage() {}
|
||||
func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{0}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{0}
|
||||
}
|
||||
func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b)
|
||||
@ -91,7 +91,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq
|
||||
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*PullMessageBySeqListReq) ProtoMessage() {}
|
||||
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{1}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{1}
|
||||
}
|
||||
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
|
||||
@ -128,7 +128,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
|
||||
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
||||
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{2}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{2}
|
||||
}
|
||||
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
||||
@ -160,7 +160,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
|
||||
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
||||
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{3}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{3}
|
||||
}
|
||||
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
||||
@ -208,7 +208,7 @@ func (m *GatherFormat) Reset() { *m = GatherFormat{} }
|
||||
func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
|
||||
func (*GatherFormat) ProtoMessage() {}
|
||||
func (*GatherFormat) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{4}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{4}
|
||||
}
|
||||
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
|
||||
@ -276,7 +276,7 @@ func (m *MsgFormat) Reset() { *m = MsgFormat{} }
|
||||
func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgFormat) ProtoMessage() {}
|
||||
func (*MsgFormat) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{5}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{5}
|
||||
}
|
||||
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
|
||||
@ -401,7 +401,7 @@ func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} }
|
||||
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserSendMsgReq) ProtoMessage() {}
|
||||
func (*UserSendMsgReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{6}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{6}
|
||||
}
|
||||
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
|
||||
@ -511,7 +511,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} }
|
||||
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserSendMsgResp) ProtoMessage() {}
|
||||
func (*UserSendMsgResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{7}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{7}
|
||||
}
|
||||
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
|
||||
@ -580,7 +580,7 @@ func (m *MsgData) Reset() { *m = MsgData{} }
|
||||
func (m *MsgData) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgData) ProtoMessage() {}
|
||||
func (*MsgData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{8}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{8}
|
||||
}
|
||||
func (m *MsgData) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgData.Unmarshal(m, b)
|
||||
@ -741,7 +741,7 @@ func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} }
|
||||
func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*OfflinePushInfo) ProtoMessage() {}
|
||||
func (*OfflinePushInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{9}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{9}
|
||||
}
|
||||
func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b)
|
||||
@ -815,7 +815,7 @@ func (m *GroupInfo) Reset() { *m = GroupInfo{} }
|
||||
func (m *GroupInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupInfo) ProtoMessage() {}
|
||||
func (*GroupInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{10}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{10}
|
||||
}
|
||||
func (m *GroupInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GroupInfo.Unmarshal(m, b)
|
||||
@ -909,7 +909,7 @@ func (m *GroupMemberFullInfo) Reset() { *m = GroupMemberFullInfo{} }
|
||||
func (m *GroupMemberFullInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupMemberFullInfo) ProtoMessage() {}
|
||||
func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{11}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{11}
|
||||
}
|
||||
func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b)
|
||||
@ -996,7 +996,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} }
|
||||
func (m *UserInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserInfo) ProtoMessage() {}
|
||||
func (*UserInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{12}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{12}
|
||||
}
|
||||
func (m *UserInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserInfo.Unmarshal(m, b)
|
||||
@ -1080,7 +1080,7 @@ func (m *PublicUserInfo) Reset() { *m = PublicUserInfo{} }
|
||||
func (m *PublicUserInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*PublicUserInfo) ProtoMessage() {}
|
||||
func (*PublicUserInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{13}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{13}
|
||||
}
|
||||
func (m *PublicUserInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PublicUserInfo.Unmarshal(m, b)
|
||||
@ -1140,7 +1140,7 @@ func (m *TipsComm) Reset() { *m = TipsComm{} }
|
||||
func (m *TipsComm) String() string { return proto.CompactTextString(m) }
|
||||
func (*TipsComm) ProtoMessage() {}
|
||||
func (*TipsComm) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{14}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{14}
|
||||
}
|
||||
func (m *TipsComm) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TipsComm.Unmarshal(m, b)
|
||||
@ -1189,7 +1189,7 @@ func (m *MemberEnterTips) Reset() { *m = MemberEnterTips{} }
|
||||
func (m *MemberEnterTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemberEnterTips) ProtoMessage() {}
|
||||
func (*MemberEnterTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{15}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{15}
|
||||
}
|
||||
func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b)
|
||||
@ -1244,7 +1244,7 @@ func (m *MemberLeaveTips) Reset() { *m = MemberLeaveTips{} }
|
||||
func (m *MemberLeaveTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemberLeaveTips) ProtoMessage() {}
|
||||
func (*MemberLeaveTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{16}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{16}
|
||||
}
|
||||
func (m *MemberLeaveTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MemberLeaveTips.Unmarshal(m, b)
|
||||
@ -1299,7 +1299,7 @@ func (m *MemberInvitedTips) Reset() { *m = MemberInvitedTips{} }
|
||||
func (m *MemberInvitedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemberInvitedTips) ProtoMessage() {}
|
||||
func (*MemberInvitedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{17}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{17}
|
||||
}
|
||||
func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b)
|
||||
@ -1361,7 +1361,7 @@ func (m *MemberKickedTips) Reset() { *m = MemberKickedTips{} }
|
||||
func (m *MemberKickedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemberKickedTips) ProtoMessage() {}
|
||||
func (*MemberKickedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{18}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{18}
|
||||
}
|
||||
func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b)
|
||||
@ -1424,7 +1424,7 @@ func (m *MemberInfoChangedTips) Reset() { *m = MemberInfoChangedTips{} }
|
||||
func (m *MemberInfoChangedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemberInfoChangedTips) ProtoMessage() {}
|
||||
func (*MemberInfoChangedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{19}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{19}
|
||||
}
|
||||
func (m *MemberInfoChangedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MemberInfoChangedTips.Unmarshal(m, b)
|
||||
@ -1493,7 +1493,7 @@ func (m *GroupCreatedTips) Reset() { *m = GroupCreatedTips{} }
|
||||
func (m *GroupCreatedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupCreatedTips) ProtoMessage() {}
|
||||
func (*GroupCreatedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{20}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{20}
|
||||
}
|
||||
func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b)
|
||||
@ -1554,7 +1554,7 @@ func (m *GroupInfoChangedTips) Reset() { *m = GroupInfoChangedTips{} }
|
||||
func (m *GroupInfoChangedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*GroupInfoChangedTips) ProtoMessage() {}
|
||||
func (*GroupInfoChangedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{21}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{21}
|
||||
}
|
||||
func (m *GroupInfoChangedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GroupInfoChangedTips.Unmarshal(m, b)
|
||||
@ -1608,7 +1608,7 @@ func (m *ReceiveJoinApplicationTips) Reset() { *m = ReceiveJoinApplicati
|
||||
func (m *ReceiveJoinApplicationTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReceiveJoinApplicationTips) ProtoMessage() {}
|
||||
func (*ReceiveJoinApplicationTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{22}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{22}
|
||||
}
|
||||
func (m *ReceiveJoinApplicationTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ReceiveJoinApplicationTips.Unmarshal(m, b)
|
||||
@ -1663,7 +1663,7 @@ func (m *ApplicationProcessedTips) Reset() { *m = ApplicationProcessedTi
|
||||
func (m *ApplicationProcessedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*ApplicationProcessedTips) ProtoMessage() {}
|
||||
func (*ApplicationProcessedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{23}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{23}
|
||||
}
|
||||
func (m *ApplicationProcessedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ApplicationProcessedTips.Unmarshal(m, b)
|
||||
@ -1726,7 +1726,7 @@ func (m *FriendInfo) Reset() { *m = FriendInfo{} }
|
||||
func (m *FriendInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendInfo) ProtoMessage() {}
|
||||
func (*FriendInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{24}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{24}
|
||||
}
|
||||
func (m *FriendInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendInfo.Unmarshal(m, b)
|
||||
@ -1787,7 +1787,7 @@ func (m *FriendApplication) Reset() { *m = FriendApplication{} }
|
||||
func (m *FriendApplication) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendApplication) ProtoMessage() {}
|
||||
func (*FriendApplication) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{25}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{25}
|
||||
}
|
||||
func (m *FriendApplication) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendApplication.Unmarshal(m, b)
|
||||
@ -1843,7 +1843,7 @@ func (m *FriendApplicationAddedTips) Reset() { *m = FriendApplicationAdd
|
||||
func (m *FriendApplicationAddedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendApplicationAddedTips) ProtoMessage() {}
|
||||
func (*FriendApplicationAddedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{26}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{26}
|
||||
}
|
||||
func (m *FriendApplicationAddedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendApplicationAddedTips.Unmarshal(m, b)
|
||||
@ -1906,7 +1906,7 @@ func (m *FriendApplicationProcessedTips) Reset() { *m = FriendApplicatio
|
||||
func (m *FriendApplicationProcessedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendApplicationProcessedTips) ProtoMessage() {}
|
||||
func (*FriendApplicationProcessedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{27}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{27}
|
||||
}
|
||||
func (m *FriendApplicationProcessedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendApplicationProcessedTips.Unmarshal(m, b)
|
||||
@ -1966,7 +1966,7 @@ func (m *FriendAddedTips) Reset() { *m = FriendAddedTips{} }
|
||||
func (m *FriendAddedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendAddedTips) ProtoMessage() {}
|
||||
func (*FriendAddedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{28}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{28}
|
||||
}
|
||||
func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b)
|
||||
@ -2012,7 +2012,7 @@ func (m *FriendDeletedTips) Reset() { *m = FriendDeletedTips{} }
|
||||
func (m *FriendDeletedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendDeletedTips) ProtoMessage() {}
|
||||
func (*FriendDeletedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{29}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{29}
|
||||
}
|
||||
func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b)
|
||||
@ -2059,7 +2059,7 @@ func (m *BlackInfo) Reset() { *m = BlackInfo{} }
|
||||
func (m *BlackInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*BlackInfo) ProtoMessage() {}
|
||||
func (*BlackInfo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{30}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{30}
|
||||
}
|
||||
func (m *BlackInfo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BlackInfo.Unmarshal(m, b)
|
||||
@ -2112,7 +2112,7 @@ func (m *BlackAddedTips) Reset() { *m = BlackAddedTips{} }
|
||||
func (m *BlackAddedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*BlackAddedTips) ProtoMessage() {}
|
||||
func (*BlackAddedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{31}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{31}
|
||||
}
|
||||
func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b)
|
||||
@ -2158,7 +2158,7 @@ func (m *BlackDeletedTips) Reset() { *m = BlackDeletedTips{} }
|
||||
func (m *BlackDeletedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*BlackDeletedTips) ProtoMessage() {}
|
||||
func (*BlackDeletedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{32}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{32}
|
||||
}
|
||||
func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b)
|
||||
@ -2205,7 +2205,7 @@ func (m *FriendInfoChangedTips) Reset() { *m = FriendInfoChangedTips{} }
|
||||
func (m *FriendInfoChangedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*FriendInfoChangedTips) ProtoMessage() {}
|
||||
func (*FriendInfoChangedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{33}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{33}
|
||||
}
|
||||
func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b)
|
||||
@ -2260,7 +2260,7 @@ func (m *SelfInfoUpdatedTips) Reset() { *m = SelfInfoUpdatedTips{} }
|
||||
func (m *SelfInfoUpdatedTips) String() string { return proto.CompactTextString(m) }
|
||||
func (*SelfInfoUpdatedTips) ProtoMessage() {}
|
||||
func (*SelfInfoUpdatedTips) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ws_a9634e8f434358ba, []int{34}
|
||||
return fileDescriptor_ws_ca4877c90b77c1e9, []int{34}
|
||||
}
|
||||
func (m *SelfInfoUpdatedTips) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SelfInfoUpdatedTips.Unmarshal(m, b)
|
||||
@ -2341,124 +2341,124 @@ func init() {
|
||||
proto.RegisterType((*SelfInfoUpdatedTips)(nil), "open_im_sdk.SelfInfoUpdatedTips")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_a9634e8f434358ba) }
|
||||
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_ca4877c90b77c1e9) }
|
||||
|
||||
var fileDescriptor_ws_a9634e8f434358ba = []byte{
|
||||
// 1855 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0x5f, 0x6f, 0xdc, 0x5a,
|
||||
0x11, 0x97, 0xf7, 0x5f, 0xb2, 0xb3, 0x69, 0x92, 0xba, 0x6d, 0xae, 0x29, 0x57, 0x55, 0xb0, 0x10,
|
||||
0x8a, 0xae, 0xae, 0x52, 0x91, 0x08, 0x71, 0xdb, 0x2b, 0xe0, 0x26, 0xd9, 0x24, 0xda, 0xd2, 0x34,
|
||||
0x91, 0xb7, 0x15, 0x12, 0x2f, 0x95, 0x6b, 0x9f, 0xdd, 0x98, 0xf5, 0x9f, 0x8d, 0x8f, 0x77, 0xdb,
|
||||
0x7e, 0x12, 0x24, 0x24, 0x24, 0x10, 0x0f, 0x08, 0xf1, 0x82, 0x10, 0xe2, 0x43, 0x20, 0xc4, 0x87,
|
||||
0x40, 0xf0, 0xc8, 0x0b, 0xaf, 0x08, 0x09, 0xcd, 0x9c, 0x63, 0xfb, 0x9c, 0xf5, 0x92, 0xec, 0xe6,
|
||||
0xaa, 0x7d, 0xf3, 0xfc, 0x3c, 0x73, 0xe6, 0xdf, 0x6f, 0xc6, 0x27, 0x1b, 0xd8, 0xe0, 0xfe, 0xe8,
|
||||
0xf5, 0x5b, 0xfe, 0xf8, 0x2d, 0xdf, 0x1d, 0xa7, 0x49, 0x96, 0x98, 0x9d, 0x64, 0xcc, 0xe2, 0xd7,
|
||||
0x41, 0xf4, 0x9a, 0xfb, 0x23, 0xfb, 0x2f, 0x06, 0x58, 0x17, 0x93, 0x30, 0x3c, 0x63, 0x9c, 0xbb,
|
||||
0x43, 0x76, 0xf8, 0xbe, 0xcf, 0xae, 0x9e, 0x07, 0x3c, 0x73, 0x18, 0x1f, 0x9b, 0x5b, 0xd0, 0x3a,
|
||||
0x73, 0xdf, 0xf5, 0xd9, 0x95, 0x65, 0x6c, 0x1b, 0x3b, 0x75, 0x47, 0x4a, 0x84, 0x07, 0x31, 0xe2,
|
||||
0x35, 0x89, 0x93, 0x64, 0xfe, 0x08, 0xee, 0xf4, 0x83, 0x78, 0x18, 0xb2, 0x57, 0x9c, 0xa5, 0x67,
|
||||
0x7c, 0x68, 0xd5, 0xb7, 0xeb, 0x3b, 0x9d, 0xbd, 0x6f, 0xec, 0x2a, 0x1e, 0x77, 0x4f, 0xdd, 0xec,
|
||||
0x92, 0xa5, 0x27, 0x49, 0x1a, 0xb9, 0x99, 0xa3, 0xeb, 0x9b, 0x3f, 0x80, 0xb5, 0xd3, 0x34, 0x99,
|
||||
0x8c, 0x73, 0xfb, 0xc6, 0x4d, 0xf6, 0x9a, 0xba, 0xbd, 0x0f, 0x9f, 0xcc, 0xcf, 0xe5, 0xca, 0xb4,
|
||||
0x60, 0x85, 0x0b, 0xc9, 0x32, 0xb6, 0xeb, 0x3b, 0x75, 0x27, 0x17, 0xed, 0xfb, 0x60, 0x9e, 0xb2,
|
||||
0xec, 0xcc, 0x7d, 0x77, 0x10, 0xfb, 0x22, 0x0f, 0x87, 0x5d, 0xd9, 0xc7, 0x70, 0xaf, 0x82, 0x8a,
|
||||
0x8a, 0x44, 0x5a, 0x45, 0xa2, 0xa2, 0x22, 0x91, 0x56, 0x11, 0x21, 0xd9, 0xcf, 0x60, 0x4d, 0x8d,
|
||||
0xd7, 0x5c, 0x87, 0x5a, 0xaf, 0x4b, 0xb6, 0x6d, 0xa7, 0xd6, 0xeb, 0x9a, 0x9f, 0x41, 0x83, 0x62,
|
||||
0xaa, 0x51, 0xa2, 0x5b, 0x5a, 0xa2, 0x67, 0x7c, 0x28, 0xb3, 0x24, 0x1d, 0xfb, 0xbf, 0x35, 0x68,
|
||||
0x17, 0x18, 0x7a, 0xec, 0xb3, 0xd8, 0x2f, 0x4e, 0x93, 0x12, 0xe2, 0x0e, 0xf3, 0xa6, 0xbd, 0x2e,
|
||||
0x45, 0xd2, 0x76, 0xa4, 0x84, 0x05, 0x40, 0xe3, 0x34, 0x89, 0xac, 0xfa, 0xb6, 0xb1, 0xd3, 0x74,
|
||||
0x72, 0xd1, 0xdc, 0x86, 0xce, 0x51, 0x12, 0x67, 0x2c, 0xce, 0x5e, 0xbe, 0x1f, 0x33, 0xab, 0x41,
|
||||
0x6f, 0x55, 0x08, 0x35, 0xfa, 0x2c, 0x9d, 0x52, 0x91, 0x7b, 0x5d, 0xab, 0x49, 0x07, 0xab, 0x10,
|
||||
0x9e, 0x2e, 0x0d, 0xac, 0x16, 0xbd, 0xcd, 0x45, 0x73, 0x13, 0xea, 0x58, 0x96, 0x15, 0x2a, 0x0b,
|
||||
0x3e, 0x9a, 0x0f, 0x61, 0x15, 0x63, 0x7d, 0x19, 0x44, 0xcc, 0x5a, 0x25, 0xb8, 0x90, 0xcd, 0xcf,
|
||||
0x60, 0x13, 0x9f, 0x59, 0x7a, 0x11, 0xba, 0xd9, 0x20, 0x49, 0xa3, 0x5e, 0xd7, 0x6a, 0x53, 0x40,
|
||||
0x15, 0xdc, 0xfc, 0x0e, 0xac, 0x0b, 0xec, 0x45, 0xe0, 0x8d, 0x5e, 0xb8, 0x11, 0xb3, 0x80, 0x5c,
|
||||
0xcf, 0xa0, 0xe6, 0xb7, 0xe1, 0x8e, 0x40, 0x4e, 0x5c, 0x8f, 0xbd, 0x72, 0x9e, 0x5b, 0x1d, 0x52,
|
||||
0xd3, 0x41, 0xaa, 0x42, 0x18, 0xb0, 0x38, 0x13, 0x39, 0xae, 0x89, 0x1c, 0x15, 0xc8, 0xfe, 0x5b,
|
||||
0x1d, 0xd6, 0x91, 0x69, 0x68, 0x77, 0xc6, 0x87, 0xc8, 0xaa, 0x43, 0x58, 0x39, 0x1f, 0x67, 0x41,
|
||||
0x12, 0x73, 0x62, 0x55, 0x67, 0x6f, 0x47, 0xeb, 0xa0, 0xae, 0xbd, 0x2b, 0x55, 0x8f, 0xe3, 0x2c,
|
||||
0x7d, 0xef, 0xe4, 0x86, 0x73, 0xd2, 0xa8, 0x2d, 0x96, 0x46, 0x7d, 0x5e, 0x1a, 0x8f, 0x00, 0x94,
|
||||
0xd2, 0x89, 0x5e, 0x2a, 0x88, 0x68, 0x25, 0xe7, 0x41, 0x12, 0x53, 0xb3, 0x9b, 0xa2, 0xd9, 0x0a,
|
||||
0xa4, 0x12, 0xa5, 0x75, 0x2d, 0x51, 0x56, 0xaa, 0x44, 0x29, 0xc9, 0xb7, 0xaa, 0x91, 0xef, 0x53,
|
||||
0x68, 0x9f, 0x24, 0xa9, 0xc7, 0x88, 0xeb, 0xed, 0xed, 0xfa, 0x4e, 0xdb, 0x29, 0x01, 0x95, 0x3c,
|
||||
0xa0, 0x93, 0x67, 0xa6, 0x29, 0x9d, 0x4a, 0x53, 0x1e, 0x3e, 0x85, 0x35, 0xb5, 0xac, 0x48, 0xb7,
|
||||
0x11, 0x7b, 0x2f, 0x67, 0x02, 0x1f, 0xcd, 0xfb, 0xd0, 0x9c, 0xba, 0xe1, 0x44, 0x94, 0xb5, 0xe9,
|
||||
0x08, 0xe1, 0x69, 0xed, 0x0b, 0xc3, 0xbe, 0x82, 0x0d, 0xad, 0x43, 0x7c, 0x3c, 0xcb, 0x74, 0xa3,
|
||||
0xca, 0xf4, 0x99, 0x90, 0x6a, 0x95, 0x90, 0x90, 0xdf, 0x3c, 0xe7, 0x77, 0x5d, 0xf0, 0x3b, 0x97,
|
||||
0xed, 0x3f, 0x37, 0xa9, 0xba, 0x5d, 0x37, 0x73, 0xb1, 0x58, 0x5c, 0x9b, 0x60, 0x5e, 0x4c, 0x70,
|
||||
0xaa, 0x4d, 0x70, 0x5a, 0x4c, 0xf0, 0x10, 0xb7, 0x5d, 0xaf, 0x2b, 0x5b, 0x9f, 0x8b, 0x18, 0x93,
|
||||
0xa7, 0xc4, 0xd4, 0x10, 0x31, 0x29, 0x10, 0x6a, 0xf0, 0xea, 0x04, 0x2b, 0x10, 0x4e, 0x1e, 0x9f,
|
||||
0x9d, 0x3c, 0xd1, 0xff, 0x0a, 0x8e, 0x94, 0xe5, 0x3a, 0x65, 0x57, 0x04, 0x65, 0x79, 0x85, 0xb2,
|
||||
0x5c, 0xa3, 0xac, 0x60, 0x85, 0x0e, 0x8a, 0xd8, 0x4a, 0x4a, 0x8a, 0x71, 0x57, 0x21, 0xcc, 0x3c,
|
||||
0x92, 0x94, 0x04, 0x41, 0xc9, 0xa8, 0xa4, 0xa4, 0xa7, 0x50, 0xb2, 0x23, 0x6c, 0x15, 0x08, 0x6d,
|
||||
0xa5, 0x48, 0x33, 0xbd, 0xe6, 0xe4, 0x22, 0x92, 0x72, 0x50, 0x90, 0xf2, 0x8e, 0x20, 0x65, 0x01,
|
||||
0x20, 0x91, 0x38, 0xbb, 0xb2, 0xd6, 0xc5, 0xde, 0xe2, 0x62, 0x6f, 0x15, 0x7d, 0xdd, 0xd0, 0xfb,
|
||||
0x8a, 0x63, 0xe7, 0xa5, 0xcc, 0xcd, 0x18, 0xbd, 0xdd, 0xa4, 0xb7, 0x0a, 0x62, 0x7e, 0x59, 0x2e,
|
||||
0x8a, 0xbb, 0xb4, 0x28, 0xbe, 0x35, 0xbb, 0xea, 0x91, 0x12, 0xff, 0x67, 0x43, 0x9c, 0xc0, 0x46,
|
||||
0x32, 0x18, 0x84, 0x41, 0xcc, 0x2e, 0x26, 0xfc, 0xb2, 0x17, 0x0f, 0x12, 0xcb, 0xdc, 0x36, 0x76,
|
||||
0x3a, 0x7b, 0x9f, 0x6a, 0x87, 0x9c, 0xeb, 0x3a, 0xce, 0xac, 0xd1, 0xb2, 0xb3, 0xb2, 0xaa, 0xce,
|
||||
0xca, 0xcf, 0x0d, 0xd8, 0x98, 0x71, 0x80, 0xda, 0x2f, 0x83, 0x2c, 0x64, 0xf2, 0x04, 0x21, 0x98,
|
||||
0x26, 0x34, 0xba, 0x8c, 0x7b, 0x92, 0xbc, 0xf4, 0x8c, 0x9e, 0x8e, 0xdf, 0x65, 0x92, 0xb6, 0xf8,
|
||||
0x68, 0xda, 0xb0, 0x16, 0x9c, 0xf7, 0xf1, 0xa8, 0x7e, 0x32, 0x89, 0x7d, 0xc9, 0x59, 0x0d, 0x43,
|
||||
0xfa, 0x04, 0xe7, 0xfd, 0x43, 0xd7, 0x1f, 0xb2, 0xa3, 0x64, 0x12, 0x67, 0x44, 0xdb, 0x55, 0x47,
|
||||
0x07, 0xed, 0x5f, 0xd4, 0xa0, 0x4d, 0xb7, 0x00, 0x8a, 0xc9, 0x82, 0x95, 0x53, 0x39, 0x24, 0x22,
|
||||
0xaa, 0x5c, 0xc4, 0x76, 0xd3, 0xa3, 0xb2, 0x62, 0x4b, 0x00, 0xe3, 0x79, 0x91, 0x64, 0xc1, 0x20,
|
||||
0xf0, 0x5c, 0xac, 0x90, 0x0c, 0x55, 0xc3, 0x50, 0xa7, 0x17, 0x67, 0x69, 0xe2, 0x4f, 0x3c, 0xd2,
|
||||
0x91, 0x31, 0xab, 0x18, 0xfa, 0x27, 0x5e, 0xa7, 0xa1, 0x1c, 0xb2, 0x5c, 0x34, 0xbf, 0x0b, 0xcd,
|
||||
0xf3, 0xb7, 0x31, 0x4b, 0x69, 0xaa, 0x3a, 0x7b, 0xdf, 0xd4, 0x7a, 0x77, 0x31, 0x79, 0x13, 0x06,
|
||||
0x1e, 0x6e, 0x23, 0x6a, 0x9d, 0xd0, 0x44, 0x56, 0x1d, 0x95, 0xac, 0xc2, 0x19, 0x6b, 0x38, 0x0a,
|
||||
0x82, 0xec, 0x3f, 0x63, 0xd1, 0x1b, 0x96, 0x8a, 0xf2, 0xe0, 0x74, 0xdd, 0x71, 0x54, 0xc8, 0xfe,
|
||||
0x97, 0x01, 0xf7, 0x28, 0x49, 0x01, 0x9e, 0x4c, 0xc2, 0xf0, 0x86, 0x32, 0x6d, 0x41, 0x8b, 0xc2,
|
||||
0x28, 0xb6, 0x8f, 0x90, 0xcc, 0x5d, 0x30, 0x0f, 0xfc, 0x28, 0x88, 0x03, 0x9e, 0xa5, 0x6e, 0x96,
|
||||
0xa4, 0xcf, 0xd9, 0x94, 0x85, 0xf2, 0x2a, 0x31, 0xe7, 0x0d, 0x4e, 0xcb, 0xb3, 0x24, 0x88, 0x29,
|
||||
0xf2, 0x06, 0x45, 0x5e, 0xc8, 0xf8, 0xae, 0xd8, 0x1c, 0xa2, 0x4a, 0x85, 0xac, 0x16, 0xb0, 0xa5,
|
||||
0x17, 0xd0, 0x86, 0xb5, 0x93, 0x34, 0x60, 0xb1, 0xef, 0xb0, 0xc8, 0x4d, 0x47, 0x72, 0xe7, 0x68,
|
||||
0x98, 0xfd, 0x27, 0x03, 0x56, 0xf3, 0x2a, 0x2a, 0xa9, 0x18, 0x5a, 0x2a, 0xd2, 0x7d, 0x5c, 0x12,
|
||||
0xa1, 0x90, 0x55, 0xf7, 0x75, 0xdd, 0xfd, 0x16, 0xb4, 0x4e, 0x69, 0x6f, 0xc9, 0xaf, 0xaa, 0x94,
|
||||
0xe8, 0x32, 0x9c, 0xbc, 0x09, 0xc2, 0x3c, 0x15, 0x29, 0xe1, 0x74, 0x1c, 0x06, 0x69, 0x76, 0x29,
|
||||
0xd3, 0x10, 0x02, 0xa2, 0xc7, 0x91, 0x1b, 0x84, 0x32, 0x7a, 0x21, 0xd8, 0x53, 0x58, 0xd7, 0x19,
|
||||
0xf0, 0x71, 0x62, 0xb7, 0xbb, 0xb0, 0xfa, 0x32, 0x18, 0xf3, 0xa3, 0x24, 0x8a, 0x50, 0xa7, 0xcb,
|
||||
0x32, 0x0c, 0xcd, 0xa0, 0x3d, 0x29, 0x25, 0x24, 0x59, 0x97, 0x0d, 0xdc, 0x49, 0x98, 0xa1, 0x6a,
|
||||
0xfe, 0xc1, 0x53, 0x20, 0xfb, 0x77, 0x06, 0x6c, 0x08, 0x7e, 0x1d, 0xc7, 0x19, 0x4b, 0x11, 0x33,
|
||||
0x3f, 0x87, 0x26, 0x31, 0x8a, 0x0e, 0x9b, 0xbd, 0xd9, 0x16, 0xe3, 0xea, 0x08, 0x25, 0xf3, 0x10,
|
||||
0x3a, 0xb8, 0x92, 0xdc, 0x38, 0xc3, 0x34, 0xc9, 0x47, 0x67, 0x6f, 0xbb, 0x6a, 0xa3, 0xb3, 0xd8,
|
||||
0x51, 0x8d, 0x70, 0x5b, 0x9c, 0x8f, 0x59, 0x4a, 0xa3, 0x5a, 0x7c, 0x7b, 0x1b, 0x8e, 0x0e, 0xda,
|
||||
0xbf, 0x2d, 0x62, 0x7d, 0xce, 0xdc, 0x29, 0xbb, 0x45, 0xac, 0x5f, 0x01, 0x90, 0x69, 0xba, 0x54,
|
||||
0xa8, 0x8a, 0xcd, 0x82, 0x91, 0xfe, 0xd3, 0x80, 0xbb, 0xe2, 0x90, 0x5e, 0x3c, 0x0d, 0x32, 0xe6,
|
||||
0xdf, 0x22, 0xd6, 0x2f, 0xa0, 0x75, 0x3e, 0x5e, 0x2a, 0x4e, 0xa9, 0x8f, 0x1d, 0x91, 0x6e, 0xc9,
|
||||
0xbc, 0xbe, 0x68, 0x47, 0x14, 0xa3, 0x6a, 0x9e, 0x8d, 0x79, 0x79, 0xfe, 0xdd, 0x80, 0x4d, 0x71,
|
||||
0xca, 0x8f, 0x03, 0x6f, 0xf4, 0x91, 0xd3, 0xfc, 0x0a, 0x40, 0x78, 0x5d, 0x2a, 0x4b, 0xc5, 0x66,
|
||||
0xc1, 0x24, 0xff, 0x63, 0xc0, 0x83, 0xbc, 0x99, 0x83, 0xe4, 0xe8, 0xd2, 0x8d, 0x87, 0x32, 0x53,
|
||||
0xdc, 0xf1, 0x24, 0xd2, 0x05, 0xc6, 0x10, 0x17, 0xf6, 0x12, 0xf9, 0x1a, 0xb9, 0xfd, 0x10, 0xda,
|
||||
0x27, 0x41, 0xec, 0x12, 0xb8, 0x70, 0x6a, 0xa5, 0x09, 0xae, 0x9a, 0xb3, 0x89, 0xfc, 0xf6, 0xc8,
|
||||
0x0d, 0x9e, 0xcb, 0x65, 0x7f, 0x9a, 0x0b, 0xf4, 0xc7, 0xfe, 0x87, 0x01, 0x9b, 0xf4, 0x24, 0xbe,
|
||||
0x5d, 0xb7, 0x69, 0xf1, 0x53, 0x58, 0x21, 0xe3, 0x64, 0xf1, 0x3a, 0xe4, 0x06, 0xd8, 0x64, 0x39,
|
||||
0xf2, 0x78, 0xd3, 0x13, 0xbf, 0x49, 0x2c, 0xd0, 0xe4, 0xd2, 0x66, 0xc1, 0x26, 0xff, 0xca, 0x80,
|
||||
0xfb, 0x45, 0xe0, 0x6a, 0x8f, 0xf1, 0x6f, 0x06, 0x29, 0x96, 0x4d, 0x56, 0xa1, 0xb2, 0x18, 0xb5,
|
||||
0xe5, 0xf8, 0x5e, 0x5f, 0x8e, 0x13, 0xf6, 0x2f, 0x0d, 0x78, 0xe8, 0x30, 0x8f, 0x05, 0x53, 0x86,
|
||||
0x5f, 0xe3, 0x83, 0xf1, 0x38, 0x94, 0xb7, 0x9b, 0x5b, 0xf4, 0xe4, 0x09, 0xb4, 0xe5, 0x01, 0x71,
|
||||
0x26, 0x03, 0xbf, 0xf6, 0x56, 0x53, 0x6a, 0x8b, 0x3f, 0x14, 0x5d, 0x5e, 0x5c, 0xb4, 0xa4, 0x64,
|
||||
0xff, 0xd1, 0x00, 0x4b, 0x09, 0xea, 0x22, 0x4d, 0x3c, 0xc6, 0xf9, 0x47, 0x5e, 0x0a, 0x14, 0x1c,
|
||||
0x9f, 0x84, 0x99, 0xbc, 0xde, 0x48, 0x49, 0x09, 0xba, 0xa1, 0x05, 0xfd, 0x07, 0x03, 0x40, 0xdc,
|
||||
0x42, 0x68, 0x6e, 0xf6, 0xa1, 0x4d, 0xd7, 0x37, 0xf2, 0x2d, 0x42, 0x7d, 0x50, 0xf9, 0x59, 0x40,
|
||||
0x14, 0xa4, 0xd0, 0x13, 0x67, 0xd3, 0xb5, 0xa6, 0xf8, 0xd9, 0x06, 0xa5, 0x99, 0x2b, 0x60, 0xbd,
|
||||
0x72, 0x05, 0xfc, 0x5e, 0xee, 0x9a, 0xbc, 0x35, 0xae, 0xf3, 0xa6, 0x28, 0xda, 0x23, 0xb8, 0x2b,
|
||||
0x24, 0xa5, 0xd8, 0x78, 0x7f, 0x38, 0xf0, 0xc5, 0xdf, 0x37, 0x06, 0x39, 0xca, 0x45, 0xbc, 0x3b,
|
||||
0x1f, 0xf8, 0x7e, 0x3f, 0x99, 0xa4, 0x5e, 0x71, 0x77, 0x2e, 0x00, 0x8c, 0xf1, 0xc0, 0xf7, 0x7f,
|
||||
0x92, 0xa4, 0x7e, 0x10, 0x0f, 0x65, 0x43, 0x15, 0xc4, 0xfe, 0xb7, 0x01, 0x0f, 0x2b, 0xde, 0x0e,
|
||||
0x7c, 0x5f, 0xb6, 0x75, 0xbf, 0x68, 0x94, 0x71, 0x33, 0x87, 0xca, 0xc5, 0xdd, 0x51, 0x0e, 0x93,
|
||||
0x2d, 0x7e, 0xa4, 0x59, 0x56, 0x5c, 0x3a, 0xaa, 0x89, 0xf9, 0x7d, 0x58, 0x3d, 0x1f, 0x6b, 0x8b,
|
||||
0xff, 0x5a, 0xc7, 0x85, 0xf2, 0x82, 0xcb, 0xe0, 0xaf, 0x06, 0x3c, 0xaa, 0x44, 0xa0, 0xf3, 0xf9,
|
||||
0x56, 0x89, 0xab, 0x61, 0xd7, 0x96, 0x09, 0x9b, 0x7e, 0x56, 0x50, 0x59, 0x2d, 0xa4, 0x05, 0xd3,
|
||||
0xb9, 0x84, 0x0d, 0x99, 0x4d, 0xd1, 0xb7, 0xc7, 0xd0, 0x12, 0x90, 0x0c, 0xff, 0x93, 0x39, 0xd5,
|
||||
0x17, 0xa1, 0x8b, 0xe7, 0xaa, 0xa7, 0xda, 0x3c, 0x4f, 0x3f, 0xcb, 0xa9, 0xd9, 0x65, 0x21, 0xcb,
|
||||
0x3e, 0xac, 0xaf, 0x5f, 0x1b, 0xd0, 0x3e, 0x0c, 0x5d, 0x6f, 0x44, 0x83, 0xfb, 0xa4, 0x3a, 0xb8,
|
||||
0xd7, 0xef, 0xb3, 0x72, 0x7c, 0x6f, 0x1a, 0xd3, 0x27, 0xd2, 0x8f, 0x32, 0xa5, 0xd7, 0x1f, 0x5d,
|
||||
0x68, 0xdb, 0x3e, 0xac, 0x93, 0x50, 0x16, 0xfe, 0x73, 0x68, 0x12, 0x32, 0x77, 0x0f, 0x16, 0xe9,
|
||||
0x38, 0x42, 0x69, 0xc1, 0x4a, 0x0c, 0x60, 0x93, 0xd4, 0xd5, 0xa2, 0x7f, 0x08, 0x3f, 0xbf, 0x31,
|
||||
0xe0, 0x41, 0xd9, 0x2e, 0xf5, 0x23, 0xb9, 0x74, 0x8b, 0xf7, 0x67, 0x16, 0xfc, 0x42, 0xe3, 0xb3,
|
||||
0xd8, 0xdd, 0xfb, 0xf7, 0x06, 0xdc, 0xeb, 0xb3, 0x70, 0x80, 0xa6, 0xaf, 0xc6, 0x7e, 0x71, 0x67,
|
||||
0x79, 0x02, 0x6b, 0x08, 0xe7, 0xa7, 0x5e, 0xbf, 0xdd, 0x35, 0xd5, 0x0f, 0x18, 0xed, 0xe1, 0xd6,
|
||||
0x4f, 0xef, 0xef, 0x3e, 0x16, 0xff, 0xe5, 0xf9, 0x52, 0x39, 0xf4, 0x4d, 0x8b, 0xfe, 0xdf, 0xb3,
|
||||
0xff, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x45, 0x72, 0x9b, 0x6e, 0x02, 0x1a, 0x00, 0x00,
|
||||
var fileDescriptor_ws_ca4877c90b77c1e9 = []byte{
|
||||
// 1841 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0xdd, 0x6f, 0xdc, 0x5a,
|
||||
0x11, 0x97, 0xf7, 0x2b, 0xd9, 0xd9, 0x34, 0x49, 0xdd, 0x8f, 0x6b, 0xca, 0x55, 0x15, 0x2c, 0x84,
|
||||
0xa2, 0xab, 0xab, 0x5c, 0x91, 0x08, 0x71, 0x5b, 0x04, 0xdc, 0x24, 0x9b, 0x44, 0x5b, 0x9a, 0x6e,
|
||||
0xe4, 0x6d, 0xc5, 0x63, 0xe5, 0xda, 0x67, 0x37, 0x66, 0xfd, 0xb1, 0xf1, 0xf1, 0x6e, 0xdb, 0xbf,
|
||||
0x04, 0x09, 0x09, 0x09, 0xc4, 0x03, 0x42, 0xbc, 0x20, 0x84, 0xf8, 0x23, 0x10, 0xe2, 0x8f, 0x40,
|
||||
0xf0, 0xc8, 0x0b, 0xaf, 0x08, 0x09, 0xcd, 0x9c, 0x63, 0xfb, 0x9c, 0xf5, 0x92, 0xec, 0xe6, 0xaa,
|
||||
0x7d, 0xf3, 0xfc, 0x3c, 0x73, 0xe6, 0xeb, 0x37, 0xe3, 0x93, 0x0d, 0x6c, 0x71, 0x7f, 0xfc, 0xfa,
|
||||
0x2d, 0xff, 0xe2, 0x2d, 0xdf, 0x9b, 0xa4, 0x49, 0x96, 0x98, 0x9d, 0x64, 0xc2, 0xe2, 0xd7, 0x41,
|
||||
0xf4, 0x9a, 0xfb, 0x63, 0xfb, 0x2f, 0x06, 0x58, 0x17, 0xd3, 0x30, 0x3c, 0x67, 0x9c, 0xbb, 0x23,
|
||||
0x76, 0xf4, 0x7e, 0xc0, 0xae, 0x9e, 0x07, 0x3c, 0x73, 0x18, 0x9f, 0x98, 0x0f, 0xa1, 0x75, 0xee,
|
||||
0xbe, 0x1b, 0xb0, 0x2b, 0xcb, 0xd8, 0x31, 0x76, 0xeb, 0x8e, 0x94, 0x08, 0x0f, 0x62, 0xc4, 0x6b,
|
||||
0x12, 0x27, 0xc9, 0xfc, 0x31, 0xdc, 0x19, 0x04, 0xf1, 0x28, 0x64, 0xaf, 0x38, 0x4b, 0xcf, 0xf9,
|
||||
0xc8, 0xaa, 0xef, 0xd4, 0x77, 0x3b, 0xfb, 0xdf, 0xd8, 0x53, 0x3c, 0xee, 0x9d, 0xb9, 0xd9, 0x25,
|
||||
0x4b, 0x4f, 0x93, 0x34, 0x72, 0x33, 0x47, 0xd7, 0x37, 0x7f, 0x08, 0x1b, 0x67, 0x69, 0x32, 0x9d,
|
||||
0xe4, 0xf6, 0x8d, 0x9b, 0xec, 0x35, 0x75, 0xfb, 0x00, 0x3e, 0x59, 0x9c, 0xcb, 0x95, 0x69, 0xc1,
|
||||
0x1a, 0x17, 0x92, 0x65, 0xec, 0xd4, 0x77, 0xeb, 0x4e, 0x2e, 0xda, 0xf7, 0xc1, 0x3c, 0x63, 0xd9,
|
||||
0xb9, 0xfb, 0xee, 0x30, 0xf6, 0x45, 0x1e, 0x0e, 0xbb, 0xb2, 0x4f, 0xe0, 0x5e, 0x05, 0x15, 0x15,
|
||||
0x89, 0xb4, 0x8a, 0x44, 0x45, 0x45, 0x22, 0xad, 0x22, 0x42, 0xb2, 0x9f, 0xc1, 0x86, 0x1a, 0xaf,
|
||||
0xb9, 0x09, 0xb5, 0x5e, 0x97, 0x6c, 0xdb, 0x4e, 0xad, 0xd7, 0x35, 0x3f, 0x83, 0x06, 0xc5, 0x54,
|
||||
0xa3, 0x44, 0x1f, 0x6a, 0x89, 0x9e, 0xf3, 0x91, 0xcc, 0x92, 0x74, 0xec, 0xff, 0xd6, 0xa0, 0x5d,
|
||||
0x60, 0xe8, 0x71, 0xc0, 0x62, 0xbf, 0x38, 0x4d, 0x4a, 0x88, 0x3b, 0xcc, 0x9b, 0xf5, 0xba, 0x14,
|
||||
0x49, 0xdb, 0x91, 0x12, 0x16, 0x00, 0x8d, 0xd3, 0x24, 0xb2, 0xea, 0x3b, 0xc6, 0x6e, 0xd3, 0xc9,
|
||||
0x45, 0x73, 0x07, 0x3a, 0xc7, 0x49, 0x9c, 0xb1, 0x38, 0x7b, 0xf9, 0x7e, 0xc2, 0xac, 0x06, 0xbd,
|
||||
0x55, 0x21, 0xd4, 0x18, 0xb0, 0x74, 0x46, 0x45, 0xee, 0x75, 0xad, 0x26, 0x1d, 0xac, 0x42, 0x78,
|
||||
0xba, 0x34, 0xb0, 0x5a, 0xf4, 0x36, 0x17, 0xcd, 0x6d, 0xa8, 0x63, 0x59, 0xd6, 0xa8, 0x2c, 0xf8,
|
||||
0x68, 0x3e, 0x82, 0x75, 0x8c, 0xf5, 0x65, 0x10, 0x31, 0x6b, 0x9d, 0xe0, 0x42, 0x36, 0x3f, 0x83,
|
||||
0x6d, 0x7c, 0x66, 0xe9, 0x45, 0xe8, 0x66, 0xc3, 0x24, 0x8d, 0x7a, 0x5d, 0xab, 0x4d, 0x01, 0x55,
|
||||
0x70, 0xf3, 0x3b, 0xb0, 0x29, 0xb0, 0x17, 0x81, 0x37, 0x7e, 0xe1, 0x46, 0xcc, 0x02, 0x72, 0x3d,
|
||||
0x87, 0x9a, 0xdf, 0x86, 0x3b, 0x02, 0x39, 0x75, 0x3d, 0xf6, 0xca, 0x79, 0x6e, 0x75, 0x48, 0x4d,
|
||||
0x07, 0xa9, 0x0a, 0x61, 0xc0, 0xe2, 0x4c, 0xe4, 0xb8, 0x21, 0x72, 0x54, 0x20, 0xfb, 0x6f, 0x75,
|
||||
0xd8, 0x44, 0xa6, 0xa1, 0xdd, 0x39, 0x1f, 0x21, 0xab, 0x8e, 0x60, 0xad, 0x3f, 0xc9, 0x82, 0x24,
|
||||
0xe6, 0xc4, 0xaa, 0xce, 0xfe, 0xae, 0xd6, 0x41, 0x5d, 0x7b, 0x4f, 0xaa, 0x9e, 0xc4, 0x59, 0xfa,
|
||||
0xde, 0xc9, 0x0d, 0x17, 0xa4, 0x51, 0x5b, 0x2e, 0x8d, 0xfa, 0xa2, 0x34, 0x1e, 0x03, 0x28, 0xa5,
|
||||
0x13, 0xbd, 0x54, 0x10, 0xd1, 0x4a, 0xce, 0x83, 0x24, 0xa6, 0x66, 0x37, 0x45, 0xb3, 0x15, 0x48,
|
||||
0x25, 0x4a, 0xeb, 0x5a, 0xa2, 0xac, 0x55, 0x89, 0x52, 0x92, 0x6f, 0x5d, 0x23, 0xdf, 0xa7, 0xd0,
|
||||
0x3e, 0x4d, 0x52, 0x8f, 0x11, 0xd7, 0xdb, 0x3b, 0xf5, 0xdd, 0xb6, 0x53, 0x02, 0x2a, 0x79, 0x40,
|
||||
0x27, 0xcf, 0x5c, 0x53, 0x3a, 0x95, 0xa6, 0x3c, 0x7a, 0x0a, 0x1b, 0x6a, 0x59, 0x91, 0x6e, 0x63,
|
||||
0xf6, 0x5e, 0xce, 0x04, 0x3e, 0x9a, 0xf7, 0xa1, 0x39, 0x73, 0xc3, 0xa9, 0x28, 0x6b, 0xd3, 0x11,
|
||||
0xc2, 0xd3, 0xda, 0x97, 0x86, 0x7d, 0x05, 0x5b, 0x5a, 0x87, 0xf8, 0x64, 0x9e, 0xe9, 0x46, 0x95,
|
||||
0xe9, 0x73, 0x21, 0xd5, 0x2a, 0x21, 0x21, 0xbf, 0x79, 0xce, 0xef, 0xba, 0xe0, 0x77, 0x2e, 0xdb,
|
||||
0x7f, 0x6e, 0x52, 0x75, 0xbb, 0x6e, 0xe6, 0x62, 0xb1, 0xb8, 0x36, 0xc1, 0xbc, 0x98, 0xe0, 0x54,
|
||||
0x9b, 0xe0, 0xb4, 0x98, 0xe0, 0x11, 0x6e, 0xbb, 0x5e, 0x57, 0xb6, 0x3e, 0x17, 0x31, 0x26, 0x4f,
|
||||
0x89, 0xa9, 0x21, 0x62, 0x52, 0x20, 0xd4, 0xe0, 0xd5, 0x09, 0x56, 0x20, 0x9c, 0x3c, 0x3e, 0x3f,
|
||||
0x79, 0xa2, 0xff, 0x15, 0x1c, 0x29, 0xcb, 0x75, 0xca, 0xae, 0x09, 0xca, 0xf2, 0x0a, 0x65, 0xb9,
|
||||
0x46, 0x59, 0xc1, 0x0a, 0x1d, 0x14, 0xb1, 0x95, 0x94, 0x14, 0xe3, 0xae, 0x42, 0x98, 0x79, 0x24,
|
||||
0x29, 0x09, 0x82, 0x92, 0x51, 0x49, 0x49, 0x4f, 0xa1, 0x64, 0x47, 0xd8, 0x2a, 0x10, 0xda, 0x4a,
|
||||
0x91, 0x66, 0x7a, 0xc3, 0xc9, 0x45, 0x24, 0xe5, 0xb0, 0x20, 0xe5, 0x1d, 0x41, 0xca, 0x02, 0x40,
|
||||
0x22, 0x71, 0x76, 0x65, 0x6d, 0x8a, 0xbd, 0xc5, 0xc5, 0xde, 0x2a, 0xfa, 0xba, 0xa5, 0xf7, 0x15,
|
||||
0xc7, 0xce, 0x4b, 0x99, 0x9b, 0x31, 0x7a, 0xbb, 0x4d, 0x6f, 0x15, 0xc4, 0xfc, 0x41, 0xb9, 0x28,
|
||||
0xee, 0xd2, 0xa2, 0xf8, 0xd6, 0xfc, 0xaa, 0x47, 0x4a, 0xfc, 0x9f, 0x0d, 0x71, 0x0a, 0x5b, 0xc9,
|
||||
0x70, 0x18, 0x06, 0x31, 0xbb, 0x98, 0xf2, 0xcb, 0x5e, 0x3c, 0x4c, 0x2c, 0x73, 0xc7, 0xd8, 0xed,
|
||||
0xec, 0x7f, 0xaa, 0x1d, 0xd2, 0xd7, 0x75, 0x9c, 0x79, 0xa3, 0x55, 0x67, 0x65, 0x5d, 0x9d, 0x95,
|
||||
0x9f, 0x1b, 0xb0, 0x35, 0xe7, 0x00, 0xb5, 0x5f, 0x06, 0x59, 0xc8, 0xe4, 0x09, 0x42, 0x30, 0x4d,
|
||||
0x68, 0x74, 0x19, 0xf7, 0x24, 0x79, 0xe9, 0x19, 0x3d, 0x9d, 0xbc, 0xcb, 0x24, 0x6d, 0xf1, 0xd1,
|
||||
0xb4, 0x61, 0x23, 0xe8, 0x0f, 0xf0, 0xa8, 0x41, 0x32, 0x8d, 0x7d, 0xc9, 0x59, 0x0d, 0x43, 0xfa,
|
||||
0x04, 0xfd, 0xc1, 0x91, 0xeb, 0x8f, 0xd8, 0x71, 0x32, 0x8d, 0x33, 0xa2, 0xed, 0xba, 0xa3, 0x83,
|
||||
0xf6, 0x2f, 0x6a, 0xd0, 0xa6, 0x5b, 0x00, 0xc5, 0x64, 0xc1, 0xda, 0x99, 0x1c, 0x12, 0x11, 0x55,
|
||||
0x2e, 0x62, 0xbb, 0xe9, 0x51, 0x59, 0xb1, 0x25, 0x80, 0xf1, 0xbc, 0x48, 0xb2, 0x60, 0x18, 0x78,
|
||||
0x2e, 0x56, 0x48, 0x86, 0xaa, 0x61, 0xa8, 0xd3, 0x8b, 0xb3, 0x34, 0xf1, 0xa7, 0x1e, 0xe9, 0xc8,
|
||||
0x98, 0x55, 0x0c, 0xfd, 0x13, 0xaf, 0xd3, 0x50, 0x0e, 0x59, 0x2e, 0x9a, 0xdf, 0x85, 0x66, 0xff,
|
||||
0x6d, 0xcc, 0x52, 0x9a, 0xaa, 0xce, 0xfe, 0x37, 0xb5, 0xde, 0x5d, 0x4c, 0xdf, 0x84, 0x81, 0x87,
|
||||
0xdb, 0x88, 0x5a, 0x27, 0x34, 0x91, 0x55, 0xc7, 0x25, 0xab, 0x70, 0xc6, 0x1a, 0x8e, 0x82, 0x20,
|
||||
0xfb, 0xcf, 0x59, 0xf4, 0x86, 0xa5, 0xa2, 0x3c, 0x38, 0x5d, 0x77, 0x1c, 0x15, 0xb2, 0xff, 0x65,
|
||||
0xc0, 0x3d, 0x4a, 0x52, 0x80, 0xa7, 0xd3, 0x30, 0xbc, 0xa1, 0x4c, 0x0f, 0xa1, 0x45, 0x61, 0x14,
|
||||
0xdb, 0x47, 0x48, 0xe6, 0x1e, 0x98, 0x87, 0x7e, 0x14, 0xc4, 0x01, 0xcf, 0x52, 0x37, 0x4b, 0xd2,
|
||||
0xe7, 0x6c, 0xc6, 0x42, 0x79, 0x95, 0x58, 0xf0, 0x06, 0xa7, 0xe5, 0x59, 0x12, 0xc4, 0x14, 0x79,
|
||||
0x83, 0x22, 0x2f, 0x64, 0x7c, 0x57, 0x6c, 0x0e, 0x51, 0xa5, 0x42, 0x56, 0x0b, 0xd8, 0xd2, 0x0b,
|
||||
0x68, 0xc3, 0xc6, 0x69, 0x1a, 0xb0, 0xd8, 0x77, 0x58, 0xe4, 0xa6, 0x63, 0xb9, 0x73, 0x34, 0xcc,
|
||||
0xfe, 0x93, 0x01, 0xeb, 0x79, 0x15, 0x95, 0x54, 0x0c, 0x2d, 0x15, 0xe9, 0x3e, 0x2e, 0x89, 0x50,
|
||||
0xc8, 0xaa, 0xfb, 0xba, 0xee, 0xfe, 0x21, 0xb4, 0xce, 0x68, 0x6f, 0xc9, 0xaf, 0xaa, 0x94, 0xe8,
|
||||
0x32, 0x9c, 0xbc, 0x09, 0xc2, 0x3c, 0x15, 0x29, 0xe1, 0x74, 0x1c, 0x05, 0x69, 0x76, 0x29, 0xd3,
|
||||
0x10, 0x02, 0xa2, 0x27, 0x91, 0x1b, 0x84, 0x32, 0x7a, 0x21, 0xd8, 0x33, 0xd8, 0xd4, 0x19, 0xf0,
|
||||
0x71, 0x62, 0xb7, 0xbb, 0xb0, 0xfe, 0x32, 0x98, 0xf0, 0xe3, 0x24, 0x8a, 0x50, 0xa7, 0xcb, 0x32,
|
||||
0x0c, 0xcd, 0xa0, 0x3d, 0x29, 0x25, 0x24, 0x59, 0x97, 0x0d, 0xdd, 0x69, 0x98, 0xa1, 0x6a, 0xfe,
|
||||
0xc1, 0x53, 0x20, 0xfb, 0x77, 0x06, 0x6c, 0x09, 0x7e, 0x9d, 0xc4, 0x19, 0x4b, 0x11, 0x33, 0x3f,
|
||||
0x87, 0x26, 0x31, 0x8a, 0x0e, 0x9b, 0xbf, 0xd9, 0x16, 0xe3, 0xea, 0x08, 0x25, 0xf3, 0x08, 0x3a,
|
||||
0xb8, 0x92, 0xdc, 0x38, 0xc3, 0x34, 0xc9, 0x47, 0x67, 0x7f, 0xa7, 0x6a, 0xa3, 0xb3, 0xd8, 0x51,
|
||||
0x8d, 0x70, 0x5b, 0xf4, 0x27, 0x2c, 0xa5, 0x51, 0x2d, 0xbe, 0xbd, 0x0d, 0x47, 0x07, 0xed, 0xdf,
|
||||
0x16, 0xb1, 0x3e, 0x67, 0xee, 0x8c, 0xdd, 0x22, 0xd6, 0xaf, 0x00, 0xc8, 0x34, 0x5d, 0x29, 0x54,
|
||||
0xc5, 0x66, 0xc9, 0x48, 0xff, 0x69, 0xc0, 0x5d, 0x71, 0x48, 0x2f, 0x9e, 0x05, 0x19, 0xf3, 0x6f,
|
||||
0x11, 0xeb, 0x97, 0xd0, 0xea, 0x4f, 0x56, 0x8a, 0x53, 0xea, 0x63, 0x47, 0xa4, 0x5b, 0x32, 0xaf,
|
||||
0x2f, 0xdb, 0x11, 0xc5, 0xa8, 0x9a, 0x67, 0x63, 0x51, 0x9e, 0x7f, 0x37, 0x60, 0x5b, 0x9c, 0xf2,
|
||||
0x93, 0xc0, 0x1b, 0x7f, 0xe4, 0x34, 0xbf, 0x02, 0x10, 0x5e, 0x57, 0xca, 0x52, 0xb1, 0x59, 0x32,
|
||||
0xc9, 0xff, 0x18, 0xf0, 0x20, 0x6f, 0xe6, 0x30, 0x39, 0xbe, 0x74, 0xe3, 0x91, 0xcc, 0x14, 0x77,
|
||||
0x3c, 0x89, 0x74, 0x81, 0x31, 0xc4, 0x85, 0xbd, 0x44, 0xbe, 0x46, 0x6e, 0x3f, 0x82, 0xf6, 0x69,
|
||||
0x10, 0xbb, 0x04, 0x2e, 0x9d, 0x5a, 0x69, 0x82, 0xab, 0xe6, 0x7c, 0x2a, 0xbf, 0x3d, 0x72, 0x83,
|
||||
0xe7, 0x72, 0xd9, 0x9f, 0xe6, 0x12, 0xfd, 0xb1, 0xff, 0x61, 0xc0, 0x36, 0x3d, 0x89, 0x6f, 0xd7,
|
||||
0x6d, 0x5a, 0xfc, 0x14, 0xd6, 0xc8, 0x38, 0x59, 0xbe, 0x0e, 0xb9, 0x01, 0x36, 0x59, 0x8e, 0x3c,
|
||||
0xde, 0xf4, 0xc4, 0x6f, 0x12, 0x4b, 0x34, 0xb9, 0xb4, 0x59, 0xb2, 0xc9, 0xbf, 0x32, 0xe0, 0x7e,
|
||||
0x11, 0xb8, 0xda, 0x63, 0xfc, 0x9b, 0x41, 0x8a, 0x65, 0x93, 0x55, 0xa8, 0x2c, 0x46, 0x6d, 0x35,
|
||||
0xbe, 0xd7, 0x57, 0xe3, 0x84, 0xfd, 0x4b, 0x03, 0x1e, 0x39, 0xcc, 0x63, 0xc1, 0x8c, 0xe1, 0xd7,
|
||||
0xf8, 0x70, 0x32, 0x09, 0xe5, 0xed, 0xe6, 0x16, 0x3d, 0x79, 0x02, 0x6d, 0x79, 0x40, 0x9c, 0xc9,
|
||||
0xc0, 0xaf, 0xbd, 0xd5, 0x94, 0xda, 0xe2, 0x0f, 0x45, 0x97, 0x17, 0x17, 0x2d, 0x29, 0xd9, 0x7f,
|
||||
0x34, 0xc0, 0x52, 0x82, 0xba, 0x48, 0x13, 0x8f, 0x71, 0xfe, 0x91, 0x97, 0x02, 0x05, 0xc7, 0xa7,
|
||||
0x61, 0x26, 0xaf, 0x37, 0x52, 0x52, 0x82, 0x6e, 0x68, 0x41, 0xff, 0xc1, 0x00, 0x10, 0xb7, 0x10,
|
||||
0x9a, 0x9b, 0x03, 0x68, 0xd3, 0xf5, 0x8d, 0x7c, 0x8b, 0x50, 0x1f, 0x54, 0x7e, 0x16, 0x10, 0x05,
|
||||
0x29, 0xf4, 0xc4, 0xd9, 0x74, 0xad, 0x29, 0x7e, 0xb6, 0x41, 0x69, 0xee, 0x0a, 0x58, 0xaf, 0x5c,
|
||||
0x01, 0xbf, 0x97, 0xbb, 0x26, 0x6f, 0x8d, 0xeb, 0xbc, 0x29, 0x8a, 0xf6, 0x18, 0xee, 0x0a, 0x49,
|
||||
0x29, 0x36, 0xde, 0x1f, 0x0e, 0x7d, 0xf1, 0xf7, 0x8d, 0x41, 0x8e, 0x72, 0x11, 0xef, 0xce, 0x87,
|
||||
0xbe, 0x3f, 0x48, 0xa6, 0xa9, 0x57, 0xdc, 0x9d, 0x0b, 0x00, 0x63, 0x3c, 0xf4, 0xfd, 0x9f, 0x26,
|
||||
0xa9, 0x1f, 0xc4, 0x23, 0xd9, 0x50, 0x05, 0xb1, 0xff, 0x6d, 0xc0, 0xa3, 0x8a, 0xb7, 0x43, 0xdf,
|
||||
0x97, 0x6d, 0x3d, 0x28, 0x1a, 0x65, 0xdc, 0xcc, 0xa1, 0x72, 0x71, 0x77, 0x94, 0xc3, 0x64, 0x8b,
|
||||
0x1f, 0x6b, 0x96, 0x15, 0x97, 0x8e, 0x6a, 0x62, 0x7e, 0x1f, 0xd6, 0xfb, 0x13, 0x6d, 0xf1, 0x5f,
|
||||
0xeb, 0xb8, 0x50, 0x5e, 0x72, 0x19, 0xfc, 0xd5, 0x80, 0xc7, 0x95, 0x08, 0x74, 0x3e, 0xdf, 0x2a,
|
||||
0x71, 0x35, 0xec, 0xda, 0x2a, 0x61, 0xd3, 0xcf, 0x0a, 0x2a, 0xab, 0x85, 0xb4, 0x64, 0x3a, 0x97,
|
||||
0xb0, 0x25, 0xb3, 0x29, 0xfa, 0xf6, 0x05, 0xb4, 0x04, 0x24, 0xc3, 0xff, 0x64, 0x41, 0xf5, 0x45,
|
||||
0xe8, 0xe2, 0xb9, 0xea, 0xa9, 0xb6, 0xc8, 0xd3, 0xcf, 0x72, 0x6a, 0x76, 0x59, 0xc8, 0xb2, 0x0f,
|
||||
0xeb, 0xeb, 0xd7, 0x06, 0xb4, 0x8f, 0x42, 0xd7, 0x1b, 0xd3, 0xe0, 0x3e, 0xa9, 0x0e, 0xee, 0xf5,
|
||||
0xfb, 0xac, 0x1c, 0xdf, 0x9b, 0xc6, 0xf4, 0x89, 0xf4, 0xa3, 0x4c, 0xe9, 0xf5, 0x47, 0x17, 0xda,
|
||||
0xb6, 0x0f, 0x9b, 0x24, 0x94, 0x85, 0xff, 0x1c, 0x9a, 0x84, 0x2c, 0xdc, 0x83, 0x45, 0x3a, 0x8e,
|
||||
0x50, 0x5a, 0xb2, 0x12, 0x43, 0xd8, 0x26, 0x75, 0xb5, 0xe8, 0x1f, 0xc2, 0xcf, 0x6f, 0x0c, 0x78,
|
||||
0x50, 0xb6, 0x4b, 0xfd, 0x48, 0xae, 0xdc, 0xe2, 0x83, 0xb9, 0x05, 0xbf, 0xd4, 0xf8, 0x2c, 0x77,
|
||||
0xf7, 0xfe, 0xbd, 0x01, 0xf7, 0x06, 0x2c, 0x1c, 0xa2, 0xe9, 0xab, 0x89, 0x5f, 0xdc, 0x59, 0x9e,
|
||||
0xc0, 0x06, 0xc2, 0xf9, 0xa9, 0xd7, 0x6f, 0x77, 0x4d, 0xf5, 0x03, 0x46, 0xfb, 0xa6, 0x45, 0xff,
|
||||
0xd7, 0x39, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x94, 0x7a, 0xcf, 0xea, 0x19, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package open_im_sdk;//The package name to which the proto file belongs
|
||||
option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk
|
||||
//option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk
|
||||
|
||||
|
||||
message PullMessageBySeqListResp {
|
||||
@ -110,6 +110,7 @@ message GroupInfo{
|
||||
PublicUserInfo Owner = 6;
|
||||
uint64 CreateTime = 7;
|
||||
uint32 MemberCount = 8;
|
||||
string Ext = 9;
|
||||
}
|
||||
|
||||
|
||||
@ -133,6 +134,7 @@ message UserInfo{
|
||||
string Mobile = 5;
|
||||
string Birth = 6;
|
||||
string Email = 7;
|
||||
string Ext = 8;
|
||||
}
|
||||
|
||||
//No permissions required
|
||||
|
Loading…
x
Reference in New Issue
Block a user