mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 02:16:16 +08:00
Merge branch 'tuoyun' of github.com:OpenIMSDK/Open-IM-Server into tuoyun
This commit is contained in:
commit
a738c93163
@ -38,13 +38,13 @@ func UserRegister(c *gin.Context) {
|
|||||||
client := rpc.NewAuthClient(etcdConn)
|
client := rpc.NewAuthClient(etcdConn)
|
||||||
reply, err := client.UserRegister(context.Background(), req)
|
reply, err := client.UserRegister(context.Background(), req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMsg := req.OperationID + " " + "client.UserRegister failed " + err.Error() + req.String()
|
errMsg := req.OperationID + " " + "UserRegister failed " + err.Error() + req.String()
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if reply.CommonResp.ErrCode != 0 {
|
if reply.CommonResp.ErrCode != 0 {
|
||||||
errMsg := req.OperationID + " " + " client.UserRegister failed " + reply.CommonResp.ErrMsg + req.String()
|
errMsg := req.OperationID + " " + " UserRegister failed " + reply.CommonResp.ErrMsg + req.String()
|
||||||
log.NewError(req.OperationID, errMsg)
|
log.NewError(req.OperationID, errMsg)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
|
@ -26,10 +26,12 @@ func AddBlack(c *gin.Context) {
|
|||||||
req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}}
|
req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms)
|
utils.CopyStructFields(req.CommID, ¶ms)
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(params.OperationID, "AddBlacklist args ", req.String())
|
log.NewInfo(params.OperationID, "AddBlacklist args ", req.String())
|
||||||
@ -57,12 +59,15 @@ func ImportFriend(c *gin.Context) {
|
|||||||
req := &rpc.ImportFriendReq{}
|
req := &rpc.ImportFriendReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "ImportFriend args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -96,13 +101,17 @@ func AddFriend(c *gin.Context) {
|
|||||||
req := &rpc.AddFriendReq{CommID: &rpc.CommID{}}
|
req := &rpc.AddFriendReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
req.ReqMsg = params.ReqMsg
|
req.ReqMsg = params.ReqMsg
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
|
log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -130,13 +139,17 @@ func AddFriendResponse(c *gin.Context) {
|
|||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
req.HandleMsg = params.HandleMsg
|
req.HandleMsg = params.HandleMsg
|
||||||
req.HandleResult = params.Flag
|
req.HandleResult = params.Flag
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
|
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
|
||||||
|
|
||||||
@ -163,13 +176,17 @@ func DeleteFriend(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}}
|
req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -195,13 +212,17 @@ func GetBlacklist(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}}
|
req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms)
|
utils.CopyStructFields(req.CommID, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -234,13 +255,17 @@ func SetFriendRemark(c *gin.Context) {
|
|||||||
req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}}
|
req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
req.Remark = params.Remark
|
req.Remark = params.Remark
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -266,11 +291,14 @@ func RemoveBlack(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}}
|
req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,13 +325,17 @@ func IsFriend(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.IsFriendReq{CommID: &rpc.CommID{}}
|
req := &rpc.IsFriendReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -321,40 +353,6 @@ func IsFriend(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
//func GetFriendsInfo(c *gin.Context) {
|
|
||||||
// params := api.GetFriendsInfoReq{}
|
|
||||||
// if err := c.BindJSON(¶ms); err != nil {
|
|
||||||
// log.NewError("0", "BindJSON failed ", err.Error())
|
|
||||||
// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// req := &rpc.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 := rpc.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
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// resp := api.GetFriendsInfoResp{CommResp:api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
|
||||||
// utils.CopyStructFields(&resp, RpcResp)
|
|
||||||
// c.JSON(http.StatusOK, resp)
|
|
||||||
// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo api return ", resp)
|
|
||||||
//}
|
|
||||||
|
|
||||||
func GetFriendList(c *gin.Context) {
|
func GetFriendList(c *gin.Context) {
|
||||||
params := api.GetFriendListReq{}
|
params := api.GetFriendListReq{}
|
||||||
if err := c.BindJSON(¶ms); err != nil {
|
if err := c.BindJSON(¶ms); err != nil {
|
||||||
@ -364,13 +362,17 @@ func GetFriendList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}}
|
req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms)
|
utils.CopyStructFields(req.CommID, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -398,13 +400,17 @@ func GetFriendApplyList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}}
|
req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms)
|
utils.CopyStructFields(req.CommID, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
@ -432,13 +438,17 @@ func GetSelfFriendApplyList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}}
|
req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}}
|
||||||
utils.CopyStructFields(req.CommID, ¶ms)
|
utils.CopyStructFields(req.CommID, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
var errInfo string
|
||||||
|
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.CommID.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String())
|
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)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||||
|
@ -29,11 +29,14 @@ func KickGroupMember(c *gin.Context) {
|
|||||||
|
|
||||||
req := &rpc.KickGroupMemberReq{}
|
req := &rpc.KickGroupMemberReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +74,17 @@ func GetGroupMembersInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetGroupMembersInfoReq{}
|
req := &rpc.GetGroupMembersInfoReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
//c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
api.SetErrCodeMsg(c, http.StatusInternalServerError)
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -106,13 +112,17 @@ func GetGroupMemberList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetGroupMemberListReq{}
|
req := &rpc.GetGroupMemberListReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -141,13 +151,17 @@ func GetGroupAllMemberList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetGroupAllMemberReq{}
|
req := &rpc.GetGroupAllMemberReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -174,13 +188,17 @@ func GetJoinedGroupList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetJoinedGroupListReq{}
|
req := &rpc.GetJoinedGroupListReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String())
|
log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -207,13 +225,17 @@ func InviteUserToGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.InviteUserToGroupReq{}
|
req := &rpc.InviteUserToGroupReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
|
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -252,13 +274,17 @@ func CreateGroup(c *gin.Context) {
|
|||||||
for _, v := range params.MemberList {
|
for _, v := range params.MemberList {
|
||||||
req.InitMemberList = append(req.InitMemberList, &rpc.GroupAddMemberInfo{UserID: v.UserID, RoleLevel: v.RoleLevel})
|
req.InitMemberList = append(req.InitMemberList, &rpc.GroupAddMemberInfo{UserID: v.UserID, RoleLevel: v.RoleLevel})
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req.OwnerUserID = params.OwnerUserID
|
req.OwnerUserID = params.OwnerUserID
|
||||||
req.OperationID = params.OperationID
|
req.OperationID = params.OperationID
|
||||||
log.NewInfo(req.OperationID, "CreateGroup args ", req.String())
|
log.NewInfo(req.OperationID, "CreateGroup args ", req.String())
|
||||||
@ -355,13 +381,17 @@ func GetGroupsInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetGroupsInfoReq{}
|
req := &rpc.GetGroupsInfoReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
@ -388,13 +418,17 @@ func ApplicationGroupResponse(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GroupApplicationResponseReq{}
|
req := &rpc.GroupApplicationResponseReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String())
|
log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -420,13 +454,17 @@ func JoinGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.JoinGroupReq{}
|
req := &rpc.JoinGroupReq{}
|
||||||
utils.CopyStructFields(req, params)
|
utils.CopyStructFields(req, params)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "JoinGroup args ", req.String())
|
log.NewInfo(req.OperationID, "JoinGroup args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
@ -451,13 +489,17 @@ func QuitGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.QuitGroupReq{}
|
req := &rpc.QuitGroupReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "QuitGroup args ", req.String())
|
log.NewInfo(req.OperationID, "QuitGroup args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -483,13 +525,17 @@ func SetGroupInfo(c *gin.Context) {
|
|||||||
req := &rpc.SetGroupInfoReq{GroupInfo: &open_im_sdk.GroupInfo{}}
|
req := &rpc.SetGroupInfoReq{GroupInfo: &open_im_sdk.GroupInfo{}}
|
||||||
utils.CopyStructFields(req.GroupInfo, ¶ms)
|
utils.CopyStructFields(req.GroupInfo, ¶ms)
|
||||||
req.OperationID = params.OperationID
|
req.OperationID = params.OperationID
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String())
|
log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -514,13 +560,17 @@ func TransferGroupOwner(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.TransferGroupOwnerReq{}
|
req := &rpc.TransferGroupOwnerReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String())
|
log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -546,13 +596,17 @@ func DismissGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.DismissGroupReq{}
|
req := &rpc.DismissGroupReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -578,13 +632,17 @@ func MuteGroupMember(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.MuteGroupMemberReq{}
|
req := &rpc.MuteGroupMemberReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -610,13 +668,17 @@ func CancelMuteGroupMember(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.CancelMuteGroupMemberReq{}
|
req := &rpc.CancelMuteGroupMemberReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -642,13 +704,17 @@ func MuteGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.MuteGroupReq{}
|
req := &rpc.MuteGroupReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -674,13 +740,17 @@ func CancelMuteGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.CancelMuteGroupReq{}
|
req := &rpc.CancelMuteGroupReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
@ -708,13 +778,17 @@ func SetGroupMemberNickname(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.SetGroupMemberNicknameReq{}
|
req := &rpc.SetGroupMemberNicknameReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||||
|
@ -30,13 +30,17 @@ func DeleteUser(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.DeleteUsersReq{}
|
req := &rpc.DeleteUsersReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(params.OperationID, "DeleteUser args ", req.String())
|
log.NewInfo(params.OperationID, "DeleteUser args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
client := rpc.NewUserClient(etcdConn)
|
client := rpc.NewUserClient(etcdConn)
|
||||||
@ -62,13 +66,17 @@ func GetAllUsersUid(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetAllUserIDReq{}
|
req := &rpc.GetAllUserIDReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String())
|
log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
client := rpc.NewUserClient(etcdConn)
|
client := rpc.NewUserClient(etcdConn)
|
||||||
@ -94,13 +102,17 @@ func AccountCheck(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.AccountCheckReq{}
|
req := &rpc.AccountCheckReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(params.OperationID, "AccountCheck args ", req.String())
|
log.NewInfo(params.OperationID, "AccountCheck args ", req.String())
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
client := rpc.NewUserClient(etcdConn)
|
client := rpc.NewUserClient(etcdConn)
|
||||||
@ -127,11 +139,14 @@ func GetUsersOnlineStatus(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &pbRelay.GetUsersOnlineStatusReq{}
|
req := &pbRelay.GetUsersOnlineStatusReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,18 @@ func GetUserTags(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
@ -69,12 +75,18 @@ func CreateTag(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||||
@ -105,12 +117,18 @@ func DeleteTag(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||||
@ -141,12 +159,18 @@ func SetTag(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||||
@ -177,12 +201,18 @@ func SendMsg2Tag(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.SendID = userID
|
reqPb.SendID = userID
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||||
@ -210,12 +240,18 @@ func GetTagSendLogs(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||||
@ -255,12 +291,18 @@ func GetUserTagByID(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.UserID = userID
|
reqPb.UserID = userID
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
reqPb.TagID = req.TagID
|
reqPb.TagID = req.TagID
|
||||||
|
@ -28,12 +28,18 @@ func CreateOneWorkMoment(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
@ -67,12 +73,18 @@ func DeleteOneWorkMoment(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
@ -105,12 +117,18 @@ func LikeOneWorkMoment(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
@ -143,12 +161,18 @@ func CommentOneWorkMoment(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
@ -184,13 +208,17 @@ func DeleteComment(c *gin.Context) {
|
|||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, reqPb.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName)
|
||||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||||
respPb, err := client.DeleteComment(context.Background(), &reqPb)
|
respPb, err := client.DeleteComment(context.Background(), &reqPb)
|
||||||
@ -219,12 +247,18 @@ func GetWorkMomentByID(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
reqPb.OpUserID = userID
|
reqPb.OpUserID = userID
|
||||||
reqPb.WorkMomentID = req.WorkMomentID
|
reqPb.WorkMomentID = req.WorkMomentID
|
||||||
@ -261,12 +295,18 @@ func GetUserWorkMoments(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, opUserID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var opUserID string
|
||||||
|
ok, opUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||||
PageNumber: req.PageNumber,
|
PageNumber: req.PageNumber,
|
||||||
@ -353,12 +393,18 @@ func GetUserFriendWorkMoments(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||||
PageNumber: req.PageNumber,
|
PageNumber: req.PageNumber,
|
||||||
@ -444,12 +490,18 @@ func SetUserWorkMomentsLevel(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
var userID string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,18 @@ func AliOSSCredential(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var userID string
|
||||||
|
var errInfo string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "AliOSSCredential args ", userID)
|
log.NewInfo(req.OperationID, "AliOSSCredential args ", userID)
|
||||||
|
|
||||||
stsResp, err := getStsClient().AssumeRole(&sts20150401.AssumeRoleRequest{
|
stsResp, err := getStsClient().AssumeRole(&sts20150401.AssumeRoleRequest{
|
||||||
|
@ -33,12 +33,17 @@ func MinioUploadFile(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, _ := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
ok, _, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError("", utils.GetSelfFuncName(), "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||||
switch req.FileType {
|
switch req.FileType {
|
||||||
// videoType upload snapShot
|
// videoType upload snapShot
|
||||||
@ -101,12 +106,17 @@ func MinioStorageCredential(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, _ := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var errInfo string
|
||||||
|
ok, _, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError("", utils.GetSelfFuncName(), "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var stsOpts cr.STSAssumeRoleOptions
|
var stsOpts cr.STSAssumeRoleOptions
|
||||||
stsOpts.AccessKey = config.Config.Credential.Minio.AccessKeyID
|
stsOpts.AccessKey = config.Config.Credential.Minio.AccessKeyID
|
||||||
stsOpts.SecretKey = config.Config.Credential.Minio.SecretAccessKey
|
stsOpts.SecretKey = config.Config.Credential.Minio.SecretAccessKey
|
||||||
|
@ -22,12 +22,18 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
|
||||||
|
var ok bool
|
||||||
|
var userID string
|
||||||
|
var errInfo string
|
||||||
|
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(req.OperationID, "TencentCloudStorageCredential args ", userID)
|
log.NewInfo(req.OperationID, "TencentCloudStorageCredential args ", userID)
|
||||||
|
|
||||||
cli := sts.NewClient(
|
cli := sts.NewClient(
|
||||||
|
@ -28,13 +28,17 @@ func GetUsersInfoFromCache(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetUserInfoReq{}
|
req := &rpc.GetUserInfoReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
@ -174,13 +178,17 @@ func GetFriendIDListFromCache(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, reqPb.UserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, reqPb.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
||||||
client := cacheRpc.NewCacheClient(etcdConn)
|
client := cacheRpc.NewCacheClient(etcdConn)
|
||||||
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
|
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
|
||||||
@ -207,13 +215,17 @@ func GetBlackIDListFromCache(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
reqPb.OperationID = req.OperationID
|
reqPb.OperationID = req.OperationID
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, reqPb.UserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, reqPb.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
||||||
client := cacheRpc.NewCacheClient(etcdConn)
|
client := cacheRpc.NewCacheClient(etcdConn)
|
||||||
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
|
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
|
||||||
@ -236,13 +248,17 @@ func GetUsersInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.GetUserInfoReq{}
|
req := &rpc.GetUserInfoReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||||
|
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||||
@ -274,13 +290,14 @@ func UpdateUserInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &rpc.UpdateUserInfoReq{UserInfo: &open_im_sdk.UserInfo{}}
|
req := &rpc.UpdateUserInfoReq{UserInfo: &open_im_sdk.UserInfo{}}
|
||||||
utils.CopyStructFields(req.UserInfo, ¶ms)
|
utils.CopyStructFields(req.UserInfo, ¶ms)
|
||||||
|
|
||||||
req.OperationID = params.OperationID
|
req.OperationID = params.OperationID
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String())
|
log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String())
|
||||||
@ -308,13 +325,17 @@ func GetSelfUserInfo(c *gin.Context) {
|
|||||||
req := &rpc.GetUserInfoReq{}
|
req := &rpc.GetUserInfoReq{}
|
||||||
|
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req.UserIDList = append(req.UserIDList, req.OpUserID)
|
req.UserIDList = append(req.UserIDList, req.OpUserID)
|
||||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||||
|
|
||||||
@ -347,13 +368,17 @@ func GetUsersOnlineStatus(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req := &pbRelay.GetUsersOnlineStatusReq{}
|
req := &pbRelay.GetUsersOnlineStatusReq{}
|
||||||
utils.CopyStructFields(req, ¶ms)
|
utils.CopyStructFields(req, ¶ms)
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
var errInfo string
|
||||||
|
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(config.Config.Manager.AppManagerUid) == 0 {
|
if len(config.Config.Manager.AppManagerUid) == 0 {
|
||||||
log.NewError(req.OperationID, "Manager == 0")
|
log.NewError(req.OperationID, "Manager == 0")
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "Manager == 0"})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "Manager == 0"})
|
||||||
|
@ -11,14 +11,16 @@ import (
|
|||||||
|
|
||||||
func JWTAuth() gin.HandlerFunc {
|
func JWTAuth() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "")
|
ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "")
|
||||||
log.NewInfo("0", utils.GetSelfFuncName(), "userID: ", userID)
|
log.NewInfo("0", utils.GetSelfFuncName(), "userID: ", userID)
|
||||||
c.Set("userID", userID)
|
c.Set("userID", userID)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.NewError("","GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
log.NewError("", "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||||
c.Abort()
|
c.Abort()
|
||||||
http.RespHttp200(c, constant.ErrParseToken, nil)
|
http.RespHttp200(c, constant.ErrParseToken, nil)
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
log.NewInfo("0", utils.GetSelfFuncName(), "failed: ", errInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,13 +129,13 @@ func CheckAccess(OpUserID string, OwnerUserID string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserIDFromToken(token string, operationID string) (bool, string) {
|
func GetUserIDFromToken(token string, operationID string) (bool, string, string) {
|
||||||
claims, err := ParseToken(token, operationID)
|
claims, err := ParseToken(token, operationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(operationID, "ParseToken failed, ", err.Error(), token)
|
log.Error(operationID, "ParseToken failed, ", err.Error(), token)
|
||||||
return false, ""
|
return false, "", err.Error()
|
||||||
}
|
}
|
||||||
return true, claims.UID
|
return true, claims.UID, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseTokenGetUserID(token string, operationID string) (error, string) {
|
func ParseTokenGetUserID(token string, operationID string) (error, string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user