Update: 2026-06-30 04:58:47
This commit is contained in:
@@ -164,8 +164,9 @@ if (isset($_POST['action'])) {
|
|||||||
$message = "Please fill in all required fields.";
|
$message = "Please fill in all required fields.";
|
||||||
$msgType = 'error';
|
$msgType = 'error';
|
||||||
}
|
}
|
||||||
} elseif ($_POST['action'] === 'generate_10_trips') {
|
} elseif ($_POST['action'] === 'generate_batch_trips' || $_POST['action'] === 'generate_10_trips') {
|
||||||
$app = $_POST['app'] ?? 'com.taxif.passenger';
|
$app = $_POST['app'] ?? 'com.taxif.passenger';
|
||||||
|
$numTrips = isset($_POST['num_trips']) ? (int)$_POST['num_trips'] : 30;
|
||||||
|
|
||||||
$ammanLocations = [
|
$ammanLocations = [
|
||||||
['name' => 'Abdoun', 'lat' => 31.9392, 'lng' => 35.8942],
|
['name' => 'Abdoun', 'lat' => 31.9392, 'lng' => 35.8942],
|
||||||
@@ -182,27 +183,29 @@ if (isset($_POST['action'])) {
|
|||||||
['name' => 'Hashmi Al-Janoubi', 'lat' => 31.9350, 'lng' => 35.9350],
|
['name' => 'Hashmi Al-Janoubi', 'lat' => 31.9350, 'lng' => 35.9350],
|
||||||
['name' => 'Al-Madina', 'lat' => 31.8500, 'lng' => 35.8000],
|
['name' => 'Al-Madina', 'lat' => 31.8500, 'lng' => 35.8000],
|
||||||
['name' => 'Sports City', 'lat' => 31.9820, 'lng' => 35.8880],
|
['name' => 'Sports City', 'lat' => 31.9820, 'lng' => 35.8880],
|
||||||
];
|
['name' => 'Tabarbour', 'lat' => 31.9960, 'lng' => 35.9520],
|
||||||
|
['name' => 'Marka', 'lat' => 31.9810, 'lng' => 35.9860],
|
||||||
// 10 trip pairs with varied distances (~2km to ~17km)
|
['name' => 'Abu Nuseir', 'lat' => 32.0460, 'lng' => 35.8820],
|
||||||
$tripPairs = [
|
['name' => 'Shafa Badran', 'lat' => 32.0430, 'lng' => 35.8950],
|
||||||
[13, 5], // Sports City → Tla Al-Ali (~2km)
|
['name' => 'Al-Bayader', 'lat' => 31.9540, 'lng' => 35.8230],
|
||||||
[6, 0], // Shmeisani → Abdoun (~3km)
|
['name' => 'Wadi Al-Seer', 'lat' => 31.9520, 'lng' => 35.8160],
|
||||||
[7, 1], // Um Uthaina → Jabal Amman (~4km)
|
['name' => 'Dahiyet Al-Rasheed','lat' => 32.0110, 'lng' => 35.8710],
|
||||||
[3, 13], // Khalda → Sports City (~5km)
|
['name' => 'Tariq', 'lat' => 32.0080, 'lng' => 35.9380],
|
||||||
[4, 2], // Al-Jubaiha → Sweileh (~5km)
|
['name' => 'Ras Al-Ain', 'lat' => 31.9420, 'lng' => 35.9270],
|
||||||
[0, 8], // Abdoun → Marj Al-Hamam (~6km)
|
['name' => 'Al-Yarmouk', 'lat' => 31.9300, 'lng' => 35.9400],
|
||||||
[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)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$tasks = json_decode(file_get_contents(TASKS_FILE), true);
|
$tasks = json_decode(file_get_contents(TASKS_FILE), true);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($tripPairs as $i => $pair) {
|
|
||||||
$start = $ammanLocations[$pair[0]];
|
for ($i = 0; $i < $numTrips; $i++) {
|
||||||
$end = $ammanLocations[$pair[1]];
|
$startIndex = array_rand($ammanLocations);
|
||||||
|
do {
|
||||||
|
$endIndex = array_rand($ammanLocations);
|
||||||
|
} while ($endIndex === $startIndex);
|
||||||
|
|
||||||
|
$start = $ammanLocations[$startIndex];
|
||||||
|
$end = $ammanLocations[$endIndex];
|
||||||
$taskId = "prc_" . uniqid();
|
$taskId = "prc_" . uniqid();
|
||||||
|
|
||||||
$newTask = [
|
$newTask = [
|
||||||
@@ -222,7 +225,7 @@ if (isset($_POST['action'])) {
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
file_put_contents(TASKS_FILE, json_encode($tasks, JSON_PRETTY_PRINT));
|
file_put_contents(TASKS_FILE, json_encode($tasks, JSON_PRETTY_PRINT));
|
||||||
$message = "Generated $count standard tasks (one per trip) for TaxiF!";
|
$message = "Generated $count random standard tasks for $app to map surge zones!";
|
||||||
} elseif ($_POST['action'] === 'clear_tasks') {
|
} elseif ($_POST['action'] === 'clear_tasks') {
|
||||||
file_put_contents(TASKS_FILE, json_encode([]));
|
file_put_contents(TASKS_FILE, json_encode([]));
|
||||||
$message = "Task queue cleared successfully.";
|
$message = "Task queue cleared successfully.";
|
||||||
@@ -708,15 +711,27 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
|
|||||||
|
|
||||||
<!-- Batch generator form -->
|
<!-- Batch generator form -->
|
||||||
<form method="POST" action="" style="margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color);">
|
<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="action" value="generate_batch_trips">
|
||||||
<input type="hidden" name="app" value="com.taxif.passenger">
|
<h3 style="font-size:1rem; font-weight:600; margin-bottom:0.75rem; color:#fff;">Generate Random Amman Trips</h3>
|
||||||
<h3 style="font-size:1rem; font-weight:600; margin-bottom:0.75rem; color:#fff;">Generate 10 Amman Trips</h3>
|
|
||||||
|
<div class="form-group" style="margin-bottom: 0.75rem;">
|
||||||
|
<label for="batch_app">Target App</label>
|
||||||
|
<select name="app" id="batch_app" required style="padding: 0.5rem; font-size: 0.85rem; width: 100%; background: rgba(10, 15, 30, 0.6); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #fff;">
|
||||||
|
<option value="com.taxif.passenger">TaxiF (com.taxif.passenger)</option>
|
||||||
|
<option value="me.com.easytaxi">Jeeny (me.com.easytaxi)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" style="margin-bottom: 1rem;">
|
||||||
|
<label for="num_trips">Number of Trips</label>
|
||||||
|
<input type="number" name="num_trips" id="num_trips" value="30" min="5" max="100" required style="width:100%; padding: 0.5rem; font-size: 0.85rem; background: rgba(10, 15, 30, 0.6); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #fff;">
|
||||||
|
</div>
|
||||||
|
|
||||||
<p style="font-size:0.85rem; color:var(--text-muted); margin-bottom:1rem;">
|
<p style="font-size:0.85rem; color:var(--text-muted); margin-bottom:1rem;">
|
||||||
Queues 10 separate standard tasks (one per trip) with varied distances (2–17 km) for TaxiF.
|
Queues random standard tasks (one per trip) with varied distances for the selected app to map surge zones.
|
||||||
The bot processes each trip individually through normal polling.
|
|
||||||
</p>
|
</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);">
|
<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
|
Generate Random Trips
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user