mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 10:22:36 +08:00
cms
This commit is contained in:
parent
a372ef3faa
commit
49f05d334d
@ -621,7 +621,7 @@ func (s *adminCMSServer) GetUserFriends(_ context.Context, req *pbAdminCMS.GetUs
|
|||||||
resp.FriendInfoList = append(resp.FriendInfoList, friendInfo)
|
resp.FriendInfoList = append(resp.FriendInfoList, friendInfo)
|
||||||
}
|
}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return nil, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *adminCMSServer) GenerateInvitationCode(_ context.Context, req *pbAdminCMS.GenerateInvitationCodeReq) (*pbAdminCMS.GenerateInvitationCodeResp, error) {
|
func (s *adminCMSServer) GenerateInvitationCode(_ context.Context, req *pbAdminCMS.GenerateInvitationCodeReq) (*pbAdminCMS.GenerateInvitationCodeResp, error) {
|
||||||
|
@ -12,6 +12,9 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
|||||||
var chatLogs []db.ChatLog
|
var chatLogs []db.ChatLog
|
||||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs").
|
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs").
|
||||||
Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
||||||
|
if chatLog.SendTime.Unix() > 0 {
|
||||||
|
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
||||||
|
}
|
||||||
if chatLog.Content != "" {
|
if chatLog.Content != "" {
|
||||||
db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
||||||
}
|
}
|
||||||
@ -29,9 +32,7 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
|||||||
if chatLog.RecvID != "" {
|
if chatLog.RecvID != "" {
|
||||||
db = db.Where("recv_id = ?", chatLog.RecvID)
|
db = db.Where("recv_id = ?", chatLog.RecvID)
|
||||||
}
|
}
|
||||||
if chatLog.SendTime.Unix() > 0 {
|
|
||||||
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
|
||||||
}
|
|
||||||
err := db.Find(&chatLogs).Error
|
err := db.Find(&chatLogs).Error
|
||||||
return chatLogs, err
|
return chatLogs, err
|
||||||
}
|
}
|
||||||
@ -39,6 +40,10 @@ func GetChatLog(chatLog db.ChatLog, pageNumber, showNumber int32) ([]db.ChatLog,
|
|||||||
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
||||||
var count int64
|
var count int64
|
||||||
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
db := db.DB.MysqlDB.DefaultGormDB().Table("chat_logs")
|
||||||
|
if chatLog.SendTime.Unix() > 0 {
|
||||||
|
log.NewDebug("", utils.GetSelfFuncName(), chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
||||||
|
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
||||||
|
}
|
||||||
if chatLog.Content != "" {
|
if chatLog.Content != "" {
|
||||||
db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
db = db.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
||||||
}
|
}
|
||||||
@ -56,10 +61,6 @@ func GetChatLogCount(chatLog db.ChatLog) (int64, error) {
|
|||||||
if chatLog.RecvID != "" {
|
if chatLog.RecvID != "" {
|
||||||
db = db.Where("recv_id = ?", chatLog.RecvID)
|
db = db.Where("recv_id = ?", chatLog.RecvID)
|
||||||
}
|
}
|
||||||
if chatLog.SendTime.Unix() > 0 {
|
|
||||||
log.NewDebug("", utils.GetSelfFuncName(), chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
|
||||||
db = db.Where("send_time > ? and send_time < ?", chatLog.SendTime, chatLog.SendTime.AddDate(0, 0, 1))
|
|
||||||
}
|
|
||||||
|
|
||||||
err := db.Count(&count).Error
|
err := db.Count(&count).Error
|
||||||
return count, err
|
return count, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user