mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-23 09:50:27 +08:00
feat: SendBusinessNotification supported configuration parameters
This commit is contained in:
parent
1e2b6f9d56
commit
67586614b8
@ -248,16 +248,21 @@ func (m *MessageApi) SendMessage(c *gin.Context) {
|
|||||||
|
|
||||||
func (m *MessageApi) SendBusinessNotification(c *gin.Context) {
|
func (m *MessageApi) SendBusinessNotification(c *gin.Context) {
|
||||||
req := struct {
|
req := struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
SendUserID string `json:"sendUserID" binding:"required"`
|
SendUserID string `json:"sendUserID" binding:"required"`
|
||||||
RecvUserID string `json:"recvUserID" binding:"required"`
|
RecvUserID string `json:"recvUserID" binding:"required"`
|
||||||
|
SendMsg bool `json:"sendMsg"`
|
||||||
|
ReliabilityLevel *int `json:"reliabilityLevel"`
|
||||||
|
UnreadCount bool `json:"unreadCount"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.BindJSON(&req); err != nil {
|
if err := c.BindJSON(&req); err != nil {
|
||||||
apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap())
|
apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if req.ReliabilityLevel == nil {
|
||||||
|
req.ReliabilityLevel = datautil.ToPtr(1)
|
||||||
|
}
|
||||||
if !authverify.IsAppManagerUid(c, m.imAdminUserID) {
|
if !authverify.IsAppManagerUid(c, m.imAdminUserID) {
|
||||||
apiresp.GinError(c, errs.ErrNoPermission.WrapMsg("only app manager can send message"))
|
apiresp.GinError(c, errs.ErrNoPermission.WrapMsg("only app manager can send message"))
|
||||||
return
|
return
|
||||||
@ -278,9 +283,9 @@ func (m *MessageApi) SendBusinessNotification(c *gin.Context) {
|
|||||||
CreateTime: timeutil.GetCurrentTimestampByMill(),
|
CreateTime: timeutil.GetCurrentTimestampByMill(),
|
||||||
ClientMsgID: idutil.GetMsgIDByMD5(mcontext.GetOpUserID(c)),
|
ClientMsgID: idutil.GetMsgIDByMD5(mcontext.GetOpUserID(c)),
|
||||||
Options: config.GetOptionsByNotification(config.NotificationConfig{
|
Options: config.GetOptionsByNotification(config.NotificationConfig{
|
||||||
IsSendMsg: false,
|
IsSendMsg: req.SendMsg,
|
||||||
ReliabilityLevel: 1,
|
ReliabilityLevel: *req.ReliabilityLevel,
|
||||||
UnreadCount: false,
|
UnreadCount: req.UnreadCount,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user