diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 0a4f1f8aa..719c06ccc 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -325,7 +325,7 @@ func (d *DataBases) GetNewestMsg(ID string) (msg *MsgInfo, err error) { } if len(userChats) > 0 { if len(userChats[0].Msg) > 0 { - return &userChats[0].Msg[len(userChats[0].Msg)], nil + return &userChats[0].Msg[len(userChats[0].Msg)-1], nil } return nil, errors.New("len(userChats[0].Msg) < 0") }