Segundo tipo wapush-masivo

parent cd2ebf69
......@@ -41,7 +41,9 @@ class EnviarWapushUsuariosCommand extends Command {
$fechaSiguiente = new \DateTime();
$ultimaFechaEjecucion = $this->em->getRepository(PluEntelWapushProximaFecha::class)->getUltimaFechaEjecucion();
$ejecutar = 0;
$arraySuscripciones = array();
$arrayMsisdn = array();
if ($ultimaFechaEjecucion == null) {
$log->debug("No existia ultima fecha...");
$ejecutar = 1;
......@@ -51,7 +53,7 @@ class EnviarWapushUsuariosCommand extends Command {
} else {
$log->debug("El proceso ya se ejecuto.");
}
if ($ejecutar == 1) {
$suscripciones = $this->em->getRepository(PluSuscripcion::class)->findBy(array("susVigente" => 1));
$log->debug("suscripciones a procesar " . count($suscripciones));
......@@ -67,14 +69,38 @@ class EnviarWapushUsuariosCommand extends Command {
$log->debug('wappush NOOK a ' . $suscripcion->getSusMsisdn());
}
endforeach;
$nuevaFechaSiguienteEjecucion = new PluEntelWapushProximaFecha();
$nuevaFechaSiguienteEjecucion->setEwfFecha($fechaSiguiente->modify('+7 days'));
$this->em->persist($nuevaFechaSiguienteEjecucion);
$this->em->flush();
$log->debug("la proxima fecha de ejecucion es ".$nuevaFechaSiguienteEjecucion->getEwfFecha()->format("Y-m-d"));
//AVISO DE CONTENIDO GRATUITO MASIVO
$listas = $this->em->getRepository(PluLista::class)->findBy(array("lisEliminado" => 0, "lisEstado" => 1));
foreach ($listas as $index => $lista):
$log->debug("obteniendo suscripciones asociados a la lista " . $lista->getLisId());
foreach ($suscripciones as $index => $sucripcion):
if ($lista->getLisId() == $suscripcion->getLisId()->getLisId()) {
log->debug("Suscripcion asociado a la lista :" . $suscripcion->getSusId());
$arraySuscripciones[] = $suscripcion->getSusId();
$arrayMsisdn[] = }
endforeach;
if (count($arraySuscripciones) >= 1) {
$retornoWapPush = EntelWapush::wsGenerarPeticionWapPushMasivo(null, PluTipoWapush::TIPO_WP_INFO_CONTENIDO_GRATUITO, array($arraySuscripciones));
$log->debug("retorno wapush masivo lista : ".$lista->getLisId()."$retornoWapPush");
if ($retornoWapPush == 200) {
$log->debug("wapush masivo enviado a" . print_r($arrayMsisdn));
} else {
$log->debug('wappush masivo NOOK a ' . print_r($arrayMsisdn) );
}
}
endforeach;
$log->debug("la proxima fecha de ejecucion es " . $nuevaFechaSiguienteEjecucion->getEwfFecha()->format("Y-m-d"));
} catch (\Exception $e) {
$io->success(print_r($e));
}
......
......@@ -231,7 +231,7 @@ class PluLista
/**
* @var \PluImagen
* @var \PluTag
*
* @ORM\ManyToOne(targetEntity="PluTag")
* @ORM\JoinColumns({
......@@ -484,186 +484,186 @@ class PluLista
$this->tag = $tag;
return $this;
}
public function getLisVpwLa(): ?int
{
return $this->lisVpwLa;
}
public function setLisVpwLa(?int $lisVpwLa): self
{
$this->lisVpwLa = $lisVpwLa;
return $this;
}
public function getLisVpwMedio(): ?string
{
return $this->lisVpwMedio;
}
public function setLisVpwMedio(?string $lisVpwMedio): self
{
$this->lisVpwMedio = $lisVpwMedio;
return $this;
}
public function getLisVpwProvider(): ?string
{
return $this->lisVpwProvider;
}
public function setLisVpwProvider(?string $lisVpwProvider): self
{
$this->lisVpwProvider = $lisVpwProvider;
return $this;
}
public function getLisVpwService(): ?string
{
return $this->lisVpwService;
}
public function setLisVpwService(?string $lisVpwService): self
{
$this->lisVpwService = $lisVpwService;
return $this;
}
public function getLisVpwCode(): ?string
{
return $this->lisVpwCode;
}
public function setLisVpwCode(?string $lisVpwCode): self
{
$this->lisVpwCode = $lisVpwCode;
return $this;
}
public function getLisWapPushType(): ?string
{
return $this->lisWapPushType;
}
public function setLisWapPushType(?string $lisWapPushType): self
{
$this->lisWapPushType = $lisWapPushType;
return $this;
}
public function getLisWapPushLa(): ?string
{
return $this->lisWapPushLa;
}
public function setLisWapPushLa(?string $lisWapPushLa): self
{
$this->lisWapPushLa = $lisWapPushLa;
return $this;
}
public function getLisWapPushService(): ?string
{
return $this->lisWapPushService;
}
public function setLisWapPushService(?string $lisWapPushService): self
{
$this->lisWapPushService = $lisWapPushService;
return $this;
}
public function getLisWapPushCode(): ?string
{
return $this->lisWapPushCode;
}
public function setLisWapPushCode(?string $lisWapPushCode): self
{
$this->lisWapPushCode = $lisWapPushCode;
return $this;
}
public function getLisWapPushProvider(): ?string
{
return $this->lisWapPushProvider;
}
public function setLisWapPushProvider(?string $lisWapPushProvider): self
{
$this->lisWapPushProvider = $lisWapPushProvider;
return $this;
}
public function getLisWapPushProviderCode(): ?string
{
return $this->lisWapPushProviderCode;
}
public function setLisWapPushProviderCode(?string $lisWapPushProviderCode): self
{
$this->lisWapPushProviderCode = $lisWapPushProviderCode;
return $this;
}
public function getLisWapPushContentType(): ?string
{
return $this->lisWapPushContentType;
}
public function setLisWapPushContentType(?string $lisWapPushContentType): self
{
$this->lisWapPushContentType = $lisWapPushContentType;
return $this;
}
public function getLisWapPushMessage(): ?string
{
return $this->lisWapPushMessage;
}
public function setLisWapPushMessage(?string $lisWapPushMessage): self
{
$this->lisWapPushMessage = $lisWapPushMessage;
return $this;
}
public function getLisWapPushUrl(): ?string
{
return $this->lisWapPushUrl;
}
public function setLisWapPushUrl(?string $lisWapPushUrl): self
{
$this->lisWapPushUrl = $lisWapPushUrl;
return $this;
}
public function getLisWapPushServiceTag(): ?string
{
return $this->lisWapPushServiceTag;
}
public function setLisWapPushServiceTag(?string $lisWapPushServiceTag): self
{
$this->lisWapPushServiceTag = $lisWapPushServiceTag;
return $this;
}
public function getLisVpwLa(): ?int
{
return $this->lisVpwLa;
}
public function setLisVpwLa(?int $lisVpwLa): self
{
$this->lisVpwLa = $lisVpwLa;
return $this;
}
public function getLisVpwMedio(): ?string
{
return $this->lisVpwMedio;
}
public function setLisVpwMedio(?string $lisVpwMedio): self
{
$this->lisVpwMedio = $lisVpwMedio;
return $this;
}
public function getLisVpwProvider(): ?string
{
return $this->lisVpwProvider;
}
public function setLisVpwProvider(?string $lisVpwProvider): self
{
$this->lisVpwProvider = $lisVpwProvider;
return $this;
}
public function getLisVpwService(): ?string
{
return $this->lisVpwService;
}
public function setLisVpwService(?string $lisVpwService): self
{
$this->lisVpwService = $lisVpwService;
return $this;
}
public function getLisVpwCode(): ?string
{
return $this->lisVpwCode;
}
public function setLisVpwCode(?string $lisVpwCode): self
{
$this->lisVpwCode = $lisVpwCode;
return $this;
}
public function getLisWapPushType(): ?string
{
return $this->lisWapPushType;
}
public function setLisWapPushType(?string $lisWapPushType): self
{
$this->lisWapPushType = $lisWapPushType;
return $this;
}
public function getLisWapPushLa(): ?string
{
return $this->lisWapPushLa;
}
public function setLisWapPushLa(?string $lisWapPushLa): self
{
$this->lisWapPushLa = $lisWapPushLa;
return $this;
}
public function getLisWapPushService(): ?string
{
return $this->lisWapPushService;
}
public function setLisWapPushService(?string $lisWapPushService): self
{
$this->lisWapPushService = $lisWapPushService;
return $this;
}
public function getLisWapPushCode(): ?string
{
return $this->lisWapPushCode;
}
public function setLisWapPushCode(?string $lisWapPushCode): self
{
$this->lisWapPushCode = $lisWapPushCode;
return $this;
}
public function getLisWapPushProvider(): ?string
{
return $this->lisWapPushProvider;
}
public function setLisWapPushProvider(?string $lisWapPushProvider): self
{
$this->lisWapPushProvider = $lisWapPushProvider;
return $this;
}
public function getLisWapPushProviderCode(): ?string
{
return $this->lisWapPushProviderCode;
}
public function setLisWapPushProviderCode(?string $lisWapPushProviderCode): self
{
$this->lisWapPushProviderCode = $lisWapPushProviderCode;
return $this;
}
public function getLisWapPushContentType(): ?string
{
return $this->lisWapPushContentType;
}
public function setLisWapPushContentType(?string $lisWapPushContentType): self
{
$this->lisWapPushContentType = $lisWapPushContentType;
return $this;
}
public function getLisWapPushMessage(): ?string
{
return $this->lisWapPushMessage;
}
public function setLisWapPushMessage(?string $lisWapPushMessage): self
{
$this->lisWapPushMessage = $lisWapPushMessage;
return $this;
}
public function getLisWapPushUrl(): ?string
{
return $this->lisWapPushUrl;
}
public function setLisWapPushUrl(?string $lisWapPushUrl): self
{
$this->lisWapPushUrl = $lisWapPushUrl;
return $this;
}
public function getLisWapPushServiceTag(): ?string
{
return $this->lisWapPushServiceTag;
}
public function setLisWapPushServiceTag(?string $lisWapPushServiceTag): self
{
$this->lisWapPushServiceTag = $lisWapPushServiceTag;
return $this;
}
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ class Utiles {
public static function setLog($type = '', $archivo = 'web') {
$logFechaNombre = $archivo . "_" . date("Ymd") . ".log";
$logPath = __DIR__ . '/../../var/project/logs/' . $logFechaNombre;
$logPath = __DIR__ . '/../../var/logs/' . $logFechaNombre;
$log = new Logger($type);
$handler = new StreamHandler($logPath, Logger::DEBUG);
$handler->setFormatter(new LineFormatter(null, null, true, true));
......
......@@ -50,14 +50,18 @@ class wapPushController extends AbstractController
$logError->err('Error en xml de entrada. xmlIN:'.$xmlIN);
throw new HttpException(Response::HTTP_BAD_REQUEST, "Invalid XML");
}
$suscripcion = $em->getRepository(PluSuscripcion::class)->find($suscripcionIdIN);
$log->debug('validando suscripcion..');
if($suscripcion == null){
$log->err('Suscripcion no existe en DB. xmlIN:'.$xmlIN);
$logError = Utiles::setLog('WsBundle\Controller\wapPushController::enviar', 'error/ws');
$logError->err('Suscripcion no existe en DB. xmlIN:'.$xmlIN);
throw new HttpException(Response::HTTP_BAD_REQUEST, "Parametros invalidos");
if($suscripcionIn != 0){
$suscripcion = $em->getRepository(PluSuscripcion::class)->find($suscripcionIdIN);
$log->debug('validando suscripcion..');
if($suscripcion == null){
$log->err('Suscripcion no existe en DB. xmlIN:'.$xmlIN);
$logError = Utiles::setLog('WsBundle\Controller\wapPushController::enviar', 'error/ws');
$logError->err('Suscripcion no existe en DB. xmlIN:'.$xmlIN);
throw new HttpException(Response::HTTP_BAD_REQUEST, "Parametros invalidos");
}
}else{
$suscripcion = null;
}
$tipoWappush = $em->getRepository(PluTipoWapush::class)->find($tipoIN);
......@@ -70,8 +74,11 @@ class wapPushController extends AbstractController
}
$log->debug('llamando controlador procesoPeticionEnviarWapPush...');
EntelWapush::procesoPeticionEnviarWapPush($xmlIN, $suscripcion, $tipoWappush, $em);
if($suscripcionIn != 0){
EntelWapush::procesoPeticionEnviarWapPush($xmlIN, $suscripcion, $tipoWappush, $em);
}else{
EntelWapush::procesoPeticionEnviarWapPushMasivo($xmlIN, $tipoWappush, $em);
}
}
catch(HttpException $e){
$status = $e->getStatusCode();
......
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