mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 18:36:19 +08:00
msg test
This commit is contained in:
parent
64f2fb9e73
commit
5a9f3f1f5e
@ -28,7 +28,7 @@ func InsertMessageToChatLog(msg pbMsg.MsgDataToMQ) error {
|
|||||||
chatLog.RecvID = msg.MsgData.RecvID
|
chatLog.RecvID = msg.MsgData.RecvID
|
||||||
}
|
}
|
||||||
chatLog.Content = string(msg.MsgData.Content)
|
chatLog.Content = string(msg.MsgData.Content)
|
||||||
chatLog.CreateTime = utils.UnixNanoSecondToTime(msg.MsgData.CreateTime)
|
chatLog.CreateTime = utils.UnixMillSecondToTime(msg.MsgData.CreateTime)
|
||||||
chatLog.SendTime = utils.UnixNanoSecondToTime(msg.MsgData.SendTime)
|
chatLog.SendTime = utils.UnixMillSecondToTime(msg.MsgData.SendTime)
|
||||||
return dbConn.Table("chat_logs").Create(chatLog).Error
|
return dbConn.Table("chat_logs").Create(chatLog).Error
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@ func UnixSecondToTime(second int64) time.Time {
|
|||||||
func UnixNanoSecondToTime(nanoSecond int64) time.Time {
|
func UnixNanoSecondToTime(nanoSecond int64) time.Time {
|
||||||
return time.Unix(0, nanoSecond)
|
return time.Unix(0, nanoSecond)
|
||||||
}
|
}
|
||||||
|
func UnixMillSecondToTime(millSecond int64) time.Time {
|
||||||
|
sec := millSecond / 1000
|
||||||
|
msec := millSecond % 1000
|
||||||
|
return time.Unix(sec, msec*int64(time.Millisecond))
|
||||||
|
}
|
||||||
|
|
||||||
//Get the current timestamp by Nano
|
//Get the current timestamp by Nano
|
||||||
func GetCurrentTimestampByNano() int64 {
|
func GetCurrentTimestampByNano() int64 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user