Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smsManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cristian Mauricio Diaz Canales
smsManager
Commits
df0c569d
Commit
df0c569d
authored
Jul 10, 2019
by
Ana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cambios
parent
e278cb59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
src/BackendBundle/Controller/EnvioSmsController.php
src/BackendBundle/Controller/EnvioSmsController.php
+13
-2
No files found.
src/BackendBundle/Controller/EnvioSmsController.php
View file @
df0c569d
...
@@ -37,21 +37,25 @@ class EnvioSmsController extends FOSRestController {
...
@@ -37,21 +37,25 @@ class EnvioSmsController extends FOSRestController {
$mensaje
=
$_POST
[
'mensaje'
];
$mensaje
=
$_POST
[
'mensaje'
];
$idmetodo
=
$_POST
[
'idmetodo'
];
$idmetodo
=
$_POST
[
'idmetodo'
];
$log
=
Utiles
::
setLog
(
'BackendBundle'
,
'backend/backend'
);
$log
=
Utiles
::
setLog
(
'BackendBundle'
,
'backend/backend'
);
$log
->
debug
(
count
(
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$telefono
)
->
find
()));
$log
->
debug
(
count
(
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$telefono
)
->
find
()));
$notifica
=
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$telefono
)
->
find
();
$notifica
=
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$telefono
)
->
find
();
//$log->debug('mensaje: ' . $mensaje);
$usuario
=
""
;
$usuario
=
""
;
$password
=
""
;
$password
=
""
;
$url
=
""
;
$url
=
""
;
if
(
$idmetodo
==
1
)
{
//nrsgateway
if
(
$idmetodo
==
1
)
{
//nrsgateway
// $log->debug('mensajeee: ' . $mensaje);
$usuario
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_user'
);
$usuario
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_user'
);
$password
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_pws'
);
$password
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_pws'
);
$url
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_url'
);
$url
=
Utiles
::
getParametroConfiguracion
(
'nrsgateway_url'
);
return
$this
->
enviarMensaje
(
$campana
,
$telefono
,
$mensaje
,
$usuario
,
$password
,
$url
);
return
$this
->
enviarMensaje
(
$campana
,
$telefono
,
$mensaje
,
$usuario
,
$password
,
$url
);
}
else
{
//teltech
}
else
{
//teltech
if
(
$idmetodo
==
2
)
{
if
(
$idmetodo
==
2
)
{
$usuario
=
Utiles
::
getParametroConfiguracion
(
'teltech_user'
);
$usuario
=
Utiles
::
getParametroConfiguracion
(
'teltech_user'
);
...
@@ -66,13 +70,17 @@ class EnvioSmsController extends FOSRestController {
...
@@ -66,13 +70,17 @@ class EnvioSmsController extends FOSRestController {
private
function
enviarMensaje
(
$campana
,
$movil
,
$mensaje
,
$usuario
,
$password
,
$url
)
{
private
function
enviarMensaje
(
$campana
,
$movil
,
$mensaje
,
$usuario
,
$password
,
$url
)
{
try
{
try
{
$log
=
Utiles
::
setLog
(
'BackendBundle'
,
'backend/backend'
);
$post
[
'to'
]
=
array
(
$movil
);
$post
[
'to'
]
=
array
(
$movil
);
$post
[
'text'
]
=
$mensaje
;
$post
[
'text'
]
=
$mensaje
;
$post
[
'from'
]
=
$movil
;
$post
[
'from'
]
=
$movil
;
$post
[
'dlr-url'
]
=
Utiles
::
getParametroConfiguracion
(
"url_base"
)
.
"/api/notifica/"
.
$campana
.
"/%P/%d"
;
$post
[
'dlr-url'
]
=
Utiles
::
getParametroConfiguracion
(
"url_base"
)
.
"/api/notifica/"
.
$campana
.
"/%P/%d"
;
$user
=
$usuario
;
$user
=
$usuario
;
$password
=
$password
;
$password
=
$password
;
$ch
=
curl_init
();
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
...
@@ -82,6 +90,9 @@ class EnvioSmsController extends FOSRestController {
...
@@ -82,6 +90,9 @@ class EnvioSmsController extends FOSRestController {
"Content-Type: application/json"
,
"Content-Type: application/json"
,
"Authorization: Basic "
.
base64_encode
(
$user
.
":"
.
$password
)
"Authorization: Basic "
.
base64_encode
(
$user
.
":"
.
$password
)
));
));
$result
=
curl_exec
(
$ch
);
$result
=
curl_exec
(
$ch
);
$array
=
json_decode
(
$result
,
true
);
$array
=
json_decode
(
$result
,
true
);
...
@@ -95,7 +106,7 @@ class EnvioSmsController extends FOSRestController {
...
@@ -95,7 +106,7 @@ class EnvioSmsController extends FOSRestController {
return
$resp
;
return
$resp
;
}
else
{
}
else
{
$log
=
Utiles
::
setLog
(
'BackendBundle'
,
'backend/backend'
);
$log
=
Utiles
::
setLog
(
'BackendBundle'
,
'backend/backend'
);
$log
->
debug
(
'entra: '
.
count
(
$notifica
));
$notifica
=
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$movil
)
->
find
();
$notifica
=
NotificaQuery
::
create
()
->
filterByCampana
(
$campana
)
->
filterByTelefono
(
$movil
)
->
find
();
$resp
=
""
;
$resp
=
""
;
...
@@ -105,7 +116,7 @@ class EnvioSmsController extends FOSRestController {
...
@@ -105,7 +116,7 @@ class EnvioSmsController extends FOSRestController {
$estado
=
$noti
->
getEstado
();
$estado
=
$noti
->
getEstado
();
}
}
$resp
=
array
(
$resp
=
array
(
'success'
=>
fals
e
,
'success'
=>
tru
e
,
'statusCode'
=>
$estado
'statusCode'
=>
$estado
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment