Fix user notification v3

This commit is contained in:
Djery-Tom 2021-10-28 13:18:01 +01:00
parent dc5b4283da
commit 9c8c85bcc7
1 changed files with 7 additions and 4 deletions

View File

@ -9,6 +9,7 @@ use GuzzleHttp\Client;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use stdClass;
use Throwable; use Throwable;
class NotifyUser class NotifyUser
@ -43,7 +44,7 @@ class NotifyUser
$headers = [ $headers = [
'Authorization' => config('services.notification_service.key'), 'Authorization' => config('services.notification_service.key'),
]; ];
$body = new \stdClass(); $body = new stdClass();
$body->title = $event->mailTitle; $body->title = $event->mailTitle;
$body->message = $event->mailMessage; $body->message = $event->mailMessage;
$body->email = $user->email; $body->email = $user->email;
@ -51,13 +52,15 @@ class NotifyUser
$client->request('POST', '/send-mail', ['json' => $body, 'headers' => $headers]); $client->request('POST', '/send-mail', ['json' => $body, 'headers' => $headers]);
if (isset($event->notification)) { if (isset($event->notification)) {
$body = new \stdClass(); $body = new stdClass();
$body->user_code = $user->user_code; $body->user_code = $user->user_code;
$body->message = $event->notification; $body->message = $event->notification;
$data = new \stdClass(); $data = new stdClass();
$data->screen = "notificationview"; $data->screen = "notificationview";
$data->data = new \stdClass(); $data->data = new stdClass();
$data->data->subscription_id = $data->data->id = $subscription->id; $data->data->subscription_id = $data->data->id = $subscription->id;
$body->data = $data;
try { try {
$body->date = $this->getCurrentTimeByCountryCode($user->network->country->code_country); $body->date = $this->getCurrentTimeByCountryCode($user->network->country->code_country);
} catch (Throwable $t) { } catch (Throwable $t) {