prueba

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