mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
api update
This commit is contained in:
parent
188ca8fc58
commit
0410003ceb
@ -175,6 +175,7 @@ tokenpolicy:
|
|||||||
accessExpire: 7
|
accessExpire: 7
|
||||||
|
|
||||||
messagecallback:
|
messagecallback:
|
||||||
|
callbackSwitch: false
|
||||||
callbackUrl: "http://www.xxx.com/msg/judge"
|
callbackUrl: "http://www.xxx.com/msg/judge"
|
||||||
#TimeOut use second as unit
|
#TimeOut use second as unit
|
||||||
callbackTimeOut: 10
|
callbackTimeOut: 10
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
api "Open_IM/pkg/base_info"
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/token_verify"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
pbChat "Open_IM/pkg/proto/chat"
|
pbChat "Open_IM/pkg/proto/chat"
|
||||||
|
"Open_IM/pkg/proto/sdk_ws"
|
||||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
@ -40,11 +42,13 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
|
|||||||
newContent = utils.StructToJsonString(params.Content)
|
newContent = utils.StructToJsonString(params.Content)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
options := make(map[string]bool, 2)
|
var options map[string]bool
|
||||||
if params.IsOnlineOnly {
|
if params.IsOnlineOnly {
|
||||||
|
options = make(map[string]bool, 5)
|
||||||
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
|
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
|
||||||
utils.SetSwitchFromOptions(options, constant.IsHistory, false)
|
utils.SetSwitchFromOptions(options, constant.IsHistory, false)
|
||||||
utils.SetSwitchFromOptions(options, constant.IsPersistent, false)
|
utils.SetSwitchFromOptions(options, constant.IsPersistent, false)
|
||||||
|
utils.SetSwitchFromOptions(options, constant.IsSenderSync, false)
|
||||||
}
|
}
|
||||||
pbData := pbChat.SendMsgReq{
|
pbData := pbChat.SendMsgReq{
|
||||||
OperationID: params.OperationID,
|
OperationID: params.OperationID,
|
||||||
@ -152,20 +156,16 @@ func ManagementSendMsg(c *gin.Context) {
|
|||||||
|
|
||||||
log.Info("", "", "api ManagementSendMsg call, api call rpc...")
|
log.Info("", "", "api ManagementSendMsg call, api call rpc...")
|
||||||
|
|
||||||
reply, err := client.SendMsg(context.Background(), pbData)
|
RpcResp, err := client.SendMsg(context.Background(), pbData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error())
|
log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("", "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
log.Info("", "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String())
|
||||||
|
resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: server_api_params.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}}
|
||||||
c.JSON(http.StatusOK, gin.H{
|
log.Info(params.OperationID, "ManagementSendMsg return", resp)
|
||||||
"errCode": reply.ErrCode,
|
c.JSON(http.StatusOK, resp)
|
||||||
"errMsg": reply.ErrMsg,
|
|
||||||
"sendTime": reply.SendTime,
|
|
||||||
"msgID": reply.ClientMsgID,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package base_info
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
pbRelay "Open_IM/pkg/proto/relay"
|
pbRelay "Open_IM/pkg/proto/relay"
|
||||||
|
"Open_IM/pkg/proto/sdk_ws"
|
||||||
pbUser "Open_IM/pkg/proto/user"
|
pbUser "Open_IM/pkg/proto/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,3 +37,8 @@ type AccountCheckResp struct {
|
|||||||
CommResp
|
CommResp
|
||||||
ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"`
|
ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ManagementSendMsgResp struct {
|
||||||
|
CommResp
|
||||||
|
ResultList server_api_params.UserSendMsgResp `json:"data"`
|
||||||
|
}
|
||||||
|
@ -10,8 +10,8 @@ type GetUsersInfoReq struct {
|
|||||||
}
|
}
|
||||||
type GetUsersInfoResp struct {
|
type GetUsersInfoResp struct {
|
||||||
CommResp
|
CommResp
|
||||||
UserInfoList []*open_im_sdk.PublicUserInfo
|
UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"`
|
||||||
Data []map[string]interface{} `json:"data"`
|
Data []map[string]interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateSelfUserInfoReq struct {
|
type UpdateSelfUserInfoReq struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user