修改获取消息
This commit is contained in:
parent
88fc8e2529
commit
302c3d002e
|
|
@ -57,7 +57,8 @@ func GetMsgUserByIndex(from_user_id, to_user_id, msg_type, index, status int) ([
|
||||||
res = DB.Debug().Where("from_user_id = ? and to_user_id = ? and type = ? and status = ? ", from_user_id, to_user_id, msg_type, status).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
res = DB.Debug().Where("from_user_id = ? and to_user_id = ? and type = ? and status = ? ", from_user_id, to_user_id, msg_type, status).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
||||||
} else if msg_type == 1 {
|
} else if msg_type == 1 {
|
||||||
//单聊,只有两个人的消息
|
//单聊,只有两个人的消息
|
||||||
res = DB.Debug().Where("(from_user_id = ? AND to_user_id = ?) or (from_user_id = ? AND to_user_id = ?) and type = ? ", from_user_id, to_user_id, to_user_id, from_user_id, msg_type).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
res = DB.Debug().Raw("select * from messages where (from_user_id = ? AND to_user_id = ?) or (from_user_id = ? AND to_user_id = ?) and type = ? order by created_at desc limit ?", from_user_id, to_user_id, to_user_id, from_user_id, msg_type, 20*index).Scan(&msgs)
|
||||||
|
//res = DB.Debug().Where("(from_user_id = ? AND to_user_id = ?) or (from_user_id = ? AND to_user_id = ?) and type = ? ", from_user_id, to_user_id, to_user_id, from_user_id, msg_type).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
||||||
} else {
|
} else {
|
||||||
res = DB.Debug().Where("from_user_id = ? and to_user_id = ? and type = ? ", from_user_id, to_user_id, msg_type).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
res = DB.Debug().Where("from_user_id = ? and to_user_id = ? and type = ? ", from_user_id, to_user_id, msg_type).Order("created_at DESC").Limit(20 * index).Find(&msgs)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue