diff --git a/pkg/common/db/model_struct.go b/pkg/common/db/model_struct.go index 25e3bf0cd..0e36add1f 100644 --- a/pkg/common/db/model_struct.go +++ b/pkg/common/db/model_struct.go @@ -181,7 +181,7 @@ type ChatLog struct { SessionType int32 `gorm:"column:session_type" json:"sessionType"` MsgFrom int32 `gorm:"column:msg_from" json:"msgFrom"` ContentType int32 `gorm:"column:content_type" json:"contentType"` - Content string `gorm:"column:content;type:varchar(1000)" json:"content"` + Content []byte `gorm:"column:content;type:varchar(1000)" json:"content"` Status int32 `gorm:"column:status" json:"status"` Seq uint32 `gorm:"column:seq;index:index_seq;default:0" json:"seq"` SendTime time.Time `gorm:"column:send_time" json:"sendTime"` diff --git a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go index 96d03a7c7..cea33b1a2 100644 --- a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go +++ b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go @@ -27,7 +27,7 @@ func InsertMessageToChatLog(msg pbMsg.MsgDataToMQ) error { case constant.SingleChatType: chatLog.RecvID = msg.MsgData.RecvID } - chatLog.Content = string(msg.MsgData.Content) + chatLog.Content = msg.MsgData.Content chatLog.CreateTime = utils.UnixMillSecondToTime(msg.MsgData.CreateTime) chatLog.SendTime = utils.UnixMillSecondToTime(msg.MsgData.SendTime) return dbConn.Table("chat_logs").Create(chatLog).Error