diff --git a/app/common/service/JgPushService.php b/app/common/service/JgPushService.php index e96f8a2..8b4054f 100644 --- a/app/common/service/JgPushService.php +++ b/app/common/service/JgPushService.php @@ -27,6 +27,7 @@ } public function sendMsg($register_id,$message,$route = '',$type = 1){ + $res = true; try { $this->client = new Client($this->iosKey, $this->iosSecret); $this->push = $this->client->push(); @@ -35,10 +36,9 @@ $this->push->iosNotification($message, ['extras' => ['route' => $route, 'type' => $type]]); $this->push->send(); unset($this->client, $this->push); - return true; } catch (\Exception $e) { Log::error($e->getMessage()); - return $e->getMessage(); + $res = false; } try { $this->client = new Client($this->azKey, $this->azSecret); @@ -48,11 +48,11 @@ $this->push->androidNotification($message, ['extras' => ['route' => $route, 'type' => $type]]); $this->push->send(); unset($this->client, $this->push); - return true; + $res = true; } catch (\Exception $e) { Log::error($e->getMessage()); - return $e->getMessage(); - + $res = false; } + return $res; } } \ No newline at end of file