✨ Features: - Migrated ALL files to new S3 structure (Projects, Contacts, Accounts, HelpDesk, Invoice, etc.) - Added Nextcloud folder buttons to ALL modules - Fixed Nextcloud editor integration - WebSocket server for real-time updates - Redis Pub/Sub integration - File path manager for organized storage - Redis caching for performance (Functions.php) 📁 New Structure: Documents/Project/ProjectName_ID/file_docID.ext Documents/Contacts/FirstName_LastName_ID/file_docID.ext Documents/Accounts/AccountName_ID/file_docID.ext 🔧 Technical: - FilePathManager for standardized paths - S3StorageService integration - WebSocket server (Node.js + Docker) - Redis cache for getBasicModuleInfo() - Predis library for Redis connectivity 📝 Scripts: - Migration scripts for all modules - Test pages for WebSocket/SSE/Polling - Documentation (MIGRATION_*.md, REDIS_*.md) 🎯 Result: 15,000+ files migrated successfully!
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Отправка тестового события в Redis
|
|
*/
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
try {
|
|
require_once '/var/www/fastuser/data/www/crm.clientright.ru/vendor/autoload.php';
|
|
|
|
// Создаем клиент Predis
|
|
$redis = new Predis\Client([
|
|
'scheme' => 'tcp',
|
|
'host' => '127.0.0.1',
|
|
'port' => 6379,
|
|
'password' => 'CRM_Redis_Pass_2025_Secure!',
|
|
'database' => 0,
|
|
]);
|
|
|
|
// Получаем данные из POST или используем по умолчанию
|
|
$input = file_get_contents('php://input');
|
|
$postData = $input ? json_decode($input, true) : null;
|
|
|
|
// Формируем событие
|
|
$event = $postData ?: [
|
|
'type' => 'test',
|
|
'data' => [
|
|
'message' => 'Тестовое событие из CRM!',
|
|
'timestamp' => time(),
|
|
'random' => rand(1000, 9999)
|
|
]
|
|
];
|
|
|
|
// Добавляем в очередь для простого SSE
|
|
$redis->rpush('crm:file:events:queue', json_encode($event));
|
|
|
|
// Публикуем в канал для подписчиков (n8n и т.д.)
|
|
$subscribers = $redis->publish('crm:file:events', json_encode($event));
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'message' => 'Событие отправлено',
|
|
'subscribers' => $subscribers,
|
|
'event' => $event
|
|
], JSON_UNESCAPED_UNICODE);
|
|
|
|
} catch (Exception $e) {
|
|
http_response_code(500);
|
|
echo json_encode([
|
|
'success' => false,
|
|
'error' => $e->getMessage()
|
|
], JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|