UPDATE
This commit is contained in:
@@ -197,7 +197,9 @@ class ShowPromociones extends Component
|
||||
public function getListeners()
|
||||
{
|
||||
return [
|
||||
'confirmed', 'confirmarCompra', 'denegarCompra'
|
||||
'confirmed',
|
||||
'confirmarCompra',
|
||||
'denegarCompra'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -256,7 +258,7 @@ class ShowPromociones extends Component
|
||||
|
||||
$this->historial = $historial;
|
||||
|
||||
for ($p = 0; $p < (int)$this->cantidad_comprarPromo; $p++) {
|
||||
for ($p = 0; $p < (int) $this->cantidad_comprarPromo; $p++) {
|
||||
//dd($this->cantidad_comprarPromo);
|
||||
$this->n = [];
|
||||
$this->f = [];
|
||||
@@ -276,21 +278,34 @@ class ShowPromociones extends Component
|
||||
$this->fecha_final_1 = $today = Carbon::now()->addDays($tarifa->dias - 20);
|
||||
$this->fecha_final_2 = $today = Carbon::now()->addDays($tarifa->dias + 20);
|
||||
|
||||
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->whereDate('vencimiento', '>=', $this->fecha_final_1)
|
||||
$cuenta = Cuentas::where('servicio_id', $servicio_id)
|
||||
->whereDate('inicio', '>=', $this->fecha)
|
||||
->whereDate('vencimiento', '>=', $this->fecha_final_1)
|
||||
->whereDate('vencimiento', '<=', $this->fecha_final_2)
|
||||
->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'pendiente')->having('historiales_count', '==', 0)->first();
|
||||
->Orderby('created_at', 'ASC')->with('historiales')
|
||||
->withCount('historiales')
|
||||
->where('estado', 'pendiente')
|
||||
->having('historiales_count', '==', 0)
|
||||
->first();
|
||||
} else {
|
||||
$cuenta = Cuentas::where('servicio_id', $servicio_id)->whereDate('inicio', '>=', $this->fecha)->Orderby('created_at', 'DESC')->with('historiales')->withCount('historiales')->where('estado', 'activo')->having('historiales_count', '<=', (int)$faltante)->first();
|
||||
$cuenta = Cuentas::where('servicio_id', $servicio_id)
|
||||
->whereDate('inicio', '>=', $this->fecha)
|
||||
->Orderby('created_at', 'ASC')
|
||||
->with('historiales')
|
||||
->withCount('historiales')
|
||||
->where('estado', 'activo')
|
||||
->having('historiales_count', '<=', (int) $faltante)
|
||||
->first();
|
||||
}
|
||||
|
||||
if (!is_null($cuenta)) {
|
||||
$perfil = $cuenta->historiales_count;
|
||||
for ($y = 0; $y < (int)$pantallas_tarifa; $y++) {
|
||||
for ($y = 0; $y < (int) $pantallas_tarifa; $y++) {
|
||||
|
||||
$historial_cuenta = new Historial_cuenta();
|
||||
$historial_cuenta->historial_id = $historial->id;
|
||||
$historial_cuenta->cuenta_id = $cuenta->id;
|
||||
$historial_cuenta->perfil = (int)$perfil + (int)$y + 1;
|
||||
$historial_cuenta->perfil = (int) $perfil + (int) $y + 1;
|
||||
$historial_cuenta->save();
|
||||
if (!empty($historial_cuenta->id)) {
|
||||
array_push($this->n, $historial_cuenta->id);
|
||||
@@ -371,7 +386,7 @@ class ShowPromociones extends Component
|
||||
|
||||
foreach ($this->f as $serviceId) {
|
||||
|
||||
for ($y = 0; $y < (int)$this->cantidad_comprarPromo; $y++) {
|
||||
for ($y = 0; $y < (int) $this->cantidad_comprarPromo; $y++) {
|
||||
$pendiente = new Pendientes();
|
||||
$pendiente->historial_id = $this->historial->id;
|
||||
$pendiente->cantidad = '1';
|
||||
@@ -463,7 +478,9 @@ class ShowPromociones extends Component
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
curl_setopt_array(
|
||||
$curl,
|
||||
array(
|
||||
CURLOPT_URL => "https://api.labsmobile.com/json/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
@@ -477,7 +494,8 @@ class ShowPromociones extends Component
|
||||
"Cache-Control: no-cache",
|
||||
"Content-Type: application/json"
|
||||
),
|
||||
));
|
||||
)
|
||||
);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
@@ -285,8 +285,6 @@ class ShowServicios extends Component
|
||||
|
||||
if ((int) $pantalla_servicio >= (int) $cantidad_solicitada && (int) $pantalla_servicio_completa != (int) $this->pantallas_tarjetaPlan) {
|
||||
$suma = $pantalla_servicio - $cantidad_solicitada;
|
||||
|
||||
|
||||
$cantidad_necesaria = $this->cantidad_tarjetaPlan;
|
||||
$cuenta = Cuentas::where('servicio_id', $this->servicio_id)
|
||||
->whereDate('inicio', '>=', $this->fecha)
|
||||
|
||||
Reference in New Issue
Block a user