|
|
@ -38,7 +38,13 @@ func GetUsersInfoFromCache(c *gin.Context) {
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": 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.OpenImUserName)
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -80,7 +86,13 @@ func GetFriendIDListFromCache(c *gin.Context) {
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": 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, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := cacheRpc.NewCacheClient(etcdConn)
|
|
|
|
client := cacheRpc.NewCacheClient(etcdConn)
|
|
|
|
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
|
|
|
|
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -116,7 +128,13 @@ func GetBlackIDListFromCache(c *gin.Context) {
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": 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, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := cacheRpc.NewCacheClient(etcdConn)
|
|
|
|
client := cacheRpc.NewCacheClient(etcdConn)
|
|
|
|
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
|
|
|
|
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -151,7 +169,13 @@ func GetUsersInfo(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
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, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -194,7 +218,13 @@ func UpdateUserInfo(c *gin.Context) {
|
|
|
|
if params.GlobalRecvMsgOpt != nil {
|
|
|
|
if params.GlobalRecvMsgOpt != nil {
|
|
|
|
req.GlobalRecvMsgOpt.Value = *params.GlobalRecvMsgOpt
|
|
|
|
req.GlobalRecvMsgOpt.Value = *params.GlobalRecvMsgOpt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
RpcResp, err := client.UpdateUserInfo(context.Background(), req)
|
|
|
|
RpcResp, err := client.UpdateUserInfo(context.Background(), req)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -231,7 +261,13 @@ func GetSelfUserInfo(c *gin.Context) {
|
|
|
|
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())
|
|
|
|
|
|
|
|
|
|
|
|
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, req.OperationID)
|
|
|
|
|
|
|
|
if etcdConn == nil {
|
|
|
|
|
|
|
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, errMsg)
|
|
|
|
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
client := rpc.NewUserClient(etcdConn)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|