mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-02 16:15:59 +08:00
send message by message receive opt
This commit is contained in:
+4
-1
@@ -116,8 +116,11 @@ func JsonStringToMap(str string) (tempMap map[string]interface{}) {
|
||||
return tempMap
|
||||
}
|
||||
func GetSwitchFromOptions(Options map[string]interface{}, key string) (result bool) {
|
||||
if flag, ok := Options[key]; !ok || flag == 1 {
|
||||
if flag, ok := Options[key]; !ok || flag.(int) == 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
func SetSwitchFromOptions(Options map[string]interface{}, key string, value interface{}) {
|
||||
Options[key] = value
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"encoding/json"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
@@ -63,6 +64,15 @@ func GetMsgID(sendID string) string {
|
||||
t := int64ToString(GetCurrentTimestampByNano())
|
||||
return Md5(t + sendID + int64ToString(rand.Int63n(GetCurrentTimestampByNano())))
|
||||
}
|
||||
func GetConversationIDBySessionType(sourceID string, sessionType int) string {
|
||||
switch sessionType {
|
||||
case constant.SingleChatType:
|
||||
return "single_" + sourceID
|
||||
case constant.GroupChatType:
|
||||
return "group_" + sourceID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
func int64ToString(i int64) string {
|
||||
return strconv.FormatInt(i, 10)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user