Files
Hamza-AyedandClaude Opus 5 4d8414c96b feat: استيراد كود سيرو إلى تريبز (سيرو @ecfe7568) — بلا تعديل
قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة
ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ.

الخريطة:
  backend · payment_server · loction_server · ride_server ·
  passenger_server · docker · dashboard · stress_test  → الجذر
  siro_rider  → apps/rider          siro_driver  → apps/driver
  siro_admin  → dashboards/admin    siro_service → dashboards/service
  android_bot → apps/android_bot    socialBot    → apps/socialBot

نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب)
لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً:
كل ما يلي يصير فرقاً مقروءاً مقابل المصدر.

لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز،
سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh
(ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في
مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و
dashboards/transit-web).

⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة:
1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر):
   كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner.
2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist)
   يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً.
3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع →
   يجب ضمّ الحزم داخله أسوة بـ apps/rider.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:14:13 +03:00

114 lines
4.3 KiB
PHP

<?php
// ==============================================================================
# Siro Guerrilla Marketing Flow Verification & Integration Test Script
# ==============================================================================
# This script executes a full dry-run integration test on the marketing engine.
# It checks proxy assignments, country detection, dialect generation, and
# dialogue scheduling.
# ==============================================================================
require_once __DIR__ . '/../core/bootstrap.php';
require_once __DIR__ . '/schedule_manager.php';
require_once __DIR__ . '/account_manager.php';
try {
$con = Database::get('main');
} catch (Exception $e) {
die("[-] Connection failed: " . $e->getMessage() . "\n");
}
echo "[*] Starting Siro Integration Test...\n";
// --- 1. Set Up Mock Accounts ---
echo "[*] Setting up mock accounts in database...\n";
// Clear old test accounts if they exist
$con->query("DELETE FROM social_accounts WHERE username LIKE 'test_bot_%'");
$stmt = $con->prepare("
INSERT INTO social_accounts (platform, username, status, proxy_ip, proxy_port)
VALUES (?, ?, 'active', ?, ?)
");
$stmt->execute(['facebook', 'test_bot_sy', '194.163.173.157', 8080]);
$stmt->execute(['facebook', 'test_bot_jo', '194.163.173.200', 8080]);
$stmt->execute(['facebook', 'test_bot_eg', '194.163.173.111', 8080]);
echo "[+] 3 Mock accounts created successfully.\n";
// --- 2. Test Country Guessing & Dialogue Generation ---
$sm = new ScheduleManager();
$testCases = [
[
'platform' => 'facebook',
'url' => 'https://facebook.com/groups/yallago.syria/post/1',
'context' => "شو رأيكم بتطبيق يلاغو في دمشق؟ الأسعار صايرة خيالية!",
'expected_country' => 'SY'
],
[
'platform' => 'facebook',
'url' => 'https://facebook.com/groups/taxif.amman/post/2',
'context' => "التاكسي إف لغى رحلتي مرتين اليوم بعمان، شو في بديل؟",
'expected_country' => 'JO'
]
];
foreach ($testCases as $index => $tc) {
echo "\n------------------------------------------------------------\n";
echo "[*] Test Case " . ($index + 1) . ": Target URL " . $tc['url'] . "\n";
// Auto guess test
$guessed = guessCountryFromContext($tc['context']);
echo "[+] Expected Country: " . $tc['expected_country'] . " | Guessed: " . $guessed . "\n";
if ($guessed === $tc['expected_country']) {
echo "[+] Country Detection: PASS\n";
} else {
echo "[-] Country Detection: FAIL\n";
}
// Schedule Task
// This will schedule the parent task and automatically trigger the dialogue simulator (Drama)
echo "[*] Scheduling parent task and dialog drama...\n";
$success = $sm->scheduleTask(
platform: $tc['platform'],
type: 'post_comment',
targetUrl: $tc['url'],
promptContext: $tc['context'],
accountId: null,
delayMinutes: 5
);
if ($success) {
echo "[+] Initial task and supporting drama scheduled successfully.\n";
} else {
echo "[-] Scheduling: FAIL\n";
}
}
// --- 3. Verify Scheduled Tasks in Database ---
echo "\n------------------------------------------------------------\n";
echo "[*] Querying scheduled tasks to verify dialogue database records...\n";
$stmtTasks = $con->prepare("
SELECT t.id, t.type, t.target_url, t.generated_comment, t.scheduled_at, a.username, a.proxy_ip
FROM social_tasks t
LEFT JOIN social_accounts a ON t.account_id = a.id
WHERE t.status = 'pending' AND t.target_url LIKE '%/post/%'
ORDER BY t.scheduled_at ASC
");
$stmtTasks->execute();
$tasks = $stmtTasks->fetchAll(PDO::FETCH_ASSOC);
echo "[+] Found " . count($tasks) . " pending tasks in queue:\n";
foreach ($tasks as $t) {
echo " - Account: [" . $t['username'] . " (IP: " . $t['proxy_ip'] . ")] | Type: " . $t['type'] . "\n";
echo " Scheduled: " . $t['scheduled_at'] . "\n";
echo " Generated Comment: \"" . trim($t['generated_comment']) . "\"\n\n";
}
// --- 4. Clean Up Mock Database Data ---
echo "[*] Cleaning up test data from DB...\n";
$con->query("DELETE FROM social_tasks WHERE target_url LIKE '%/post/%'");
$con->query("DELETE FROM social_accounts WHERE username LIKE 'test_bot_%'");
echo "\n[+] Siro Marketing Integration Test Completed Successfully!\n";