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

# Conflicts:
#	pkg/proto/sdk_ws/ws.pb.go
pull/131/head
Gordon 3 years ago
commit b76aa03d3a

@ -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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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())
}

@ -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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); 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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newUserRegisterReq(&params)
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(&params); 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(&params); 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(&params); 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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newUserRegisterReq(&params)
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(&params); 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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newGroupApplicationResponse(&params)
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(&params); 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(&params); 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(&params); 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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newTransferGroupOwnerReq(&params)
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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newGroupApplicationResponse(&params)
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(&params); 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(&params); 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(&params); 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(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
pbData := newTransferGroupOwnerReq(&params)
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
}

@ -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(req.FromUserID)
if err != nil {
log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), req.FromUserID)
return &pbGroup.CreateGroupResp{ErrCode: constant.ErrCreateGroup.ErrCode, ErrMsg: constant.ErrCreateGroup.ErrMsg}, nil
}
us, err := im_mysql_model.FindUserByUID(claims.UID)
//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.Error("", req.OperationID, "find userInfo failed", err.Error())
log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error())
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
}
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 user.Role == 1 {
log.NewError(req.OperationID, "only one owner, failed ", user)
continue
}
err = im_mysql_model.InsertIntoGroupMember(groupId, user.UserID, us.Nickname, us.FaceUrl, user.Role)
if err != nil {
log.ErrorByArgs("InsertIntoGroupMember failed", user.Uid, groupId, err.Error())
log.NewError(req.OperationID, "InsertIntoGroupMember failed ", groupId, user.UserID, us.Nickname, us.FaceUrl, user.Role)
}
err = db.DB.AddGroupMember(groupId, user.Uid)
err = db.DB.AddGroupMember(groupId, user.UserID)
if err != nil {
log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error())
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
}
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
resp.ErrCode = constant.ErrCreateGroup.ErrCode
resp.ErrMsg = constant.ErrCreateGroup.ErrMsg
return resp, 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
}
m := token_verify.IsMangerUserID(req.OpUserID)
in := false
if m {
in = true
}
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())
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)
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)
//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, "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 GetFriendsInfoReq{
string uid = 1;
message CommID{
string OpUserID = 1;
string OperationID = 2;
string Token = 3;
string ToUserID = 4;
string FromUserID = 5;
}
message GetFriendsInfoReq{
CommID CommID = 1;
}
message GetFriendInfoResp{
int32 errorCode = 1;
string errorMsg = 2;
GetFriendData Data = 3;
int32 ErrCode = 1;
string ErrMsg = 2;
FriendInfo Data = 3;
}
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 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;
CommID CommID = 1;
}
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;
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);
}

@ -19,12 +19,10 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type PullMessageBySeqListResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
MaxSeq int64 `protobuf:"varint,3,opt,name=maxSeq" json:"maxSeq,omitempty"`
MinSeq int64 `protobuf:"varint,4,opt,name=minSeq" json:"minSeq,omitempty"`
SingleUserMsg []*GatherFormat `protobuf:"bytes,5,rep,name=singleUserMsg" json:"singleUserMsg,omitempty"`
GroupUserMsg []*GatherFormat `protobuf:"bytes,6,rep,name=groupUserMsg" json:"groupUserMsg,omitempty"`
MaxSeq int64 `protobuf:"varint,1,opt,name=MaxSeq" json:"MaxSeq,omitempty"`
MinSeq int64 `protobuf:"varint,2,opt,name=MinSeq" json:"MinSeq,omitempty"`
SingleUserMsg []*GatherFormat `protobuf:"bytes,3,rep,name=SingleUserMsg" json:"SingleUserMsg,omitempty"`
GroupUserMsg []*GatherFormat `protobuf:"bytes,4,rep,name=GroupUserMsg" json:"GroupUserMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -34,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_9a4768ae4ab79d99, []int{0}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{0}
}
func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b)
@ -54,20 +52,6 @@ func (m *PullMessageBySeqListResp) XXX_DiscardUnknown() {
var xxx_messageInfo_PullMessageBySeqListResp proto.InternalMessageInfo
func (m *PullMessageBySeqListResp) GetErrCode() int32 {
if m != nil {
return m.ErrCode
}
return 0
}
func (m *PullMessageBySeqListResp) GetErrMsg() string {
if m != nil {
return m.ErrMsg
}
return ""
}
func (m *PullMessageBySeqListResp) GetMaxSeq() int64 {
if m != nil {
return m.MaxSeq
@ -97,9 +81,7 @@ func (m *PullMessageBySeqListResp) GetGroupUserMsg() []*GatherFormat {
}
type PullMessageBySeqListReq struct {
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
SeqList []int64 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"`
SeqList []int64 `protobuf:"varint,1,rep,packed,name=seqList" json:"seqList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -109,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_9a4768ae4ab79d99, []int{1}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{1}
}
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
@ -129,20 +111,6 @@ func (m *PullMessageBySeqListReq) XXX_DiscardUnknown() {
var xxx_messageInfo_PullMessageBySeqListReq proto.InternalMessageInfo
func (m *PullMessageBySeqListReq) GetUserID() string {
if m != nil {
return m.UserID
}
return ""
}
func (m *PullMessageBySeqListReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
func (m *PullMessageBySeqListReq) GetSeqList() []int64 {
if m != nil {
return m.SeqList
@ -160,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_9a4768ae4ab79d99, []int{2}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{2}
}
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@ -192,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_9a4768ae4ab79d99, []int{3}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{3}
}
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@ -230,17 +198,17 @@ type GatherFormat struct {
// @inject_tag: json:"id"
ID string `protobuf:"bytes,1,opt,name=ID" json:"id"`
// @inject_tag: json:"list"
List []*MsgData `protobuf:"bytes,2,rep,name=List" json:"list"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"list"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
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_9a4768ae4ab79d99, []int{4}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{4}
}
func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
@ -267,13 +235,269 @@ func (m *GatherFormat) GetID() string {
return ""
}
func (m *GatherFormat) GetList() []*MsgData {
func (m *GatherFormat) GetList() []*MsgFormat {
if m != nil {
return m.List
}
return nil
}
type MsgFormat struct {
// @inject_tag: json:"sendID"
SendID string `protobuf:"bytes,1,opt,name=SendID" json:"sendID"`
// @inject_tag: json:"recvID"
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"recvID"`
// @inject_tag: json:"msgFrom"
MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"msgFrom"`
// @inject_tag: json:"contentType"
ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"contentType"`
// @inject_tag: json:"serverMsgID"
ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"serverMsgID"`
// @inject_tag: json:"content"
Content string `protobuf:"bytes,6,opt,name=Content" json:"content"`
// @inject_tag: json:"seq"
Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"seq"`
// @inject_tag: json:"sendTime"
SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"sendTime"`
// @inject_tag: json:"senderPlatformID"
SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"senderPlatformID"`
// @inject_tag: json:"senderNickName"
SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"senderNickName"`
// @inject_tag: json:"senderFaceUrl"
SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"senderFaceUrl"`
// @inject_tag: json:"clientMsgID"
ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"clientMsgID"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
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_ca4877c90b77c1e9, []int{5}
}
func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
}
func (m *MsgFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MsgFormat.Marshal(b, m, deterministic)
}
func (dst *MsgFormat) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgFormat.Merge(dst, src)
}
func (m *MsgFormat) XXX_Size() int {
return xxx_messageInfo_MsgFormat.Size(m)
}
func (m *MsgFormat) XXX_DiscardUnknown() {
xxx_messageInfo_MsgFormat.DiscardUnknown(m)
}
var xxx_messageInfo_MsgFormat proto.InternalMessageInfo
func (m *MsgFormat) GetSendID() string {
if m != nil {
return m.SendID
}
return ""
}
func (m *MsgFormat) GetRecvID() string {
if m != nil {
return m.RecvID
}
return ""
}
func (m *MsgFormat) GetMsgFrom() int32 {
if m != nil {
return m.MsgFrom
}
return 0
}
func (m *MsgFormat) GetContentType() int32 {
if m != nil {
return m.ContentType
}
return 0
}
func (m *MsgFormat) GetServerMsgID() string {
if m != nil {
return m.ServerMsgID
}
return ""
}
func (m *MsgFormat) GetContent() string {
if m != nil {
return m.Content
}
return ""
}
func (m *MsgFormat) GetSeq() int64 {
if m != nil {
return m.Seq
}
return 0
}
func (m *MsgFormat) GetSendTime() int64 {
if m != nil {
return m.SendTime
}
return 0
}
func (m *MsgFormat) GetSenderPlatformID() int32 {
if m != nil {
return m.SenderPlatformID
}
return 0
}
func (m *MsgFormat) GetSenderNickName() string {
if m != nil {
return m.SenderNickName
}
return ""
}
func (m *MsgFormat) GetSenderFaceURL() string {
if m != nil {
return m.SenderFaceURL
}
return ""
}
func (m *MsgFormat) GetClientMsgID() string {
if m != nil {
return m.ClientMsgID
}
return ""
}
type UserSendMsgReq struct {
Options map[string]int32 `protobuf:"bytes,1,rep,name=Options" json:"Options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
SenderNickName string `protobuf:"bytes,2,opt,name=SenderNickName" json:"SenderNickName,omitempty"`
SenderFaceURL string `protobuf:"bytes,3,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"`
PlatformID int32 `protobuf:"varint,4,opt,name=PlatformID" json:"PlatformID,omitempty"`
SessionType int32 `protobuf:"varint,5,opt,name=SessionType" json:"SessionType,omitempty"`
MsgFrom int32 `protobuf:"varint,6,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
ContentType int32 `protobuf:"varint,7,opt,name=ContentType" json:"ContentType,omitempty"`
RecvID string `protobuf:"bytes,8,opt,name=RecvID" json:"RecvID,omitempty"`
ForceList []string `protobuf:"bytes,9,rep,name=ForceList" json:"ForceList,omitempty"`
Content string `protobuf:"bytes,10,opt,name=Content" json:"Content,omitempty"`
ClientMsgID string `protobuf:"bytes,11,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
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_ca4877c90b77c1e9, []int{6}
}
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b)
}
func (m *UserSendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UserSendMsgReq.Marshal(b, m, deterministic)
}
func (dst *UserSendMsgReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserSendMsgReq.Merge(dst, src)
}
func (m *UserSendMsgReq) XXX_Size() int {
return xxx_messageInfo_UserSendMsgReq.Size(m)
}
func (m *UserSendMsgReq) XXX_DiscardUnknown() {
xxx_messageInfo_UserSendMsgReq.DiscardUnknown(m)
}
var xxx_messageInfo_UserSendMsgReq proto.InternalMessageInfo
func (m *UserSendMsgReq) GetOptions() map[string]int32 {
if m != nil {
return m.Options
}
return nil
}
func (m *UserSendMsgReq) GetSenderNickName() string {
if m != nil {
return m.SenderNickName
}
return ""
}
func (m *UserSendMsgReq) GetSenderFaceURL() string {
if m != nil {
return m.SenderFaceURL
}
return ""
}
func (m *UserSendMsgReq) GetPlatformID() int32 {
if m != nil {
return m.PlatformID
}
return 0
}
func (m *UserSendMsgReq) GetSessionType() int32 {
if m != nil {
return m.SessionType
}
return 0
}
func (m *UserSendMsgReq) GetMsgFrom() int32 {
if m != nil {
return m.MsgFrom
}
return 0
}
func (m *UserSendMsgReq) GetContentType() int32 {
if m != nil {
return m.ContentType
}
return 0
}
func (m *UserSendMsgReq) GetRecvID() string {
if m != nil {
return m.RecvID
}
return ""
}
func (m *UserSendMsgReq) GetForceList() []string {
if m != nil {
return m.ForceList
}
return nil
}
func (m *UserSendMsgReq) GetContent() string {
if m != nil {
return m.Content
}
return ""
}
func (m *UserSendMsgReq) GetClientMsgID() string {
if m != nil {
return m.ClientMsgID
}
return ""
}
type UserSendMsgResp struct {
ServerMsgID string `protobuf:"bytes,1,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"`
ClientMsgID string `protobuf:"bytes,2,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"`
@ -287,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_9a4768ae4ab79d99, []int{5}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{7}
}
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b)
@ -356,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_9a4768ae4ab79d99, []int{6}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{8}
}
func (m *MsgData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgData.Unmarshal(m, b)
@ -517,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_9a4768ae4ab79d99, []int{7}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{9}
}
func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b)
@ -591,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_9a4768ae4ab79d99, []int{8}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{10}
}
func (m *GroupInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GroupInfo.Unmarshal(m, b)
@ -685,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_9a4768ae4ab79d99, []int{9}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{11}
}
func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b)
@ -772,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_9a4768ae4ab79d99, []int{10}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{12}
}
func (m *UserInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserInfo.Unmarshal(m, b)
@ -856,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_9a4768ae4ab79d99, []int{11}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{13}
}
func (m *PublicUserInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PublicUserInfo.Unmarshal(m, b)
@ -916,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_9a4768ae4ab79d99, []int{12}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{14}
}
func (m *TipsComm) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TipsComm.Unmarshal(m, b)
@ -965,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_9a4768ae4ab79d99, []int{13}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{15}
}
func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b)
@ -1020,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_9a4768ae4ab79d99, []int{14}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{16}
}
func (m *MemberLeaveTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MemberLeaveTips.Unmarshal(m, b)
@ -1075,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_9a4768ae4ab79d99, []int{15}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{17}
}
func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b)
@ -1137,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_9a4768ae4ab79d99, []int{16}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{18}
}
func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b)
@ -1200,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_9a4768ae4ab79d99, []int{17}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{19}
}
func (m *MemberInfoChangedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MemberInfoChangedTips.Unmarshal(m, b)
@ -1269,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_9a4768ae4ab79d99, []int{18}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{20}
}
func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b)
@ -1330,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_9a4768ae4ab79d99, []int{19}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{21}
}
func (m *GroupInfoChangedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GroupInfoChangedTips.Unmarshal(m, b)
@ -1384,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_9a4768ae4ab79d99, []int{20}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{22}
}
func (m *ReceiveJoinApplicationTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiveJoinApplicationTips.Unmarshal(m, b)
@ -1439,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_9a4768ae4ab79d99, []int{21}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{23}
}
func (m *ApplicationProcessedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ApplicationProcessedTips.Unmarshal(m, b)
@ -1502,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_9a4768ae4ab79d99, []int{22}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{24}
}
func (m *FriendInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendInfo.Unmarshal(m, b)
@ -1563,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_9a4768ae4ab79d99, []int{23}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{25}
}
func (m *FriendApplication) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendApplication.Unmarshal(m, b)
@ -1619,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_9a4768ae4ab79d99, []int{24}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{26}
}
func (m *FriendApplicationAddedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendApplicationAddedTips.Unmarshal(m, b)
@ -1682,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_9a4768ae4ab79d99, []int{25}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{27}
}
func (m *FriendApplicationProcessedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendApplicationProcessedTips.Unmarshal(m, b)
@ -1742,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_9a4768ae4ab79d99, []int{26}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{28}
}
func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b)
@ -1788,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_9a4768ae4ab79d99, []int{27}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{29}
}
func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b)
@ -1835,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_9a4768ae4ab79d99, []int{28}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{30}
}
func (m *BlackInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlackInfo.Unmarshal(m, b)
@ -1888,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_9a4768ae4ab79d99, []int{29}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{31}
}
func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b)
@ -1934,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_9a4768ae4ab79d99, []int{30}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{32}
}
func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b)
@ -1981,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_9a4768ae4ab79d99, []int{31}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{33}
}
func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b)
@ -2036,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_9a4768ae4ab79d99, []int{32}
return fileDescriptor_ws_ca4877c90b77c1e9, []int{34}
}
func (m *SelfInfoUpdatedTips) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SelfInfoUpdatedTips.Unmarshal(m, b)
@ -2083,6 +2307,9 @@ func init() {
proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "open_im_sdk.GetMaxAndMinSeqReq")
proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "open_im_sdk.GetMaxAndMinSeqResp")
proto.RegisterType((*GatherFormat)(nil), "open_im_sdk.GatherFormat")
proto.RegisterType((*MsgFormat)(nil), "open_im_sdk.MsgFormat")
proto.RegisterType((*UserSendMsgReq)(nil), "open_im_sdk.UserSendMsgReq")
proto.RegisterMapType((map[string]int32)(nil), "open_im_sdk.UserSendMsgReq.OptionsEntry")
proto.RegisterType((*UserSendMsgResp)(nil), "open_im_sdk.UserSendMsgResp")
proto.RegisterType((*MsgData)(nil), "open_im_sdk.MsgData")
proto.RegisterMapType((map[string]bool)(nil), "open_im_sdk.MsgData.OptionsEntry")
@ -2114,114 +2341,124 @@ func init() {
proto.RegisterType((*SelfInfoUpdatedTips)(nil), "open_im_sdk.SelfInfoUpdatedTips")
}
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_9a4768ae4ab79d99) }
var fileDescriptor_ws_9a4768ae4ab79d99 = []byte{
// 1690 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5b, 0x6f, 0x1b, 0x45,
0x14, 0xd6, 0xfa, 0x96, 0xf8, 0xd8, 0xb9, 0x74, 0x9b, 0xa6, 0x4b, 0xa8, 0x2a, 0xb3, 0x42, 0xc8,
0x42, 0x55, 0x2a, 0x12, 0x21, 0x9a, 0x22, 0xa0, 0x49, 0x9c, 0x04, 0x43, 0x5c, 0x47, 0xeb, 0x44,
0x3c, 0x56, 0x1b, 0xef, 0xd8, 0x59, 0xbc, 0x17, 0x67, 0x66, 0xed, 0x36, 0xbf, 0x04, 0x09, 0x09,
0x09, 0xc4, 0x03, 0x42, 0xbc, 0x20, 0x84, 0xf8, 0x15, 0xfc, 0x0a, 0x04, 0x8f, 0xbc, 0xf0, 0x0a,
0x0f, 0x68, 0xce, 0xcc, 0xee, 0xce, 0xc6, 0x21, 0x71, 0x82, 0xda, 0xb7, 0x3d, 0x9f, 0xcf, 0x99,
0xf3, 0x9d, 0xeb, 0xce, 0x1a, 0x16, 0x98, 0x33, 0x78, 0xf6, 0x9c, 0x3d, 0x7c, 0xce, 0x56, 0x87,
0x34, 0x8c, 0x42, 0xbd, 0x12, 0x0e, 0x49, 0xf0, 0xcc, 0xf5, 0x9f, 0x31, 0x67, 0x60, 0xfe, 0xa3,
0x81, 0x71, 0x30, 0xf2, 0xbc, 0x16, 0x61, 0xcc, 0xee, 0x93, 0xad, 0xb3, 0x0e, 0x39, 0xdd, 0x77,
0x59, 0x64, 0x11, 0x36, 0xd4, 0x0d, 0x98, 0x21, 0x94, 0x6e, 0x87, 0x0e, 0x31, 0xb4, 0x9a, 0x56,
0x2f, 0x5a, 0xb1, 0xa8, 0x2f, 0x43, 0x89, 0x50, 0xda, 0x62, 0x7d, 0x23, 0x57, 0xd3, 0xea, 0x65,
0x4b, 0x4a, 0x1c, 0xf7, 0xed, 0x17, 0x1d, 0x72, 0x6a, 0xe4, 0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bb, 0x67, 0x54, 0x5f, 0x22, 0xdb, 0xe3, 0x12, 0xfe, 0xe1, 0xbd, 0xfe, 0x6f, 0x00, 0x00, 0x00,
0xff, 0xff, 0x86, 0x83, 0x68, 0xe9, 0x03, 0x17, 0x00, 0x00,
func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_ca4877c90b77c1e9) }
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,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x89, 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,
}

@ -115,6 +115,7 @@ message GroupInfo{
PublicUserInfo Owner = 6;
uint64 CreateTime = 7;
uint32 MemberCount = 8;
string Ext = 9;
}
@ -138,6 +139,7 @@ message UserInfo{
string Mobile = 5;
string Birth = 6;
string Email = 7;
string Ext = 8;
}
//No permissions required

Loading…
Cancel
Save