From 819e90860111587ed3350878478b16e9443587f0 Mon Sep 17 00:00:00 2001 From: pyBlockin <54303354+pyBlockin@users.noreply.github.com> Date: Tue, 19 May 2020 20:42:05 +0800 Subject: [PATCH 1/3] fix PHP7 ErrorException PHP 8: '+'/'-' will take a higher precedence --- src/sdk/IGtPush.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/IGtPush.php b/src/sdk/IGtPush.php index ecbaad8..2d6b680 100644 --- a/src/sdk/IGtPush.php +++ b/src/sdk/IGtPush.php @@ -348,7 +348,7 @@ private function getListAppContentId($message, $taskGroupName = null) if ($rep['result'] == 'ok') { return $rep['contentId']; } else { - throw new \Exception("host:[" . $this->host . "]" + "获取contentId失败:" . $rep); + throw new \Exception("host:[" . $this->host . "]" . "获取contentId失败:" . $rep); } } @@ -407,7 +407,7 @@ public function getAPNContentId($appId, $message) if ($rep['result'] == 'ok') { return $rep['contentId']; } else { - throw new \Exception("host:[" . $this->host . "]" + "获取contentId失败:" . $rep); + throw new \Exception("host:[" . $this->host . "]" . "获取contentId失败:" . $rep); } } From fbc0bf78c81c07a03eb81ae15962b6770c8710b2 Mon Sep 17 00:00:00 2001 From: mengfanzhen Date: Wed, 19 Aug 2020 13:54:40 +0800 Subject: [PATCH 2/3] cmt --- src/Getui.php | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/Getui.php b/src/Getui.php index 85573f1..836738a 100644 --- a/src/Getui.php +++ b/src/Getui.php @@ -9,6 +9,7 @@ use Cncal\Getui\Sdk\IGetui\IGtListMessage; use Cncal\Getui\Sdk\IGetui\IGtSingleMessage; use Cncal\Getui\Sdk\IGetui\Template\GetuiTemplate; +use Cncal\Getui\Sdk\IGetui\Utils\AppConditions; class Getui { @@ -95,14 +96,14 @@ public function pushMessageToSingle($data) $cid = $data['cid']; $is_off_line = isset($data['template_data']['is_offline']) ? - (bool)$data['template_data']['is_offline'] : $this->is_offline; + (bool)$data['template_data']['is_offline'] : $this->is_offline; $offline_expire_time = isset($data['template_data']['is_offline']) ? - (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : - $this->offline_expire_time * 1000 * 3600; + (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : + $this->offline_expire_time * 1000 * 3600; $network_type = isset($data['template_data']['network_type']) ? - (int)$data['template_data']['network_type'] : $this->network_type; + (int)$data['template_data']['network_type'] : $this->network_type; // todo: need to discuss $getui_template = new GetuiTemplate($template_type, $template_data); @@ -126,8 +127,8 @@ public function pushMessageToSingle($data) // 使用队列 if ($this->queue_is_used) { PushGetuiMessage::dispatch($this->igt, 'pushMessageToSingle', $message, $target) - ->onConnection($this->queue_connection) - ->onQueue($this->queue_queue); + ->onConnection($this->queue_connection) + ->onQueue($this->queue_queue); return true; } @@ -151,14 +152,14 @@ public function pushMessageToList($data) $template_data = $data['template_data']; $is_off_line = isset($data['template_data']['is_offline']) ? - (bool)$data['template_data']['is_offline'] : $this->is_offline; + (bool)$data['template_data']['is_offline'] : $this->is_offline; $offline_expire_time = isset($data['template_data']['is_offline']) ? - (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : - $this->offline_expire_time * 1000 * 3600; + (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : + $this->offline_expire_time * 1000 * 3600; $network_type = isset($data['template_data']['network_type']) ? - (int)$data['template_data']['network_type'] : $this->network_type; + (int)$data['template_data']['network_type'] : $this->network_type; $getui_template = new GetuiTemplate($template_type, $template_data); $template = $getui_template->getTemplate(); @@ -186,8 +187,8 @@ public function pushMessageToList($data) // 使用队列 if ($this->queue_is_used) { PushGetuiMessage::dispatch($this->igt, 'pushMessageToList', $contentId, $target_list) - ->onConnection($this->queue_connection) - ->onQueue($this->queue_queue); + ->onConnection($this->queue_connection) + ->onQueue($this->queue_queue); return true; } @@ -211,21 +212,27 @@ public function pushMessageToApp($data) $template_data = $data['template_data']; $is_off_line = isset($data['template_data']['is_offline']) ? - (bool)$data['template_data']['is_offline'] : $this->is_offline; + (bool)$data['template_data']['is_offline'] : $this->is_offline; $offline_expire_time = isset($data['template_data']['is_offline']) ? - (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : - $this->offline_expire_time * 1000 * 3600; + (int)$data['template_data']['offline_expire_time'] * 1000 * 3600 : + $this->offline_expire_time * 1000 * 3600; $network_type = isset($data['template_data']['network_type']) ? - (int)$data['template_data']['network_type'] : $this->network_type; + (int)$data['template_data']['network_type'] : $this->network_type; // todo: need to discuss $getui_template = new GetuiTemplate($template_type, $template_data); $template = $getui_template->getTemplate(); + $cdt = new AppConditions(); + $cdt->addCondition3(AppConditions::PHONE_TYPE, $phoneTypeList); + $cdt->addCondition3(AppConditions::REGION, $provinceList); + $cdt->addCondition3(AppConditions::TAG, $data['tag_list']); + $message = new IGtAppMessage(); $message->set_isOffline($is_off_line); + $message->set_conditions($cdt); if ($is_off_line) { $message->set_offlineExpireTime($offline_expire_time); @@ -238,8 +245,8 @@ public function pushMessageToApp($data) // 使用队列 if ($this->queue_is_used) { PushGetuiMessage::dispatch($this->igt, 'pushMessageToApp', $message) - ->onConnection($this->queue_connection) - ->onQueue($this->queue_queue); + ->onConnection($this->queue_connection) + ->onQueue($this->queue_queue); return true; } From 3d4f7a25f8378bdf524a2fe04e5ab68800087646 Mon Sep 17 00:00:00 2001 From: mengfanzhen Date: Wed, 19 Aug 2020 13:58:01 +0800 Subject: [PATCH 3/3] cmt --- src/Getui.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Getui.php b/src/Getui.php index 836738a..c7e00f2 100644 --- a/src/Getui.php +++ b/src/Getui.php @@ -226,8 +226,8 @@ public function pushMessageToApp($data) $template = $getui_template->getTemplate(); $cdt = new AppConditions(); - $cdt->addCondition3(AppConditions::PHONE_TYPE, $phoneTypeList); - $cdt->addCondition3(AppConditions::REGION, $provinceList); + $cdt->addCondition3(AppConditions::PHONE_TYPE, $data['phone_type_list']); + $cdt->addCondition3(AppConditions::REGION, $data['province_list']); $cdt->addCondition3(AppConditions::TAG, $data['tag_list']); $message = new IGtAppMessage();