This commit is contained in:
shoopea 2019-06-09 20:18:54 +08:00
parent eac8507dde
commit da025e4012

6
obj.go
View File

@ -114,13 +114,13 @@ func addObjMsg(msgID64 int64, msgChatID64 int64, msgUserID64 int64, msgSenderUse
} }
func getObjMsg(objId int64) (*ChatWarsMessage, error) { func getObjMsg(objId int64) (*ChatWarsMessage, error) {
var m *ChatWarsMessage
if v, ok := cacheObjMsg.Load(objId); ok { if v, ok := cacheObjMsg.Load(objId); ok {
m := v.(ChatWarsMessage) m := v.(ChatWarsMessage)
return m, nil return *m, nil
} }
var m *ChatWarsMessage
stmt, err := db.Prepare(`SELECT om.msg_id, om.chat_id, om.user_id, om.sender_user_id, om.date, om.text FROM obj_msg om WHERE om.obj_id = ?`) stmt, err := db.Prepare(`SELECT om.msg_id, om.chat_id, om.user_id, om.sender_user_id, om.date, om.text FROM obj_msg om WHERE om.obj_id = ?`)
if err != nil { if err != nil {
return m, err return m, err