Stats.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * 获取发送的消息统计数据.
  4. * @author wangkuiwei
  5. * @name Stats
  6. * @desc 获取发送的消息统计数据。
  7. *
  8. */
  9. namespace App\Libs\Push\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. $result = $this->getResult(PushRequestPath::V1_GET_MESSAGE_COUNTERS(), $fields, $retries);
  33. return $result;
  34. }
  35. }
  36. ?>