Update: 2026-06-30 02:33:51

This commit is contained in:
Hamza-Ayed
2026-06-30 02:33:51 +03:00
parent c8546bb744
commit 152d4df0fc
8 changed files with 45 additions and 125 deletions

View File

@@ -198,33 +198,31 @@ if (isset($_POST['action'])) {
[5, 11], // Tla Al-Ali → Hashmi (~5km)
];
$trips = [];
$tasks = json_decode(file_get_contents(TASKS_FILE), true);
$count = 0;
foreach ($tripPairs as $i => $pair) {
$start = $ammanLocations[$pair[0]];
$end = $ammanLocations[$pair[1]];
$trips[] = [
'trip_index' => $i,
$taskId = "prc_" . uniqid();
$newTask = [
'task_id' => $taskId,
'type' => 'price_check',
'app' => $app,
'start_location' => $start['name'],
'end_location' => $end['name'],
'start_lat' => $start['lat'],
'start_lng' => $start['lng'],
'end_lat' => $end['lat'],
'end_lng' => $end['lng'],
'payload' => [
'start_lat' => $start['lat'],
'start_lng' => $start['lng'],
'end_lat' => $end['lat'],
'end_lng' => $end['lng'],
],
];
$tasks[] = $newTask;
$count++;
}
$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";
$message = "Generated $count standard tasks (one per trip) for TaxiF!";
} elseif ($_POST['action'] === 'clear_tasks') {
file_put_contents(TASKS_FILE, json_encode([]));
$message = "Task queue cleared successfully.";
@@ -712,10 +710,10 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
<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>
<h3 style="font-size:1rem; font-weight:600; margin-bottom:0.75rem; color:#fff;">Generate 10 Amman Trips</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.
Queues 10 separate standard tasks (one per trip) with varied distances (217 km) for TaxiF.
The bot processes each trip individually through normal polling.
</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