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

34 lines
743 B

  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. }