mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-12 21:16:00 +08:00
add
This commit is contained in:
@@ -12,6 +12,18 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
||||
return chatLogs, err
|
||||
}
|
||||
dbConn.LogMode(true)
|
||||
err = dbConn.Table("chat_logs").Where(fmt.Sprintf(" content like '%%%s%%' ", chatLog.Content)).Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&chatLogs).Error
|
||||
err = dbConn.Table("chat_logs").Where(fmt.Sprintf(" content like '%%%s%%'", chatLog.Content)).
|
||||
Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&chatLogs).Error
|
||||
return chatLogs, err
|
||||
}
|
||||
|
||||
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
var count int64
|
||||
if err != nil {
|
||||
return count, err
|
||||
}
|
||||
dbConn.LogMode(true)
|
||||
err = dbConn.Table("chat_logs").Where(fmt.Sprintf(" content like '%%%s%%' and ", chatLog.Content)).Count(&count).Error
|
||||
return count, err
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func UserIsBlock(userId string) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
var user db.BlackList
|
||||
rows := dbConn.Table("black_list").Where("uid=?", userId).First(&user).RowsAffected
|
||||
rows := dbConn.Table("black_lists").Where("uid=?", userId).First(&user).RowsAffected
|
||||
if rows >= 1 {
|
||||
return true, nil
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func BlockUser(userId, endDisableTime string) error {
|
||||
return constant.ErrDB
|
||||
}
|
||||
var blockUser db.BlackList
|
||||
dbConn.Table("black_list").Where("uid=?", userId).First(&blockUser)
|
||||
dbConn.Table("black_lists").Where("uid=?", userId).First(&blockUser)
|
||||
if blockUser.UserId != "" {
|
||||
dbConn.Model(&blockUser).Where("uid=?", blockUser.UserId).Update("end_disable_time", end)
|
||||
return nil
|
||||
@@ -222,7 +222,7 @@ func GetBlockUserById(userId string) (BlockUserInfo, error) {
|
||||
if err != nil {
|
||||
return blockUserInfo, err
|
||||
}
|
||||
if err = dbConn.Table("black_list").Where("uid=?", userId).Find(&blockUser).Error; err != nil {
|
||||
if err = dbConn.Table("black_lists").Where("uid=?", userId).Find(&blockUser).Error; err != nil {
|
||||
return blockUserInfo, err
|
||||
}
|
||||
user := db.Users{
|
||||
|
||||
Reference in New Issue
Block a user