蛋蛋星球-制度模式
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.

client_report.go 743 B

1 month ago
123456789101112131415161718192021222324252627282930313233
  1. package jpush
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "errors"
  6. "strings"
  7. )
  8. func (c *Client) ReportReceived(msgIds []string) ([]interface{}, error) {
  9. if len(msgIds) == 0 {
  10. return nil, errors.New("msgIds不能为空")
  11. }
  12. link := c.reportUrl + "/v3/received?msg_ids=" + strings.Join(msgIds, ",")
  13. resp, err := c.request("GET", link, nil, false)
  14. if err != nil {
  15. return nil, err
  16. }
  17. return resp.Array()
  18. }
  19. func (c *Client) ReportStatusMessage(req *ReportStatusRequest) (map[string]interface{}, error) {
  20. link := c.reportUrl + "/v3/status/message"
  21. buf, err := json.Marshal(req)
  22. if err != nil {
  23. return nil, err
  24. }
  25. resp, err := c.request("POST", link, bytes.NewReader(buf), false)
  26. if err != nil {
  27. return nil, err
  28. }
  29. return resp.Map()
  30. }