Kaynağa Gözat

message json tag

huangguangrong 7 ay önce
ebeveyn
işleme
6a3fbdeb94
1 değiştirilmiş dosya ile 26 ekleme ve 26 silme
  1. 26 26
      types/message.go

+ 26 - 26
types/message.go

@@ -14,41 +14,41 @@ const (
 
 type (
 	Msg struct {
-		MType       `mapstructure:"mType"`
-		Content     string            `mapstructure:"content"`     //内容
-		MsgID       string            `mapstructure:"msgId"`       // 消息id
-		ReadRecords map[string]string `mapstructure:"readRecords"` // 阅读消息记录
+		MType       MType             `mapstructure:"mType" json:"mType"`
+		Content     string            `mapstructure:"content" json:"content"`         //内容
+		MsgID       string            `mapstructure:"msgId" json:"msgId"`             // 消息id
+		ReadRecords map[string]string `mapstructure:"readRecords" json:"readRecords"` // 阅读消息记录
 	}
 
 	Chat struct {
-		ConversationId string                    `mapstructure:"conversationId"` // 会话id
-		ChatType       `mapstructure:"chatType"` // 会话类型
-		SendID         int64                     `mapstructure:"sendId"` //发送者
-		RecvID         int64                     `mapstructure:"recvId"` //接收者
-		Msg            `mapstructure:"msg"`      // 消息接口
-		SendTime       int64                     `mapstructure:"sendTime"` // 消息发送时间
+		ConversationId string   `mapstructure:"conversationId" json:"conversationId"` // 会话id
+		ChatType       ChatType `mapstructure:"chatType" json:"chatType""`            // 会话类型
+		SendID         int64    `mapstructure:"sendId" json:"sendId"`                 //发送者
+		RecvID         int64    `mapstructure:"recvId" json:"recvId"`                 //接收者
+		Msg            Msg      `mapstructure:"msg" json:"msg"`                       // 消息接口
+		SendTime       int64    `mapstructure:"sendTime" json:"sendTime"`             // 消息发送时间
 	}
 
 	Push struct {
-		ConversationId string                    `mapstructure:"conversationId"` // 会话id
-		ChatType       `mapstructure:"chatType"` // 会话类型
-		SendID         int64                     `mapstructure:"sendId"`      //发送者
-		RecvID         int64                     `mapstructure:"recvId"`      //接收者
-		RecvIDs        []int64                   `mapstructure:"recvIds"`     //多个接收者
-		SendTime       int64                     `mapstructure:"sendTime"`    //消息发送时间
-		MsgID          string                    `mapstructure:"msgId"`       // 消息id
-		ReadRecords    map[string]string         `mapstructure:"readRecords"` //消息阅读记录
-		ContentType    ContentType               `mapstructure:"contentType"` // 消息内容类型
-		MType          `mapstructure:"mType"`
-		Content        string `mapstructure:"content"` // 消息内容
-		ID             string `json:"id"`              // 消息id
+		ConversationId string            `mapstructure:"conversationId" json:"conversationId"` // 会话id
+		ChatType       ChatType          `mapstructure:"chatType" json:"chatType"`             // 会话类型
+		SendID         int64             `mapstructure:"sendId" json:"sendId"`                 //发送者
+		RecvID         int64             `mapstructure:"recvId" json:"recvId"`                 //接收者
+		RecvIDs        []int64           `mapstructure:"recvIds" json:"recvIds"`               //多个接收者
+		SendTime       int64             `mapstructure:"sendTime" json:"sendTime"`             //消息发送时间
+		MsgID          string            `mapstructure:"msgId" json:"msgId"`                   // 消息id
+		ReadRecords    map[string]string `mapstructure:"readRecords" json:"readRecords"`       //消息阅读记录
+		ContentType    ContentType       `mapstructure:"contentType" json:"contentType"`       // 消息内容类型
+		MType          MType             `mapstructure:"mType" json:"mType"`
+		Content        string            `mapstructure:"content" json:"content"` // 消息内容
+		ID             string            `json:"id"`                             // 消息id
 	}
 
 	MarkRead struct {
-		ChatType       `mapstructure:"chatType"`
-		RecvID         int64    `mapstructure:"recvId"` //接收者
-		ConversationId string   `mapstructure:"conversationId"`
-		MsgIds         []string `mapstructure:"msgIds"`
+		ChatType       `mapstructure:"chatType" json:"chatType"`
+		RecvID         int64    `mapstructure:"recvId" json:"recvId"` //接收者
+		ConversationId string   `mapstructure:"conversationId" json:"conversationId"`
+		MsgIds         []string `mapstructure:"msgIds" json:"msgIds"`
 	}
 
 	MessagePushData struct {