From 49034f102c1a11d0a154cf9ec3865d22be07621a Mon Sep 17 00:00:00 2001 From: "qiyunfanbo126.com" <815699> Date: Sat, 18 Jan 2025 10:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/mq/kafka_v2.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/utils/mq/kafka_v2.go b/app/utils/mq/kafka_v2.go index a0a620b..4ccd72b 100644 --- a/app/utils/mq/kafka_v2.go +++ b/app/utils/mq/kafka_v2.go @@ -98,12 +98,14 @@ func (kk KafkaV2Mq) Consume(name string, hand interface{}, ci int) { var mqsg = entities.MqMessage{} mqsg.Key = string(msg.Key) mqsg.Property = make(map[string]interface{}) - if false { - for _, v := range msg.Headers { - if v.Key == "property" { - json.Unmarshal(v.Value, &mqsg.Property) + if len(msg.Value) > 0 { + if msg.Headers != nil { + for _, v := range msg.Headers { + if v.Key == "property" { + json.Unmarshal(v.Value, &mqsg.Property) + } + mqsg.Property[string(v.Key)] = string(v.Value) } - mqsg.Property[string(v.Key)] = string(v.Value) } err = json.Unmarshal(msg.Value, &mqsg.Body) } else {