Brak opisu

Stats.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 获取发送的消息统计数据.
  4. * @author wangkuiwei
  5. * @name Stats
  6. * @desc 获取发送的消息统计数据。
  7. *
  8. */
  9. namespace xmpush;
  10. class Stats extends HttpBase {
  11. private $package; //android用
  12. private $bundle; //ios用
  13. public function __construct() {
  14. parent::__construct();
  15. $this->package = Constants::$packageName;
  16. $this->bundle = Constants::$bundle_id;
  17. }
  18. public function getStats($startDate, $endDate, $type = 'android', $retries = 1) {
  19. if ($type == 'ios') {
  20. $fields = array(
  21. 'start_date' => $startDate,
  22. 'end_date' => $endDate,
  23. 'restricted_package_name' => $this->bundle
  24. );
  25. } else {
  26. $fields = array(
  27. 'start_date' => $startDate,
  28. 'end_date' => $endDate,
  29. 'restricted_package_name' => $this->package
  30. );
  31. }
  32. $url = Constants::$domain . Constants::stats_url;
  33. $result = $this->getResult($url, $fields, $retries);
  34. return $result;
  35. }
  36. }
  37. ?>