Files
crm.clientright.ru/modules/Contacts/tasks/SubscriptionDates.service
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- Added comprehensive AI Assistant system (aiassist/ directory):
  * Vector search and embedding capabilities
  * Typebot proxy integration
  * Elastic search functionality
  * Message classification and chat history
  * MCP proxy for external integrations

- Implemented Court Status API (GetCourtStatus.php):
  * Real-time court document status checking
  * Integration with external court systems
  * Comprehensive error handling and logging

- Enhanced S3 integration:
  * Improved file backup system with metadata
  * Batch processing capabilities
  * Enhanced error logging and recovery
  * Copy operations with URL fixing

- Added Telegram contact creation API
- Improved error logging across all modules
- Enhanced callback system for AI responses
- Extensive backup file storage with timestamps
- Updated documentation and README files

- File storage improvements:
  * Thousands of backup files with proper metadata
  * Fix operations for broken file references
  * Project-specific backup and recovery systems
  * Comprehensive file integrity checking

Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
2025-10-16 11:17:21 +03:00

44 lines
1.9 KiB
Desktop File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include_once 'modules/Users/Users.php';
require_once 'includes/Loader.php';
vimport ('includes.runtime.Globals');
vimport ('includes.runtime.BaseModel');
vimport ('includes.runtime.LanguageHandler');
global $adb;
// Поднимаем всех подписчиков, у кого была куплена подписка в бот
$query = 'select tg_id, date_buy_sub, date_sub_over from all_users_tg';
$result = $adb->pquery($query);
if ($adb->num_rows($result) > 0) {
for ($i == 0; $i < $adb->num_rows($result); $i++) {
$tgid = $adb->query_result($result, $i, "tg_id"); //tgid подписчика
$buy = $adb->query_result($result, $i, "date_buy_sub"); // Дата покупки подписки
$over = $adb->query_result($result, $i, "date_sub_over"); // Дата истечения подписки
if (!empty($buy) or !empty($over)) {
// Если даты заполнены - значит клиент в подписке
$subscribed = '1';
} else {
// Или нет
$subscribed = '0';
}
// Найдем Контакта по его tgid, который у нас хранится почему-то в поле phone
$getquery = 'select c.contactid
from vtiger_contactdetails c
left join vtiger_crmentity e on e.crmid = c.contactid
where e.deleted = 0 and c.phone = ?';
$getresult = $adb->pquery($getquery, array($tgid));
if ($adb->num_rows($getresult) > 0) {
// Если нашелся - выкупим его id
$contactid = $adb->query_result($getresult, 0, "contactid");
// И обновим у него в доп.полях даты покупки и истечения подписки, а так же признак подписки
$updquery = 'update vtiger_contactscf set cf_1873 = ?, cf_1875 = ?, cf_1877 = ? where contactid = ?';
$updresult = $adb->pquery($updquery, array($subscribed, $buy, $over, $contactid));
}
}
}