123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Libs\Push\HuaWei\Admin\Msg\Apns;
- use App\Libs\Push\HuaWei\Admin\Constants;
- use App\Libs\Push\HuaWei\Admin\PushLogConfig;
- class Aps
- {
- private $alert;
- private $badge;
- private $sound;
- private $content_available;
- private $category;
- private $thread_id;
- private $fields;
- public function alert($value)
- {
- $this->alert = $value;
- }
- public function badge($value)
- {
- $this->badge = $value;
- }
- public function sound($value)
- {
- $this->sound = $value;
- }
- public function content_available($value)
- {
- $this->content_available = $value;
- }
- public function category($value)
- {
- $this->category = $value;
- }
- public function thread_id($value)
- {
- $this->thread_id = $value;
- }
- public function getFields()
- {
- return $this->fields;
- }
- public function buildFields()
- {
- $keys = array(
- 'alert',
- 'badge',
- 'sound',
- 'content-available',
- 'category',
- 'thread-id'
- );
- foreach ($keys as $key) {
- $value = str_replace('-', '_', $key);
- PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][before key:' . $key . '][after key:' . $value . ']', Constants::HW_PUSH_LOG_DEBUG_LEVEL);
- if (isset($this->$value)) {
- $this->fields[$key] = $this->$value;
- }
- }
- PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][buildFields result:' . json_encode($this->fields), Constants::HW_PUSH_LOG_DEBUG_LEVEL);
- }
- }
|