diff --git a/backend/bot/cron_auto_marketing_pusher.php b/backend/bot/cron_auto_marketing_pusher.php index bf2ccbc0..d5b8bf03 100644 --- a/backend/bot/cron_auto_marketing_pusher.php +++ b/backend/bot/cron_auto_marketing_pusher.php @@ -14,8 +14,7 @@ require_once __DIR__ . '/../core/bootstrap.php'; require_once __DIR__ . '/../core/Services/SiroGeminiService.php'; require_once __DIR__ . '/../core/Security/EncryptionHelper.php'; -// تأكد من وجود دالة إرسال الإشعارات -// require_once __DIR__ . '/../functions.php'; // already loaded in bootstrap if configured +require_once __DIR__ . '/../functions.php'; set_time_limit(0); diff --git a/backend/bot/cron_predictive_demand.php b/backend/bot/cron_predictive_demand.php index aecef6a1..801849fa 100644 --- a/backend/bot/cron_predictive_demand.php +++ b/backend/bot/cron_predictive_demand.php @@ -27,8 +27,9 @@ set_time_limit(120); ini_set('memory_limit', '256M'); try { - $con = Database::get('main'); - $redis = getRedisConnection(); + $con = Database::get('main'); + $conRide = Database::get('ride'); + $redis = getRedisConnection(); } catch (Exception $e) { die("[PredictiveDemand] Connection failed: " . $e->getMessage() . "\n"); } @@ -69,14 +70,14 @@ $sqlHistory = " "; try { - $stmtH = $con->prepare($sqlHistory); - $stmtH->bindValue(':grid', $GRID_SIZE, PDO::PARAM_STR); - $stmtH->bindValue(':next_hour', $targetHourNext, PDO::PARAM_INT); - $stmtH->bindValue(':dow', $currentDow, PDO::PARAM_INT); - $stmtH->bindValue(':weeks', $WEEKS_HISTORY, PDO::PARAM_INT); - $stmtH->bindValue(':top', $TOP_ZONES * 3, PDO::PARAM_INT); // نأخذ أكثر لنصفيها لاحقاً - $stmtH->execute(); - $hotZones = $stmtH->fetchAll(PDO::FETCH_ASSOC); + $stmt = $conRide->prepare($sqlHistory); + $stmt->bindValue(':grid', $GRID_SIZE, PDO::PARAM_STR); + $stmt->bindValue(':next_hour', $targetHourNext, PDO::PARAM_INT); + $stmt->bindValue(':dow', $currentDow, PDO::PARAM_INT); + $stmt->bindValue(':weeks', $WEEKS_HISTORY, PDO::PARAM_INT); + $stmt->bindValue(':top', $TOP_ZONES * 3, PDO::PARAM_INT); // نأخذ أكثر لنصفيها لاحقاً + $stmt->execute(); + $hotZones = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { die("[PredictiveDemand] Query error: " . $e->getMessage() . "\n"); }