by Robin at 20240229; fix

This commit is contained in:
Leufolium 2024-02-29 10:49:54 +08:00
parent 0e297f564c
commit 9f924901ec
1 changed files with 11 additions and 2 deletions

View File

@ -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()