mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
bug fix and shell optimization
This commit is contained in:
@@ -2,6 +2,7 @@ package db
|
||||
|
||||
import (
|
||||
"Open_IM/src/common/config"
|
||||
"Open_IM/src/common/log"
|
||||
"fmt"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||
@@ -15,10 +16,13 @@ type mysqlDB struct {
|
||||
}
|
||||
|
||||
func initMysqlDB() {
|
||||
//When there is no open IM database, connect to the mysql built-in database to create openIM database
|
||||
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local",
|
||||
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql")
|
||||
|
||||
db, err := gorm.Open("mysql", dsn)
|
||||
if err != nil {
|
||||
log.Error("", "", dsn)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func InsertMessageToChatLog(msgData pbMsg.WSToMsgSvrChatMsg) error {
|
||||
MsgId: msgData.MsgID,
|
||||
SendID: msgData.SendID,
|
||||
RecvID: msgData.RecvID,
|
||||
SendTime: utils.UnixSecondToTime(msgData.SendTime),
|
||||
SendTime: utils.UnixNanoSecondToTime(msgData.SendTime),
|
||||
SessionType: msgData.SessionType,
|
||||
ContentType: msgData.ContentType,
|
||||
MsgFrom: msgData.MsgFrom,
|
||||
|
||||
Reference in New Issue
Block a user