From 9f924901eccb70349a539b996df515b7a7b2750a Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 29 Feb 2024 10:49:54 +0800 Subject: [PATCH] by Robin at 20240229; fix --- app/mix/service/utilservice.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 96fa66c3..aed576eb 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -22,6 +22,7 @@ import ( "service/dbstruct" "service/library/logger" "strings" + "time" "github.com/gin-gonic/gin" "go.mongodb.org/mongo-driver/mongo" @@ -592,16 +593,24 @@ func (s *Service) utilStringifyContactCustomerServices(ctx *gin.Context, contact for i, contactCustomerService := range contactCustomerServices { sessionId := util.DerefInt64(contactCustomerService.SessionId) - subMid := util.DerefInt64(sessionMap[sessionId].SubMid) + account, err1 := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{ + Mid: sessionMap[sessionId].SubMid, + }) + if err1 != nil { + logger.Error("OpListByMid fail, err: %v", err1) + err = err1 + return + } isRead := util.DerefInt64(contactCustomerService.IsRead) message := util.DerefString(contactCustomerService.Message) ct := util.DerefInt64(contactCustomerService.Ct) + createtime := time.Unix(ct, 0).Format(time.DateTime) if isRead == consts.ContactCustomerService_NotRead { msgBuilder.WriteString(fmt.Sprintf("%v. 接收到未读消息:\n", i)) } else { msgBuilder.WriteString(fmt.Sprintf("%v. 该条消息已读:\n", i)) } - msgBuilder.WriteString(fmt.Sprintf("mid: %v, session_id: %v, message: {%v}, ct: %v\n\n", subMid, sessionId, message, ct)) + msgBuilder.WriteString(fmt.Sprintf("user_id: %v, session_id: %v, message: \"%v\", ct: %v\n\n", util.DerefInt64(account.UserId), sessionId, message, createtime)) } msg = msgBuilder.String()