Kaynağa Gözat

Ajustes para envío de notificación

Hugo Quijada 2 yıl önce
ebeveyn
işleme
d0bc9db546

+ 6 - 12
commands/EventoController.php

@@ -864,24 +864,18 @@ class EventoController extends Controller {
           
           if ($totalParticipaciones === $totalEventos){
             $parametros[] = [
-              [
-                "type" => "text",
-                "text" => "gracias por tu"
-              ]
+              "type" => "text",
+              "text" => "Gracias por tu"
             ];
           } else if ($totalParticipaciones > 0) {
             $parametros[] = [
-              [
-                "type" => "text",
-                "text" => "gracias por tu participación. Vamos por el 100% de"
-              ]
+              "type" => "text",
+              "text" => ", gracias por tu participación. Vamos por el 100% de"
             ];
           } else {
             $parametros[] = [
-              [
-                "type" => "text",
-                "text" => "Vamos por el 100% de"
-              ]
+              "type" => "text",
+              "text" => "Vamos por el 100% de"
             ];
           }
           $notificacionUsuario->parametros = $parametros;

+ 8 - 5
commands/ParticipacionController.php

@@ -2,23 +2,23 @@
 
 namespace app\commands;
 
-use app\components\NotificacionController;
+use app\components\NotificacionController as Controller;
 use app\components\Whatsapp;
 use app\models\Notificacion;
 use app\models\NotificacionUsuario;
-use yii\db\Expression;
-use yii\db\Query;
 
-class ParticipacionController extends NotificacionController {
+class NotificacionController extends Controller {
 
   public function actionParticipacion() {
 
-    $notificacion = $this->consultarNorificacion();
+    $notificacion = $this->consultarNotificacion();
     if ($notificacion === null) {
       $this->stdout("No hay notificaciones pendientes\n");
       return;
     }
 
+    $this->stdout("Procesando notificación {$notificacion->id}\n");
+
     $params = \Yii::$app->params;
     $wab = null;
     if(isset($params["wab"])) {
@@ -65,6 +65,9 @@ class ParticipacionController extends NotificacionController {
             return;
           }
 
+          $nu->detalle = $resultado;
+          $nu->save();
+
           // $this->stdout("Proceso terminado\n");
         } catch (\Exception $e) {
           $this->stdout("Error al enviar el mensaje: {$e->getMessage()}\n");

+ 1 - 1
components/NotificacionController.php

@@ -15,7 +15,7 @@ class NotificacionController extends Controller {
     }
   }
 
-  public function consultarNorificacion() {
+  public function consultarNotificacion() {
 
     $query = Notificacion::find()
       ->orderBy(["id" => SORT_ASC]);