prueba

parent 866cbbdf
......@@ -6,23 +6,20 @@ use FOS\RestBundle\Controller\FOSRestController;
use AppBundle\Lib\Utiles;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
//use Symfony\Component\Routing\Annotation\Route;
use AppBundle\Model\NotificaQuery;
use AppBundle\Model\Notifica;
use AppBundle\Model\RespuestasSmsQuery;
use AppBundle\Model\RespuestasSms;
require_once __DIR__ . '/../../../vendor/autoload.php';
use FOS\RestBundle\View\View;
//use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
class EnvioSmsController extends FOSRestController {
//* @Route("/enviar")
public function indexAction($id) {
......@@ -31,7 +28,6 @@ class EnvioSmsController extends FOSRestController {
return $this->handleView($view);
}
// * @Route("/enviar")
// * @Method({"POST"})
......@@ -63,7 +59,6 @@ class EnvioSmsController extends FOSRestController {
return $this->enviarMensaje($campana, $telefono, $mensaje, $usuario, $password, $url, $from, $idmetodo);
} else { //teltech
if ($idmetodo == 2) {
$log->debug('Selecciona Teltech');
......@@ -79,7 +74,7 @@ class EnvioSmsController extends FOSRestController {
}
private function enviarMensaje($campana, $movil, $mensaje, $usuario, $password, $url, $from, $proveedor) {
try {
$log = Utiles::setLog('BackendBundle', 'backend/backend');
......@@ -145,6 +140,7 @@ class EnvioSmsController extends FOSRestController {
}
}
$log->debug('Grabar en respuestaSms');
try {
$respuestaSms = new RespuestasSms();
$respuestaSms->setResCampana($campana);
$respuestaSms->setResProveedorSms($proveedor);
......@@ -156,8 +152,7 @@ class EnvioSmsController extends FOSRestController {
return $resp;
} catch (\Exception $e) {
$log = Utiles::setLog('exception');
$log->debug('exception: ' . $e);
$log->debug('exception: ' . print_r($e, true));
}
}
......@@ -181,7 +176,6 @@ class EnvioSmsController extends FOSRestController {
return $messageId;
}
// * @Route("/buscarstatus")
// * @Method({"POST"})
public function buscarStatusAction() {
......@@ -218,8 +212,8 @@ class EnvioSmsController extends FOSRestController {
if ($result['events']) {
$status = json_decode($result['events'][0]['message'], true);
$telefono= $status['delivery']['destination'];
$estado= $status['status'];
$telefono = $status['delivery']['destination'];
$estado = $status['status'];
$notifica = new Notifica();
......@@ -241,8 +235,8 @@ class EnvioSmsController extends FOSRestController {
$telefono = '';
if ($result['events']) {
$status = json_decode($result['events'][0]['message'], true);
$telefono= $status['delivery']['destination'];
$estado= $status['status'];
$telefono = $status['delivery']['destination'];
$estado = $status['status'];
$notifica = new Notifica();
......@@ -263,7 +257,6 @@ class EnvioSmsController extends FOSRestController {
}
}
// * @Route("/notifica/{idenvio}/{tel}/{estado}")
public function notificaAction($idenvio, $tel, $estado) {
......@@ -274,4 +267,5 @@ class EnvioSmsController extends FOSRestController {
$notifica->save();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment