pb change

This commit is contained in:
Gordon
2021-12-10 10:49:49 +08:00
parent aaf834a33b
commit d6ec8f4930
10 changed files with 71 additions and 69 deletions
@@ -54,10 +54,11 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
pbSaveData.OperationID = pbData.OperationID
pbSaveData.RecvID = pbData.RecvID
pbSaveData.PlatformID = pbData.PlatformID
options := utils.JsonStringToMap(pbData.Options)
//Control whether to store offline messages (mongo)
isHistory := utils.GetSwitchFromOptions(pbData.Options, "history")
isHistory := utils.GetSwitchFromOptions(options, "history")
//Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(pbData.Options, "persistent")
isPersist := utils.GetSwitchFromOptions(options, "persistent")
switch pbData.SessionType {
case constant.SingleChatType:
log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist)
@@ -40,8 +40,9 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey strin
log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error())
return
}
options := utils.JsonStringToMap(pbData.Options)
//Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(pbData.Options, "persistent")
isPersist := utils.GetSwitchFromOptions(options, "persistent")
//Only process receiver data
if isPersist {
if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType {