multi terminal kick eachOther

This commit is contained in:
Gordon
2021-11-25 14:12:52 +08:00
parent 912ec51315
commit e7e3b6dd15
45 changed files with 553 additions and 464 deletions
+3 -3
View File
@@ -3,9 +3,9 @@ package apiChat
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
pbMsg "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -27,8 +27,8 @@ func UserGetSeq(c *gin.Context) {
}
token := c.Request.Header.Get("token")
if !utils.VerifyToken(token, params.SendID) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return
}
pbData := pbMsg.GetMaxAndMinSeqReq{}
+5 -5
View File
@@ -3,9 +3,9 @@ package apiChat
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/chat"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -30,8 +30,8 @@ func UserPullMsg(c *gin.Context) {
}
token := c.Request.Header.Get("token")
if !utils.VerifyToken(token, params.SendID) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return
}
pbData := pbChat.PullMessageReq{}
@@ -86,8 +86,8 @@ func UserPullMsgBySeqList(c *gin.Context) {
}
token := c.Request.Header.Get("token")
if !utils.VerifyToken(token, params.SendID) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return
}
pbData := pbChat.PullMessageBySeqListReq{}
@@ -3,9 +3,9 @@ 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"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -56,7 +56,7 @@ func GetGroupApplicationList(c *gin.Context) {
pbData := newUserRegisterReq(&params)
token := c.Request.Header.Get("token")
if claims, err := utils.ParseToken(token); err != nil {
if claims, err := token_verify.ParseToken(token); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
} else {
@@ -3,9 +3,9 @@ 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"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -63,7 +63,7 @@ func ApplicationGroupResponse(c *gin.Context) {
pbData := newGroupApplicationResponse(&params)
token := c.Request.Header.Get("token")
if claims, err := utils.ParseToken(token); err != nil {
if claims, err := token_verify.ParseToken(token); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
} else {
+2 -2
View File
@@ -3,9 +3,9 @@ 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"
"Open_IM/pkg/utils"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -41,7 +41,7 @@ func TransferGroupOwner(c *gin.Context) {
pbData := newTransferGroupOwnerReq(&params)
token := c.Request.Header.Get("token")
if claims, err := utils.ParseToken(token); err != nil {
if claims, err := token_verify.ParseToken(token); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
} else {
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
pbChat "Open_IM/pkg/proto/chat"
"Open_IM/pkg/utils"
@@ -125,7 +126,7 @@ func ManagementSendMsg(c *gin.Context) {
}
token := c.Request.Header.Get("token")
claims, err := utils.ParseToken(token)
claims, err := token_verify.ParseToken(token)
if err != nil {
log.NewError(params.OperationID, "parse token failed", err.Error())
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
@@ -2,6 +2,7 @@ package apiThird
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
log2 "Open_IM/pkg/common/log"
"github.com/gin-gonic/gin"
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
@@ -70,7 +71,7 @@ func TencentCloudStorageCredential(c *gin.Context) {
if err != nil {
log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error())
c.JSON(http.StatusOK, gin.H{
"errCode": config.ErrTencentCredential.ErrCode,
"errCode": constant.ErrTencentCredential.ErrCode,
"errMsg": err.Error(),
"bucket": "",
"region": "",