You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
479 B
24 lines
479 B
package base
|
|
|
|
import "encoding/json"
|
|
|
|
type WebSocketV2ResponseBase struct {
|
|
Action string `json:"action"`
|
|
Code int32 `json:"code"`
|
|
Ch string `json:"ch"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
func (p *WebSocketV2ResponseBase) IsSuccess() bool {
|
|
return p.Code == 200
|
|
}
|
|
|
|
func ParseWSV2Resp(message string) *WebSocketV2ResponseBase {
|
|
result := &WebSocketV2ResponseBase{}
|
|
err := json.Unmarshal([]byte(message), result)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
return result
|
|
}
|
|
|