From a372ef3faad7e0776f26f83c06c58c540c260c78 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Fri, 2 Sep 2022 11:35:20 +0800 Subject: [PATCH] cms --- pkg/common/db/mysql_model/im_mysql_model/friend_model.go | 2 +- pkg/common/db/mysql_model/im_mysql_model/message_cms.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go index 7b64fd2cc..96b1e3c82 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go @@ -63,7 +63,7 @@ func GetUserFriendsCMS(ownerUserID, friendUserName string, pageNumber, showNumbe db := db.DB.MysqlDB.DefaultGormDB().Table("friends"). Select("friends.*, users.name"). Where("friends.owner_user_id=?", ownerUserID).Limit(int(showNumber)). - Joins("left join friends on friends.friend_user_id = users.user_id"). + Joins("left join users on friends.friend_user_id = users.user_id"). Offset(int(showNumber * (pageNumber - 1))) if friendUserName != "" { db = db.Where("users.name like ?", fmt.Sprintf("%%%s%%", friendUserName)) diff --git a/pkg/common/db/mysql_model/im_mysql_model/message_cms.go b/pkg/common/db/mysql_model/im_mysql_model/message_cms.go index e2210225a..7e74c83c4 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/message_cms.go +++ b/pkg/common/db/mysql_model/im_mysql_model/message_cms.go @@ -13,7 +13,7 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog, db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs"). Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))) if chatLog.Content != "" { - db = db.Where(" name like ? ", fmt.Sprintf("%%%s%%", chatLog.Content)) + db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content)) } if chatLog.SessionType == 1 { db = db.Where("session_type = ?", chatLog.SessionType) @@ -40,7 +40,7 @@ func GetChatLogCount(chatLog db.ChatLog) (int64, error) { var count int64 db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs") if chatLog.Content != "" { - db = db.Where(" name like ? ", fmt.Sprintf("%%%s%%", chatLog.Content)) + db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content)) } if chatLog.SessionType != 0 { db = db.Where("session_type = ?", chatLog.SessionType)