Update: 2026-06-30 02:18:10

This commit is contained in:
Hamza-Ayed
2026-06-30 02:18:10 +03:00
parent cf696d05db
commit c8546bb744
2 changed files with 188 additions and 26 deletions

View File

@@ -164,6 +164,67 @@ if (isset($_POST['action'])) {
$message = "Please fill in all required fields.";
$msgType = 'error';
}
} elseif ($_POST['action'] === 'generate_10_trips') {
$app = $_POST['app'] ?? 'com.taxif.passenger';
$ammanLocations = [
['name' => 'Abdoun', 'lat' => 31.9392, 'lng' => 35.8942],
['name' => 'Jabal Amman', 'lat' => 31.9511, 'lng' => 35.9189],
['name' => 'Sweileh', 'lat' => 32.0167, 'lng' => 35.8333],
['name' => 'Khalda', 'lat' => 31.9861, 'lng' => 35.8450],
['name' => 'Al-Jubaiha', 'lat' => 32.0194, 'lng' => 35.8753],
['name' => 'Tla Al-Ali', 'lat' => 31.9961, 'lng' => 35.8647],
['name' => 'Shmeisani', 'lat' => 31.9680, 'lng' => 35.9020],
['name' => 'Um Uthaina', 'lat' => 31.9610, 'lng' => 35.8770],
['name' => 'Marj Al-Hamam', 'lat' => 31.9000, 'lng' => 35.8500],
['name' => 'Al-Muqabalain', 'lat' => 31.8720, 'lng' => 35.8900],
['name' => 'Al-Qweismeh', 'lat' => 31.8900, 'lng' => 35.9200],
['name' => 'Hashmi Al-Janoubi', 'lat' => 31.9350, 'lng' => 35.9350],
['name' => 'Al-Madina', 'lat' => 31.8500, 'lng' => 35.8000],
['name' => 'Sports City', 'lat' => 31.9820, 'lng' => 35.8880],
];
// 10 trip pairs with varied distances (~2km to ~17km)
$tripPairs = [
[13, 5], // Sports City → Tla Al-Ali (~2km)
[6, 0], // Shmeisani → Abdoun (~3km)
[7, 1], // Um Uthaina → Jabal Amman (~4km)
[3, 13], // Khalda → Sports City (~5km)
[4, 2], // Al-Jubaiha → Sweileh (~5km)
[0, 8], // Abdoun → Marj Al-Hamam (~6km)
[1, 10], // Jabal Amman → Al-Qweismeh (~9km)
[6, 9], // Shmeisani → Al-Muqabalain (~11km)
[2, 12], // Sweileh → Al-Madina (~17km)
[5, 11], // Tla Al-Ali → Hashmi (~5km)
];
$trips = [];
foreach ($tripPairs as $i => $pair) {
$start = $ammanLocations[$pair[0]];
$end = $ammanLocations[$pair[1]];
$trips[] = [
'trip_index' => $i,
'start_location' => $start['name'],
'end_location' => $end['name'],
'start_lat' => $start['lat'],
'start_lng' => $start['lng'],
'end_lat' => $end['lat'],
'end_lng' => $end['lng'],
];
}
$taskId = "batch_" . uniqid();
$batchTask = [
'task_id' => $taskId,
'type' => 'batch_multi_trip',
'app' => $app,
'trips' => $trips,
];
$tasks = json_decode(file_get_contents(TASKS_FILE), true);
$tasks[] = $batchTask;
file_put_contents(TASKS_FILE, json_encode($tasks, JSON_PRETTY_PRINT));
$message = "Batch task with 10 trips generated! Task ID: $taskId";
} elseif ($_POST['action'] === 'clear_tasks') {
file_put_contents(TASKS_FILE, json_encode([]));
$message = "Task queue cleared successfully.";
@@ -646,6 +707,20 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
<button type="submit" class="btn" id="submit-task-btn">Queue Scraping Task</button>
</form>
<!-- Batch generator form -->
<form method="POST" action="" style="margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color);">
<input type="hidden" name="action" value="generate_10_trips">
<input type="hidden" name="app" value="com.taxif.passenger">
<h3 style="font-size:1rem; font-weight:600; margin-bottom:0.75rem; color:#fff;">Batch Multi-Trip Generator</h3>
<p style="font-size:0.85rem; color:var(--text-muted); margin-bottom:1rem;">
Generates 1 batch task containing 10 varied Amman trips (217 km) for TaxiF.
The bot processes all 10 trips without reopening the app.
</p>
<button type="submit" class="btn" id="batch-btn" style="background: linear-gradient(135deg, #10b981 0%, #059669 100%); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);">
Generate 10 Amman Trips
</button>
</form>
</div>
<!-- Right Side: Lists Dashboard -->
@@ -697,7 +772,16 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
<span class="badge-app app-<?php echo $appLabel; ?>"><?php echo htmlspecialchars($appLabel); ?></span>
<span><?php echo htmlspecialchars($task['task_id']); ?></span>
</h4>
<p>Route: <strong><?php echo htmlspecialchars($task['start_location']); ?></strong> &rarr; <strong><?php echo htmlspecialchars($task['end_location']); ?></strong></p>
<?php
$isBatch = ($task['type'] ?? '') === 'batch_multi_trip';
if ($isBatch && isset($task['trips'])) {
$tripCount = count($task['trips']);
$firstTrip = $task['trips'][0];
echo '<p>Batch: <strong>' . $tripCount . ' trips</strong> | First: <strong>' . htmlspecialchars($firstTrip['start_location']) . '</strong> &rarr; <strong>' . htmlspecialchars($firstTrip['end_location']) . '</strong></p>';
} else {
echo '<p>Route: <strong>' . htmlspecialchars($task['start_location']) . '</strong> &rarr; <strong>' . htmlspecialchars($task['end_location']) . '</strong></p>';
}
?>
</div>
<div class="time-badge">
Pending