mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-30 22:42:29 +08:00
get chat log do not need time
This commit is contained in:
parent
8ac36526a8
commit
ebed875c46
@ -215,21 +215,24 @@ func (s *adminCMSServer) GetUserRegisterAddFriendIDList(_ context.Context, req *
|
|||||||
func (s *adminCMSServer) GetChatLogs(_ context.Context, req *pbAdminCMS.GetChatLogsReq) (*pbAdminCMS.GetChatLogsResp, error) {
|
func (s *adminCMSServer) GetChatLogs(_ context.Context, req *pbAdminCMS.GetChatLogsReq) (*pbAdminCMS.GetChatLogsResp, error) {
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "GetChatLogs", req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "GetChatLogs", req.String())
|
||||||
resp := &pbAdminCMS.GetChatLogsResp{CommonResp: &pbAdminCMS.CommonResp{}, Pagination: &server_api_params.ResponsePagination{}}
|
resp := &pbAdminCMS.GetChatLogsResp{CommonResp: &pbAdminCMS.CommonResp{}, Pagination: &server_api_params.ResponsePagination{}}
|
||||||
time, err := utils.TimeStringToTime(req.SendTime)
|
|
||||||
if err != nil {
|
|
||||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "time string parse error", err.Error())
|
|
||||||
resp.CommonResp.ErrCode = constant.ErrArgs.ErrCode
|
|
||||||
resp.CommonResp.ErrMsg = err.Error()
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
chatLog := db.ChatLog{
|
chatLog := db.ChatLog{
|
||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
SendTime: time,
|
|
||||||
ContentType: req.ContentType,
|
ContentType: req.ContentType,
|
||||||
SessionType: req.SessionType,
|
SessionType: req.SessionType,
|
||||||
RecvID: req.RecvID,
|
RecvID: req.RecvID,
|
||||||
SendID: req.SendID,
|
SendID: req.SendID,
|
||||||
}
|
}
|
||||||
|
if req.SendTime != "" {
|
||||||
|
sendTime, err := utils.TimeStringToTime(req.SendTime)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(req.OperationID, utils.GetSelfFuncName(), "time string parse error", err.Error())
|
||||||
|
resp.CommonResp.ErrCode = constant.ErrArgs.ErrCode
|
||||||
|
resp.CommonResp.ErrMsg = err.Error()
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
chatLog.SendTime = sendTime
|
||||||
|
}
|
||||||
|
|
||||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "chat_log: ", chatLog)
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "chat_log: ", chatLog)
|
||||||
|
|
||||||
num, chatLogs, err := imdb.GetChatLog(&chatLog, req.Pagination.PageNumber, req.Pagination.ShowNumber, []int32{
|
num, chatLogs, err := imdb.GetChatLog(&chatLog, req.Pagination.PageNumber, req.Pagination.ShowNumber, []int32{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user