feat(setup): seed completo de companies, endpoints y menus restaurados
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
4b710ef33b
commit
f378d02768
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
$BASE = 'https://app.palmas360.com/rosablanca/php/controller/controller_api_externa.php';
|
||||
$KEY = '39630f8c4743ac0dba3cecb781bc4c0608ba77f7576f74831d779c42c596e7f0';
|
||||
$KEY = 'd8ed3ac2dbe633cd5e0d75cf50503d7be7084a7dbf0ca65325aa54e831491379'; // test key (IP-unrestricted)
|
||||
$TODAY = date('Y-m-d');
|
||||
$M1 = date('Y-m-01');
|
||||
|
||||
@@ -52,10 +52,10 @@ curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>10,
|
||||
$raw = curl_exec($ch); curl_close($ch);
|
||||
$fincas = json_decode($raw, true);
|
||||
$fincaId = 0;
|
||||
if (!empty($fincas['fincas'])) {
|
||||
foreach ($fincas['fincas'] as $f) {
|
||||
if (!empty($fincas['datos'])) {
|
||||
foreach ($fincas['datos'] as $f) {
|
||||
echo " id={$f['id']} {$f['label']}\n";
|
||||
if ($fincaId === 0) $fincaId = (int)$f['id'];
|
||||
if ($fincaId === 0 && (int)$f['id'] > 0) $fincaId = (int)$f['id']; // skip id=0 (Todas)
|
||||
}
|
||||
} else {
|
||||
echo " " . mb_substr($raw, 0, 200) . "\n";
|
||||
@@ -92,4 +92,44 @@ hit('cosecha', "{$BASE}?peticion=ciclos_cosecha_dn&fecha_desde={$M1}&finca_i
|
||||
hit('polinizacion',"{$BASE}?peticion=ciclos_polinizacion_dn&fecha_desde={$M1}&finca_id={$fincaId}", $KEY);
|
||||
hit('mantenimiento',"{$BASE}?peticion=mantenimiento_dn&fecha_desde={$M1}&grupo=0&finca_id={$fincaId}", $KEY);
|
||||
|
||||
// ── 8. Top texto (lotes con ciclos más largos) ───────────────────────────
|
||||
echo "\n── Top texto (sin finca) ──\n";
|
||||
hit('cosecha_top', "{$BASE}?peticion=cosecha_top_texto_bot", $KEY);
|
||||
hit('polinizacion_top', "{$BASE}?peticion=polinizacion_top_texto_bot", $KEY);
|
||||
hit('censo_top', "{$BASE}?peticion=censo_top_texto_bot", $KEY);
|
||||
hit('plagas_top', "{$BASE}?peticion=plagas_top_texto_bot", $KEY);
|
||||
hit('palm_top', "{$BASE}?peticion=palm_top_texto_bot", $KEY);
|
||||
hit('tratamiento_top', "{$BASE}?peticion=tratamiento_top_texto_bot", $KEY);
|
||||
hit('mant_top', "{$BASE}?peticion=mantenimiento_top_texto_bot&grupo=0", $KEY);
|
||||
|
||||
if ($fincaId > 0) {
|
||||
echo "\n── Top texto (con finca_id={$fincaId}) ──\n";
|
||||
hit('cosecha_top', "{$BASE}?peticion=cosecha_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('polinizacion_top', "{$BASE}?peticion=polinizacion_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('censo_top', "{$BASE}?peticion=censo_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('plagas_top', "{$BASE}?peticion=plagas_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('palm_top', "{$BASE}?peticion=palm_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('tratamiento_top', "{$BASE}?peticion=tratamiento_top_texto_bot&finca_id={$fincaId}", $KEY);
|
||||
hit('mant_top', "{$BASE}?peticion=mantenimiento_top_texto_bot&grupo=0&finca_id={$fincaId}", $KEY);
|
||||
}
|
||||
|
||||
// ── 9. Histórico 30 días (PDF) ────────────────────────────────────────────
|
||||
echo "\n── Histórico bot PDF (sin finca) ──\n";
|
||||
hit('cosecha_hist', "{$BASE}?peticion=cosecha_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
hit('polinizacion_hist', "{$BASE}?peticion=polinizacion_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
hit('censo_hist', "{$BASE}?peticion=censo_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
hit('plagas_hist', "{$BASE}?peticion=plagas_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
hit('palm_hist', "{$BASE}?peticion=palm_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
hit('tratamiento_hist', "{$BASE}?peticion=tratamiento_historico_bot&fecha_hasta={$TODAY}&finca_id=0", $KEY);
|
||||
|
||||
if ($fincaId > 0) {
|
||||
echo "\n── Histórico bot PDF (con finca_id={$fincaId}) ──\n";
|
||||
hit('cosecha_hist', "{$BASE}?peticion=cosecha_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
hit('polinizacion_hist', "{$BASE}?peticion=polinizacion_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
hit('censo_hist', "{$BASE}?peticion=censo_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
hit('plagas_hist', "{$BASE}?peticion=plagas_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
hit('palm_hist', "{$BASE}?peticion=palm_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
hit('tratamiento_hist', "{$BASE}?peticion=tratamiento_historico_bot&fecha_hasta={$TODAY}&finca_id={$fincaId}", $KEY);
|
||||
}
|
||||
|
||||
echo "\n── Fin del test ──\n";
|
||||
|
||||
Reference in New Issue
Block a user