Browse Source

add action SystemMessage

main
lucas cardoso 2 years ago
parent
commit
69afe6fcc7
  1. 21
      app/Actions/SystemMessageAction.php

21
app/Controllers/SystemMessageController.php → app/Actions/SystemMessageAction.php

@ -1,32 +1,25 @@
<?php
namespace app\Controllers;
namespace app\Actions;
use app\Core\Controller;
use app\Interfaces\IApiMedia;
use app\Models\SystemMessage;
use Exception;
/**
* Description of SupervisorController
*
* @author root
*/
class SystemMessageController extends Controller
class SystemMessageAction
{
/** @var SystemMessage $sysMessage model de mensagens do sistema */
protected $sysMessage;
protected SystemMessage $sysMessage;
public function __construct()
function __construct()
{
$this->sysMessage = new SystemMessage();
}
public function sendMessageSystem($momento, $variavels, IApiMedia $api, $numero, $fila = null)
function __invoke($momento, $variavels, IApiMedia $api, $numero, $fila = null)
{ //$variavels = [["nome" => '@cliente', "valor" => 'afonso']]
try {
$msgs = $this->sysMessage->findMessage($momento, $fila);
$msgs = $this->sysMessage->get(['momento' => $momento, 'fila' => $fila]);
if (empty($msgs)) {
$msgs = $this->sysMessage->findMessage($momento);
$msgs = $this->sysMessage->get(['momento' => $momento]);
}
foreach ($msgs as $key => $msg) {
Loading…
Cancel
Save