customer message

This commit is contained in:
jiangyong 2024-07-05 08:07:36 +08:00
parent 1f3492205d
commit 1b8f9cd42c
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/smbrave/goutil"
"github.com/spf13/cast" "github.com/spf13/cast"
"gitlab.batiao8.com/open/gosdk/util" "gitlab.batiao8.com/open/gosdk/util"
"gitlab.batiao8.com/open/gosdk/wechat/message" "gitlab.batiao8.com/open/gosdk/wechat/message"
@ -45,6 +46,7 @@ type CustomerMessage struct {
Origin int Origin int
SendTime int64 SendTime int64
SyncTime int64 SyncTime int64
Raw string
Text *CustomerText Text *CustomerText
Event *CustomerEvent Event *CustomerEvent
Image *CustomerImage Image *CustomerImage
@ -313,6 +315,7 @@ func (m *CustomerMessage) From(data map[string]interface{}) {
m.ExternalUserid = cast.ToString(data["external_userid"]) m.ExternalUserid = cast.ToString(data["external_userid"])
m.ServicerUserid = cast.ToString(data["servicer_userid"]) m.ServicerUserid = cast.ToString(data["servicer_userid"])
m.OpenKfid = cast.ToString(data["open_kfid"]) m.OpenKfid = cast.ToString(data["open_kfid"])
m.Raw = goutil.EncodeJSON(data)
if m.Msgtype == message.MsgTypeEvent { if m.Msgtype == message.MsgTypeEvent {
m.parseEvent(data) m.parseEvent(data)