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 InstanceAppConfig
- {
- //push_type 0:notification;1,pass-through
- private $pushtype;
- private $pushbody;
- private $fields;
- public function __construct()
- {
- }
- public function pushtype($value)
- {
- $this->pushtype = $value;
- }
- public function pushbody($value)
- {
- $this->pushbody = $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(
- 'pushtype',
- 'pushbody'
- );
- 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);
- }
- }
|