trans README

This commit is contained in:
JunDao
2019-05-03 09:53:26 +08:00
parent 603ab9b09d
commit e3e10e5eee
3 changed files with 8 additions and 4 deletions

View File

@ -31,9 +31,9 @@ type jsonChat struct {
//UnmarshalJSON decode json to Message
func (m *Message) UnmarshalJSON(jsonMsg []byte) (err error) {
if jsonMsg[0] == '"' {
err = json.Unmarshal(jsonMsg, &m.Text)
err = json.Unmarshal(jsonMsg, &m.Text) //Unmarshal as jsonString
} else {
err = json.Unmarshal(jsonMsg, (*jsonChat)(m))
err = json.Unmarshal(jsonMsg, (*jsonChat)(m)) //Unmarshal as jsonChat
}
return
}