mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-13 13:35:59 +08:00
refactor: refactor the code of push and optimization.
This commit is contained in:
@@ -16,6 +16,7 @@ package push
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
@@ -136,3 +137,14 @@ func callbackBeforeSuperGroupOnlinePush(
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func GetContent(msg *sdkws.MsgData) string {
|
||||
if msg.ContentType >= constant.NotificationBegin && msg.ContentType <= constant.NotificationEnd {
|
||||
var notification sdkws.NotificationElem
|
||||
if err := json.Unmarshal(msg.Content, ¬ification); err != nil {
|
||||
return ""
|
||||
}
|
||||
return notification.Detail
|
||||
} else {
|
||||
return string(msg.Content)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user