options add value

pull/232/head
Gordon 3 years ago
parent 424f854145
commit 3433d211a5

@ -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