options add value

pull/455/head
Gordon 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent e459295a72
commit f26170540f

@ -48,9 +48,8 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
newContent = params.Content["revokeMsgClientID"].(string) newContent = params.Content["revokeMsgClientID"].(string)
default: default:
} }
var options map[string]bool options := make(map[string]bool, 5)
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)

@ -116,6 +116,9 @@ func JsonStringToMap(str string) (tempMap map[string]int32) {
return tempMap return tempMap
} }
func GetSwitchFromOptions(Options map[string]bool, key string) (result bool) { func GetSwitchFromOptions(Options map[string]bool, key string) (result bool) {
if Options == nil {
return true
}
if flag, ok := Options[key]; !ok || flag { if flag, ok := Options[key]; !ok || flag {
return true return true
} }

Loading…
Cancel
Save