(host, webCmd, data string)
| 220 | } |
| 221 | |
| 222 | func (c *QQClient) webSsoRequest(host, webCmd, data string) (string, error) { |
| 223 | s := strings.Split(host, `.`) |
| 224 | sub := "" |
| 225 | for i := len(s) - 1; i >= 0; i-- { |
| 226 | sub += s[i] |
| 227 | if i != 0 { |
| 228 | sub += "_" |
| 229 | } |
| 230 | } |
| 231 | cmd := "MQUpdateSvc_" + sub + ".web." + webCmd |
| 232 | req, _ := proto.Marshal(&service.WebSsoRequestBody{ |
| 233 | Type: proto.Uint32(0), |
| 234 | Data: proto.Some(data), |
| 235 | }) |
| 236 | rspData, err := c.sendUniPacketAndWait(cmd, req) |
| 237 | if err != nil { |
| 238 | return "", errors.Wrap(err, "send web sso request error") |
| 239 | } |
| 240 | rsp := &service.WebSsoResponseBody{} |
| 241 | if err = proto.Unmarshal(rspData, rsp); err != nil { |
| 242 | return "", errors.Wrap(err, "unmarshal response error") |
| 243 | } |
| 244 | return rsp.Data.Unwrap(), nil |
| 245 | } |
| 246 | |
| 247 | func (c *QQClient) doHeartbeat() { |
| 248 | for c.Online.Load() { |
no test coverage detected