2 次代碼提交 3f8c02469a ... eb423094e2

作者 SHA1 備註 提交日期
  Gustavo Zanatta eb423094e2 fix cancelamento sobmedida que nao teve aceite de prestador ainda 2 天之前
  Gustavo Zanatta fbc12d4ca0 fix push 1h, removido dispatch de teste 2 天之前
共有 1 個文件被更改,包括 15 次插入9 次删除
  1. 15 9
      app/Services/ScheduleService.php

+ 15 - 9
app/Services/ScheduleService.php

@@ -260,13 +260,19 @@ class ScheduleService
 
 
                     switch (Auth::user()?->type) {
                     switch (Auth::user()?->type) {
                         case UserTypeEnum::CLIENT:
                         case UserTypeEnum::CLIENT:
+                            $user = $schedule->provider?->user;
+
+                          if(!$user) {
+                            break;
+                          }
+
                             $notificationService->create([
                             $notificationService->create([
                                 'title'       => __('notifications.schedule_cancelled_title'),
                                 'title'       => __('notifications.schedule_cancelled_title'),
                                 'description' => __('notifications.client_cancelled_schedule_description'),
                                 'description' => __('notifications.client_cancelled_schedule_description'),
                                 'origin'      => 'schedule',
                                 'origin'      => 'schedule',
                                 'origin_id'   => $schedule->id,
                                 'origin_id'   => $schedule->id,
                                 'type'        => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_CANCELLED->value,
                                 'type'        => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_CANCELLED->value,
-                                'user_id'     => $schedule->provider->user_id,
+                                'user_id'     => $user->id,
                             ]);
                             ]);
                             $this->sendClientCancelledPush($schedule);
                             $this->sendClientCancelledPush($schedule);
 
 
@@ -362,17 +368,17 @@ class ScheduleService
                     // =====================================================
                     // =====================================================
 
 
                     // TESTE LOCAL: dispara 15 segundos depois do pagamento
                     // TESTE LOCAL: dispara 15 segundos depois do pagamento
-                    ScheduleStartingSoonJob::dispatch($schedule->id)
-                        ->delay(now()->addSeconds(15));
+                    // ScheduleStartingSoonJob::dispatch($schedule->id)
+                    //     ->delay(now()->addSeconds(15));
 
 
-                    /*
-                        PRODUÇÃO: dispara 1 hora antes do início
+                    
+                        // PRODUÇÃO: dispara 1 hora antes do início
 
 
-                        $notification_date_time = $start_date_time->copy()->subHour();
+                    $notification_date_time = $start_date_time->copy()->subHour();
 
 
-                        ScheduleStartingSoonJob::dispatch($schedule->id)
-                            ->delay($notification_date_time);
-                        */
+                    ScheduleStartingSoonJob::dispatch($schedule->id)
+                        ->delay($notification_date_time);
+                        
 
 
                     // =====================================================
                     // =====================================================
                     // StartScheduleJob
                     // StartScheduleJob