123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Libs\Push\HuaWei\Admin\Msg\InstanceApp;
- use App\Libs\Push\HuaWei\Admin\Constants;
- use App\Libs\Push\HuaWei\Admin\PushLogConfig;
- class InstanceAppRingTone
- {
- private $vibration;
- private $breathLight;
- private $fields;
- public function __construct()
- {
- $this->fields = array();
- }
- public function vibration($value)
- {
- $this->vibration = $value;
- }
- public function breathLight($value)
- {
- $this->breathLight = $value;
- }
- public function getFields()
- {
- $result = "{";
- foreach ($this->fields as $key => $value) {
- $result = $result . $key . ":" . json_encode($value) . ",";
- PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][result:' . $result, Constants::HW_PUSH_LOG_DEBUG_LEVEL);
- }
- if (strlen($result) > 1) {
- $result = rtrim($result, ",");
- }
- $result = $result . "}";
- return $result;
- }
- public function buildFields()
- {
- $keys = array(
- 'vibration',
- 'breathLight'
- );
- foreach ($keys as $key) {
- PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][key:' . $key . '][value:' . json_encode($this->$key) . ']', Constants::HW_PUSH_LOG_DEBUG_LEVEL);
- if (isset($this->$key)) {
- $this->fields[$key] = $this->$key;
- }
- }
- PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][buildFields result:' . json_encode($this->fields), Constants::HW_PUSH_LOG_DEBUG_LEVEL);
- }
- }
|