handler_push_chat_log.go 825 B

123456789101112131415161718192021222324252627282930
  1. //@Author : KaiShin
  2. //@Time : 2021/10/28
  3. package handler
  4. import (
  5. "call_center/db/rpc/internal/svc"
  6. "call_center/db/rpc/pb"
  7. "log"
  8. )
  9. func PushChatLog(svcCtx *svc.ServiceContext, cmdMsg *pb.DbCommandMsg) {
  10. logInfo := cmdMsg.GetChatLog()
  11. mapInfo := make(map[string]interface{})
  12. mapInfo["content"] = logInfo.GetContent()
  13. mapInfo["fromId"] = logInfo.GetFromId()
  14. mapInfo["toId"] = logInfo.GetToId()
  15. mapInfo["chatType"] = logInfo.GetChatType()
  16. mapInfo["logDt"] = logInfo.GetTimeStamp()
  17. mapInfo["gameId"] = logInfo.GetGameId()
  18. mapInfo["sessionId"] = logInfo.GetSessionId()
  19. insertTable := "service_chat_log"
  20. if logInfo.GetIsVisitor() == true {
  21. insertTable = "service_chat_visitor_log"
  22. }
  23. svcCtx.Es.Insert(insertTable, mapInfo)
  24. log.Printf("<handler.PushChatLog>, table:%s, msg:%s", insertTable, mapInfo)
  25. }