Compare commits
No commits in common. "bcc63631b5aed04dcc0d6e539520c5c775e342b6" and "a3ec4e8ac445f788ec8d6176d8eb91758efb1882" have entirely different histories.
bcc63631b5
...
a3ec4e8ac4
|
|
@ -54,12 +54,12 @@ func GetMsgUserByIndex(from_user_id, to_user_id, msg_type, index, status int) ([
|
||||||
var msgs []Message
|
var msgs []Message
|
||||||
var res *gorm.DB
|
var res *gorm.DB
|
||||||
if msg_type == 4 {
|
if msg_type == 4 {
|
||||||
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).Find(&msgs).Order("created_at DESC").Limit(20 * index)
|
||||||
} 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().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).Find(&msgs).Order("created_at DESC").Limit(20 * index)
|
||||||
} 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).Find(&msgs).Order("created_at DESC").Limit(20 * index)
|
||||||
}
|
}
|
||||||
return msgs, res.Error
|
return msgs, res.Error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue