send message by message receive opt

This commit is contained in:
Gordon
2021-12-06 20:03:59 +08:00
parent cd14f3e649
commit 33b9685985
3 changed files with 62 additions and 9 deletions
+10
View File
@@ -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)
}